Skip to content

Commit

Permalink
Update docs and bump version (#35)
Browse files Browse the repository at this point in the history
* Update docs and bump version

* Update examples

* Reformat code with prettier
  • Loading branch information
mucsi96 committed Oct 27, 2018
1 parent ef12f17 commit a06f121
Show file tree
Hide file tree
Showing 56 changed files with 303 additions and 319 deletions.
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"printWidth": 100,
"singleQuote": true
}
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ addons:
chrome: stable
language: node_js
node_js:
- "8"
- "10"
- '8'
- '10'
env:
global:
- DEBUG=nightwatch-api
Expand Down
21 changes: 13 additions & 8 deletions ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,37 @@ Your issue may already be reported!
Please search on the [issue track](../) before creating one.

## Expected Behavior

<!--- If you're describing a bug, tell us what should happen -->
<!--- If you're suggesting a change/improvement, tell us how it should work -->

## Current Behavior

<!--- If describing a bug, tell us what happens instead of the expected behavior -->
<!--- If suggesting a change/improvement, explain the difference from current behavior -->

## Possible Solution

<!--- Not obligatory, but suggest a fix/reason for the bug, -->
<!--- or ideas how to implement the addition or change -->

## Steps to Reproduce (for bugs)

<!--- Provide a link to a live example, or an unambiguous set of steps to -->
<!--- reproduce this bug. Include code to reproduce, if relevant -->
1.
2.
3.
4.

1. 2. 3. 4.

## Context

<!--- How has this issue affected you? What are you trying to accomplish? -->
<!--- Providing context helps us come up with a solution that is most useful in the real world -->

## Your Environment

<!--- Include as many relevant details about the environment you experienced the bug in -->
* Version used:
* Browser Name and version:
* Operating System and version (desktop or mobile):
* Link to your project:

- Version used:
- Browser Name and version:
- Operating System and version (desktop or mobile):
- Link to your project:
16 changes: 8 additions & 8 deletions packages/cucumber-example/nightwatch.conf.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
const chromedriver = require("chromedriver");
const geckodriver = require("geckodriver");
const chromedriver = require('chromedriver');
const geckodriver = require('geckodriver');

module.exports = {
test_settings: {
default: {
webdriver: {
start_process: true,
server_path: chromedriver.path,
cli_args: ["--port=4444"]
cli_args: ['--port=4444']
},
desiredCapabilities: {
browserName: "chrome",
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ["headless", "disable-gpu"]
args: ['headless', 'disable-gpu']
}
}
},
Expand All @@ -23,11 +23,11 @@ module.exports = {
server_path: chromedriver.path
},
desiredCapabilities: {
browserName: "chrome",
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ["disable-gpu"]
args: ['disable-gpu']
}
}
},
Expand All @@ -36,7 +36,7 @@ module.exports = {
server_path: geckodriver.path
},
desiredCapabilities: {
browserName: "firefox",
browserName: 'firefox',
marionette: true
}
}
Expand Down
8 changes: 4 additions & 4 deletions packages/cucumber-example/step-definitions/steps.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { client } from "nightwatch-api";
import { Given, Then } from "cucumber";
import { client } from 'nightwatch-api';
import { Given, Then } from 'cucumber';

Given(/^I open Google`s search page$/, async () => {
await client.url("http://google.com");
await client.url('http://google.com');
});

Given(/^I open DuckDuckGo search page$/, async () => {
await client.url("https://duckduckgo.com/");
await client.url('https://duckduckgo.com/');
});

Then(/^the title is "(.*?)"$/, async text => {
Expand Down
6 changes: 3 additions & 3 deletions packages/cucumber-example/test/server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { startWebDriver, stopWebDriver } from "nightwatch-api";
import { startWebDriver, stopWebDriver } from 'nightwatch-api';

startWebDriver("default").catch(err => console.log(err));
startWebDriver('default').catch(err => console.log(err));

process.once("SIGTERM", async () => {
process.once('SIGTERM', async () => {
try {
await stopWebDriver();
} finally {
Expand Down
6 changes: 3 additions & 3 deletions packages/cucumber-example/test/support/setup.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { setDefaultTimeout, AfterAll, BeforeAll } from "cucumber";
import { createSession, closeSession } from "nightwatch-api";
import { setDefaultTimeout, AfterAll, BeforeAll } from 'cucumber';
import { createSession, closeSession } from 'nightwatch-api';

setDefaultTimeout(60000);

BeforeAll(async () => {
await createSession("default");
await createSession({ env: 'default' });
});

AfterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-example/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module.exports = {
setupTestFrameworkScriptFile: "./test/setup"
setupTestFrameworkScriptFile: './test/setup'
};
16 changes: 8 additions & 8 deletions packages/jest-example/nightwatch.conf.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
const chromedriver = require("chromedriver");
const geckodriver = require("geckodriver");
const chromedriver = require('chromedriver');
const geckodriver = require('geckodriver');

module.exports = {
test_settings: {
default: {
webdriver: {
start_process: true,
server_path: chromedriver.path,
cli_args: ["--port=4444"]
cli_args: ['--port=4444']
},
desiredCapabilities: {
browserName: "chrome",
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ["headless", "disable-gpu"]
args: ['headless', 'disable-gpu']
}
}
},
Expand All @@ -23,11 +23,11 @@ module.exports = {
server_path: chromedriver.path
},
desiredCapabilities: {
browserName: "chrome",
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ["disable-gpu"]
args: ['disable-gpu']
}
}
},
Expand All @@ -36,7 +36,7 @@ module.exports = {
server_path: geckodriver.path
},
desiredCapabilities: {
browserName: "firefox",
browserName: 'firefox',
marionette: true
}
}
Expand Down
18 changes: 9 additions & 9 deletions packages/jest-example/test/duckduckgo-search.test.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { client } from "nightwatch-api";
import { client } from 'nightwatch-api';

describe("Searching DuckDuckGo", () => {
test("title and search form", async () => {
describe('Searching DuckDuckGo', () => {
test('title and search form', async () => {
await client
.url("https://duckduckgo.com/")
.assert.title("DuckDuckGo — Privacy, simplified.")
.url('https://duckduckgo.com/')
.assert.title('DuckDuckGo — Privacy, simplified.')
.assert.visible('input[name="q"]');
});

test("search for WebDriver", async () => {
test('search for WebDriver', async () => {
await client
.url("https://duckduckgo.com/")
.setValue('input[name="q"]', "WebDriver")
.url('https://duckduckgo.com/')
.setValue('input[name="q"]', 'WebDriver')
.click('input[type="submit"]')
.assert.containsText("#links", "WebDriver - w3.org");
.assert.containsText('#links', 'WebDriver - w3.org');
});
});
6 changes: 3 additions & 3 deletions packages/jest-example/test/server.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { startWebDriver, stopWebDriver } from "nightwatch-api";
import { startWebDriver, stopWebDriver } from 'nightwatch-api';

startWebDriver("default").catch(err => console.log(err));
startWebDriver({ env: 'default' }).catch(err => console.log(err));

process.once("SIGTERM", async () => {
process.once('SIGTERM', async () => {
try {
await stopWebDriver();
} finally {
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-example/test/setup.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createSession, closeSession } from "nightwatch-api";
import { createSession, closeSession } from 'nightwatch-api';

jest.setTimeout(60000);

beforeAll(async () => {
await createSession("default");
await createSession({ env: 'default' });
});

afterAll(async () => {
Expand Down
6 changes: 1 addition & 5 deletions packages/nightwatch-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nightwatch-api",
"version": "0.4.0",
"version": "1.0.0",
"main": "./lib/index.js",
"files": [
"lib",
Expand Down Expand Up @@ -65,10 +65,6 @@
"pre-commit": "pretty-quick --staged"
}
},
"prettier": {
"printWidth": 100,
"singleQuote": true
},
"dependencies": {
"debug": "^4.1.0",
"@types/debug": "^0.0.31"
Expand Down
1 change: 1 addition & 0 deletions packages/nightwatch-api/test/nightwatch.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ module.exports = {
webdriver: {
start_process: true,
server_path: chromedriver.path,
port: 4444,
cli_args: ['--port=4444']
},
desiredCapabilities: {
Expand Down
16 changes: 8 additions & 8 deletions packages/node-example/nightwatch.conf.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
const chromedriver = require("chromedriver");
const geckodriver = require("geckodriver");
const chromedriver = require('chromedriver');
const geckodriver = require('geckodriver');

module.exports = {
test_settings: {
default: {
webdriver: {
start_process: true,
server_path: chromedriver.path,
cli_args: ["--port=4444"]
cli_args: ['--port=4444']
},
desiredCapabilities: {
browserName: "chrome",
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ["headless", "disable-gpu"]
args: ['headless', 'disable-gpu']
}
}
},
Expand All @@ -23,11 +23,11 @@ module.exports = {
server_path: chromedriver.path
},
desiredCapabilities: {
browserName: "chrome",
browserName: 'chrome',
javascriptEnabled: true,
acceptSslCerts: true,
chromeOptions: {
args: ["disable-gpu"]
args: ['disable-gpu']
}
}
},
Expand All @@ -36,7 +36,7 @@ module.exports = {
server_path: geckodriver.path
},
desiredCapabilities: {
browserName: "firefox",
browserName: 'firefox',
marionette: true
}
}
Expand Down
14 changes: 7 additions & 7 deletions packages/node-example/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const {
startWebDriver,
stopWebDriver,
client
} = require("nightwatch-api");
} = require('nightwatch-api');

async function setup(env = "default") {
await startWebDriver(env);
await createSession(env);
async function setup(options) {
await startWebDriver(options);
await createSession(options);
}

async function shutdown() {
Expand All @@ -18,16 +18,16 @@ async function shutdown() {
}

async function run() {
await client.url("https://duckduckgo.com/");
await client.url('https://duckduckgo.com/');
let title;
await client.getTitle(t => (title = t));
await client.assert.title("DuckDuckGo — Privacy, simplified.");
await client.assert.title('DuckDuckGo — Privacy, simplified.');
console.log(title);
}

(async function() {
try {
await setup("default");
await setup({ env: 'default' });
await run();
} catch (err) {
console.log(err.stack);
Expand Down
14 changes: 7 additions & 7 deletions packages/website/.babelrc
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"presets": [
"@babel/preset-env",
"@babel/preset-react"
],
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": [
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-object-rest-spread",
["babel-plugin-styled-components", {
"ssr": true
}],
[
"babel-plugin-styled-components",
{
"ssr": true
}
],
"inline-react-svg"
]
}
Loading

0 comments on commit a06f121

Please sign in to comment.