Skip to content

Commit 97b8951

Browse files
committed
fix(test): mocha test
1 parent e4792b5 commit 97b8951

File tree

4 files changed

+41
-2
lines changed

4 files changed

+41
-2
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ install:
1111
script:
1212
# - npm run test
1313
- if [ $TO_TEST == 'ALL' ];
14-
then npm run saucelabs-test-standalone;
14+
then npm run saucelabs-test-mocha;
1515
fi
1616
after_success:
1717
- npm run codecov

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
"saucelabs-test-local": "./node_modules/.bin/wdio wdio.conf.local.js",
2323
"presaucelabs-test-standalone": "npm run test:simple-doc",
2424
"saucelabs-test-standalone": "node ./test/saucelabs/teststandalone.js",
25-
"saucelabs-test-webdriver": "node ./test/saucelabs/test-webdriver.js"
25+
"saucelabs-test-webdriver": "node ./test/saucelabs/test-webdriver.js",
26+
"saucelabs-test-mocha": "cross-env TS_NODE_PROJECT=test/tsconfig.json TS_NODE_DISABLE_WARNINGS=1 nyc mocha --opts test/mocha.opts"
2627
},
2728
"watch": {
2829
"build": {

test/mocha-e2e.opts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
--reporter spec
2+
--ui bdd
3+
--colors
4+
--harmony
5+
--timeout 120000
6+
--compilers ts:ts-node/register
7+
test/saucelabs/mocha.spec.ts

test/saucelabs/mocha.spec.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
var expect = require('chai').expect,
2+
test = require('selenium-webdriver/testing'),
3+
webdriver = require('selenium-webdriver'),
4+
username = process.env.SAUCE_USERNAME,
5+
accessKey = process.env.SAUCE_ACCESS_KEY;
6+
7+
test.describe('Google Search', function() {
8+
test.it('should work', function() {
9+
var driver = new webdriver.Builder()
10+
.withCapabilities({
11+
'browserName': 'chrome',
12+
'platform': 'Windows XP',
13+
'version': '43.0',
14+
'username': username,
15+
'accessKey': accessKey
16+
})
17+
.usingServer("http://" + username + ":" + accessKey + "@ondemand.saucelabs.com:80/wd/hub")
18+
.build();
19+
driver.get('http://www.google.com');
20+
21+
var searchBox = driver.findElement(webdriver.By.name('q'));
22+
23+
searchBox.sendKeys('simple programmer');
24+
25+
searchBox.getAttribute('value').then(function(value) {
26+
expect(value).to.equal('simple programmer');
27+
});
28+
29+
driver.quit();
30+
});
31+
});

0 commit comments

Comments
 (0)