Skip to content

Commit 9ae0cb7

Browse files
author
Wenjun Che
committed
RUN-633: init check-in
1 parent d3fbd05 commit 9ae0cb7

File tree

4 files changed

+32
-49
lines changed

4 files changed

+32
-49
lines changed

test/WD/Mocha/hello-openfin.js

+5-14
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,17 @@ var wd = require('wd');
1616
// enables chai assertion chaining
1717
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
1818

19-
var config = require("../../tests_config");
19+
var config = require("../../config");
2020

2121

22-
describe('Hello OpenFin App testing', function() {
23-
var client, notificationButton, cpuInfoButton, cpuInfoExitButton;
22+
describe('Hello OpenFin App testing with WD', function() {
23+
var client;
2424

2525
this.timeout(config.testTimeout);
2626

2727
before(function() {
28-
client = wd.promiseChainRemote(url.parse("http://10.211.55.4:9515"));
29-
30-
// client = wd.remote(url.parse(config.driverServerUrl));
31-
return client.init({
32-
browserName: 'chrome',
33-
'chromeOptions': {
34-
args: [],
35-
extensions: [],
36-
debuggerAddress: 'localhost:9090'
37-
}
38-
});
28+
client = wd.promiseChainRemote(url.parse(config.remoteDriverUrl));
29+
return client.init(config.desiredCapabilities);
3930
});
4031

4132
after(function(done) {

test/WebDriverIO/Mocha/hello-openfin.js

+6-12
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,23 @@
1212
var should = require('chai').should(),
1313
webdriver = require('webdriverio'),
1414
assert = require("assert"),
15-
config = require("../../tests_config");
15+
config = require("../../config");
1616

1717

18-
describe('Hello OpenFin App testing', function() {
18+
describe('Hello OpenFin App testing with webdriver.io', function() {
1919
var client, notificationButton, cpuInfoButton, cpuInfoExitButton;
2020

2121
this.timeout(config.testTimeout);
2222

2323
before(function() {
2424
var driverOptions = {
25-
desiredCapabilities: {
26-
browserName: 'chrome',
27-
'chromeOptions': {
28-
args: [],
29-
extensions: [],
30-
debuggerAddress: 'localhost:9090'
31-
}
32-
},
33-
host: '10.211.55.4',
34-
port: 9515,
25+
desiredCapabilities: config.desiredCapabilities,
26+
host: config.remoteDriverHost,
27+
port: config.remoteDriverPort,
3528
logLevel: 'debug'
3629
};
3730
client = webdriver.remote(driverOptions).init();
31+
client.requestHandler.startPath = ""; // webdriverio defaults it to '/wd/hub';
3832
});
3933

4034
after(function(done) {

test/WebDriverJs/Mocha/hello-openfin.js

+4-9
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,18 @@ var expect = require('chai').expect,
88
until = require('selenium-webdriver').until,
99
webdriver = require('selenium-webdriver'),
1010
chrome = require('selenium-webdriver/chrome'),
11-
config = require("../../tests_config");
11+
config = require("../../config");
1212

1313

14-
describe('Hello OpenFin App testing', function() {
14+
describe('Hello OpenFin App testing with selenium-webdriver', function() {
1515
var client, notificationButton, cpuInfoButton, cpuInfoExitButton;
1616

1717
this.timeout(config.testTimeout);
1818

1919
before(function() {
2020
var capabilities = webdriver.Capabilities.chrome();
21-
22-
capabilities.set('chromeOptions', {
23-
args: [],
24-
extensions: [],
25-
debuggerAddress: 'localhost:9090'
26-
});
27-
client = new webdriver.Builder().usingServer("http://10.211.55.4:9515").withCapabilities(capabilities).build();
21+
capabilities.set('chromeOptions', config.desiredCapabilities.chromeOptions);
22+
client = new webdriver.Builder().usingServer(config.remoteDriverUrl).withCapabilities(capabilities).build();
2823
});
2924

3025
after(function(done) {

test/config.js

+17-14
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,23 @@
44

55
"use strict";
66

7-
module.exports = {
8-
driverOptions: { // used by webdriver.io
7+
module.exports = (function() {
8+
var config = {
99
desiredCapabilities: {
10-
browserName: 'chrome'
10+
browserName: 'chrome',
11+
chromeOptions: {
12+
args: [],
13+
extensions: [],
14+
debuggerAddress: 'localhost:9090'
15+
}
1116
},
12-
host: 'localhost',
13-
port: 8818,
14-
logLevel: 'info'
15-
},
16-
driverServerUrl: "http://localhost:8818/wd/hub", // used by selenium-webdriver
17-
username: "[email protected]",
18-
password: "wenjun123",
19-
messageToJid: "[email protected]",
20-
chatAppUrl: 'http://chat.openf.in/newopenchat/index.html?adapter=http:%2F%2Fchat.openf.in%2Fnewstrophe%2Findex.html',
21-
testTimeout: 10000
17+
remoteDriverHost: "10.211.55.4",
18+
remoteDriverPort: 9515,
19+
testTimeout: 10000
20+
};
21+
22+
config.remoteDriverUrl = "http://" + config.remoteDriverHost + ":" + config.remoteDriverPort;
23+
return config;
24+
25+
})();
2226

23-
};

0 commit comments

Comments
 (0)