Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Maria committed Mar 30, 2020
1 parent f2dc6fe commit c805da1
Show file tree
Hide file tree
Showing 20 changed files with 4,892 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
../../Desktop/e2e/.idea
node_modules
tests_output
chromedriver.log
debug.log
vrt
vrt/baseline
vrt/diff
vrt/latest
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
# nightwatch-example
# E2E with Nightwatch.js

Project template and simple test examples

## Installation

Install required dependencies
including Selenium Server and `chromedriver`:
```
npm install
```

## Execution

E2E:
```
npm run test
```

VRT:
```
npm run test:vrt
```

## Organizing

Tags:
```
'@tags': ['example'],
```

Ignore:
```
'@disabled': true
```



31 changes: 31 additions & 0 deletions nightwatch.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
module.exports = {

"src_folders" : ["src/tests/e2e"],
"page_objects_path": ["src/page-objects"],
"globals_path": "globals.js",


"webdriver" : {
"start_process": false,
"host": "localhost",
"server_path": "/node_modules/chromedriver/bin/chromedriver",
"port": 9515
},

"test_settings" : {
"default" : {
"desiredCapabilities": {
"browserName": "chrome"
}
},

"local" : {
"desiredCapabilities": {
"browserName": "chrome",
"chromeOptions" : {
"args" : ["start-maximized"]
}
}
}
}
}
38 changes: 38 additions & 0 deletions nightwatch.vrt.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
const path = require('path');
const baseConfig = require('./nightwatch.conf.js');

const config = {
...baseConfig,
src_folders: ['src/tests/vrt-tests'],
custom_commands_path: [
'node_modules/nightwatch-vrt/commands'
],
custom_assertions_path: [
'node_modules/nightwatch-vrt/assertions'
]
};


function generateScreenshotFilePath(nightwatchClient, basePath, fileName) {
const moduleName = nightwatchClient.currentTest.module,
testName = nightwatchClient.currentTest.name;

return path.join(process.cwd(), basePath, moduleName, testName, fileName);
}

config.test_settings.default.globals = {
'visual_regression_settings': {
'generate_screenshot_path': generateScreenshotFilePath,
'latest_screenshots_path': 'vrt/latest',
'latest_suffix': '',
'baseline_screenshots_path': 'vrt/baseline',
'baseline_suffix': '',
'diff_screenshots_path': 'vrt/diff',
'diff_suffix': '',
'threshold': 0,
'prompt': false,
'always_save_diff_screenshot': true // false == run comparing tests, true == collect a base screenshots
}
};

module.exports = config;
Loading

0 comments on commit c805da1

Please sign in to comment.