Skip to content

Commit ca535ea

Browse files
committed
e2e tests init
1 parent ed2b199 commit ca535ea

File tree

6 files changed

+88
-3
lines changed

6 files changed

+88
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ yarn-debug.log*
2525
yarn-error.log*
2626

2727
android/.idea/
28+
reports/

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,20 @@ Run unit tests:
106106
npm test
107107
```
108108

109+
Run e2e tests:
110+
1. Start the apps dev server:
111+
```bash
112+
npm run serve
113+
```
114+
115+
2. Start selenium
116+
```bash
117+
npm run selenium
118+
```
119+
120+
3. Run the tests
121+
```bash
122+
npm run e2e
123+
```
124+
109125
[![CodeFactor](https://www.codefactor.io/repository/github/nerdic-coder/block-photos/badge/master)](https://www.codefactor.io/repository/github/nerdic-coder/block-photos/overview/master)

nightwatch.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"src_folders" : ["tests"],
3+
"output_folder" : "reports",
4+
"custom_commands_path" : "",
5+
"custom_assertions_path" : "",
6+
"page_objects_path" : "",
7+
"globals_path" : "",
8+
9+
"selenium" : {
10+
"start_process" : false,
11+
"server_path" : "",
12+
"log_path" : "",
13+
"port" : 4444,
14+
"cli_args" : {
15+
"webdriver.chrome.driver" : "",
16+
"webdriver.gecko.driver" : "",
17+
"webdriver.edge.driver" : ""
18+
}
19+
},
20+
21+
"test_settings" : {
22+
"default" : {
23+
"launch_url" : "https://localhost:9876",
24+
"selenium_port" : 4444,
25+
"selenium_host" : "localhost",
26+
"silent": true,
27+
"screenshots" : {
28+
"enabled" : false,
29+
"path" : ""
30+
},
31+
"desiredCapabilities": {
32+
"browserName": "chrome",
33+
"marionette": true
34+
}
35+
},
36+
"chrome" : {
37+
"desiredCapabilities": {
38+
"browserName": "chrome",
39+
"chromeOptions" : {
40+
"args" : ["--no-sandbox --user-data-dir=E:\\workspaces\\block-photos\\tests\\session"]
41+
}
42+
}
43+
},
44+
45+
"edge" : {
46+
"desiredCapabilities": {
47+
"browserName": "MicrosoftEdge"
48+
}
49+
}
50+
}
51+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"start:react": "react-scripts start",
2929
"build:react": "react-scripts build",
3030
"test": "react-scripts test",
31-
"e2e": "nightwatch"
31+
"e2e": "nightwatch",
32+
"selenium": "selenium-standalone install && selenium-standalone start"
3233
},
3334
"config": {
3435
"forge": {
@@ -145,6 +146,7 @@
145146
"react-router-dom": "^4.3.1",
146147
"react-router-modal": "1.5.2",
147148
"react-scripts": "2.1.1",
149+
"selenium-standalone": "^6.15.4",
148150
"style-loader": "^0.23.1",
149151
"uniqid": "5.0.3",
150152
"url-loader": "1.1.2",

tests/Signin.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
'Signin' : function (browser) {
3+
browser
4+
.url('http://localhost:9876')
5+
.waitForElementVisible('body', 1000)
6+
// .setValue('input[type=text]', 'nightwatch')
7+
// .waitForElementVisible('button[name=btnG]', 1000)
8+
// .click('button[name=btnG]')
9+
.assert.containsText('ion-title', 'Block Photos')
10+
.assert.containsText('h1', 'Welcome to Block Photos!')
11+
.assert.containsText('ion-button', 'SIGN IN WITH BLOCKSTACK')
12+
.click('ion-button')
13+
// .assert.containsText('#main', 'Night Watch')
14+
.end();
15+
}
16+
};

webpack.config.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const WorkboxPlugin = require('workbox-webpack-plugin');
99

1010
const HtmlWebpackPlugin = require('html-webpack-plugin');
1111

12-
1312
let PUBLIC_PATH = './';
1413

1514
process.argv.forEach(function (val) {
@@ -35,7 +34,7 @@ module.exports = {
3534
publicPath: PUBLIC_PATH
3635
},
3736
devServer: {
38-
https: true,
37+
https: false,
3938
historyApiFallback: {
4039
disableDotRule: true
4140
},

0 commit comments

Comments
 (0)