Skip to content

Commit 75fbd25

Browse files
Example for WDIO issue #5090
0 parents  commit 75fbd25

File tree

8 files changed

+121
-0
lines changed

8 files changed

+121
-0
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
WDIO issue
2+
https://github.com/webdriverio/webdriverio/issues/5090
3+
4+
To reproduce:
5+
6+
`npm run test:devtools`
7+
8+
Both
9+
10+
`npm run test:grid`
11+
12+
and
13+
14+
`npm run test:chromedriver`
15+
16+
pass

configs/base.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const path = require('path');
2+
3+
exports.config = {
4+
hostname: 'localhost',
5+
specs: [path.resolve('tests/*.*js')],
6+
logLevel: 'trace',
7+
framework: 'mocha',
8+
outputDir: __dirname,
9+
reporters: ['spec'],
10+
mochaOpts: {
11+
ui: 'bdd',
12+
timeout: 60000
13+
},
14+
};

configs/chromedriver.config.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const path = require('path')
2+
3+
exports.config = {
4+
...require("./base.config").config,
5+
port: 4444,
6+
path: '/',
7+
services: ['chromedriver'],
8+
chromeDriverArgs: ['--port=4444'], // default for ChromeDriver
9+
capabilities: [
10+
{
11+
browserName: 'chrome'
12+
}
13+
]
14+
};

configs/devtools.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const path = require('path')
2+
3+
exports.config = {
4+
...require("./base.config").config,
5+
automationProtocol: 'devtools',
6+
capabilities: [
7+
{
8+
browserName: 'chrome'
9+
}
10+
]
11+
};

configs/grid.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
exports.config = {
2+
...require("./base.config").config,
3+
services: ['selenium-standalone'],
4+
port: 4444,
5+
path: '/wd/hub',
6+
capabilities: [
7+
{
8+
browserName: 'chrome'
9+
}
10+
]
11+
};

package.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"name": "wdio-repro-devtools-input",
3+
"scripts": {
4+
"test:chromedriver": "wdio configs/chromedriver.config.js",
5+
"test:grid": "wdio configs/grid.config.js",
6+
"test:devtools": "wdio configs/devtools.config.js"
7+
},
8+
"repository": {
9+
"type": "git",
10+
"url": "git@https://github.com/nextlevelbeard/wdio-repro-devtools-input.git"
11+
},
12+
"keywords": [
13+
"e2e",
14+
"tests",
15+
"e2e-tests"
16+
],
17+
"homepage": "https://github.com/nextlevelbeard/wdio-repro-devtools-input",
18+
"dependencies": {
19+
"@wdio/allure-reporter": "^5.18.6",
20+
"@wdio/cli": "^5.19.0",
21+
"@wdio/config": "^5.18.4",
22+
"@wdio/local-runner": "^5.19.0",
23+
"@wdio/logger": "^5.16.10",
24+
"@wdio/mocha-framework": "^5.18.7",
25+
"@wdio/runner": "^5.19.0",
26+
"@wdio/selenium-standalone-service": "^5.16.10",
27+
"@wdio/spec-reporter": "^5.18.7",
28+
"@wdio/sync": "^5.18.7",
29+
"chai": "latest",
30+
"chromedriver": "latest",
31+
"devtools": "^5.19.0",
32+
"wdio-chromedriver-service": "^5.0.2",
33+
"webdriver": "^5.19.0",
34+
"webdriverio": "^5.19.0"
35+
},
36+
"engines": {
37+
"node": ">=12.13.0",
38+
"npm": ">=6.12.0"
39+
}
40+
}

sample.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
this is a sample file

tests/repro.test.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const path = require("path");
2+
const expect = require("chai").expect;
3+
4+
describe('webdriver.io', () => {
5+
it('should upload sucessfully', () => {
6+
const filename = "sample.txt";
7+
browser.url('http://the-internet.herokuapp.com/upload');
8+
const input = $('#file-upload');
9+
input.addValue(path.resolve(filename));
10+
expect(input.getValue()).to.include(filename);
11+
$("#file-submit").click();
12+
expect($("#uploaded-files").getText()).to.include(filename)
13+
})
14+
});

0 commit comments

Comments
 (0)