Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Commit 32abb66

Browse files
authored
Merge branch 'selenium4' into no_globals_spec
2 parents 75fe094 + 6b3d9c0 commit 32abb66

21 files changed

+286
-273
lines changed

scripts/test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,20 @@ var passingTests = [
2828
'node built/cli.js spec/plugins/browserGetSyncedConf.js',
2929
'node built/cli.js spec/plugins/browserGetUnsyncedConf.js',
3030
'node built/cli.js spec/plugins/waitForAngularConf.js',
31-
// 'node built/cli.js spec/interactionConf.js',
32-
// 'node built/cli.js spec/directConnectConf.js',
33-
// 'node built/cli.js spec/restartBrowserBetweenTestsConf.js',
34-
// 'node built/cli.js spec/driverProviderLocalConf.js',
35-
// 'node built/cli.js spec/driverProviderLocalConf.js --useBlockingProxy',
36-
// 'node built/cli.js spec/getCapabilitiesConf.js',
37-
// 'node built/cli.js spec/controlLockConf.js',
38-
// 'node built/cli.js spec/customFramework.js',
31+
'node built/cli.js spec/interactionConf.js',
32+
'node built/cli.js spec/directConnectConf.js',
33+
'node built/cli.js spec/restartBrowserBetweenTestsConf.js',
34+
'node built/cli.js spec/driverProviderLocalConf.js',
35+
'node built/cli.js spec/driverProviderLocalConf.js --useBlockingProxy',
36+
'node built/cli.js spec/getCapabilitiesConf.js',
37+
'node built/cli.js spec/controlLockConf.js',
38+
'node built/cli.js spec/customFramework.js',
3939
'node built/cli.js spec/noGlobalsConf.js',
4040
// 'node built/cli.js spec/angular2Conf.js',
41-
// 'node built/cli.js spec/hybridConf.js',
42-
// 'node built/cli.js spec/built/noCFBasicConf.js',
43-
// 'node built/cli.js spec/built/noCFBasicConf.js --useBlockingProxy',
44-
// 'node built/cli.js spec/built/noCFPluginConf.js',
41+
'node built/cli.js spec/hybridConf.js',
42+
'node built/cli.js spec/built/noCFBasicConf.js',
43+
'node built/cli.js spec/built/noCFBasicConf.js --useBlockingProxy',
44+
'node built/cli.js spec/built/noCFPluginConf.js',
4545
// //'node scripts/driverProviderAttachSession.js',
4646
// 'node built/cli.js spec/driverProviderUseExistingWebDriver.js',
4747
// 'node built/cli.js spec/driverProviderUseExistingWebDriver.js --useBlockingProxy',

spec/control/spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
describe('protractor control flow', function() {
2-
it('should not deadlock', function() {
3-
browser.driver.wait(function() {
1+
describe('protractor control flow', () => {
2+
it('should not deadlock', async() => {
3+
await browser.driver.wait(() => {
44
return true;
55
}, 1000);
66
expect(true).toEqual(true);

spec/controlLockConf.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
var env = require('./environment.js');
2-
var webdriver = require('selenium-webdriver');
1+
const env = require('./environment.js');
2+
const webdriver = require('selenium-webdriver');
33

44
// Tests for cases that have caused WebDriver promise locks in
55
// the past.
66
exports.config = {
77
seleniumAddress: env.seleniumAddress,
8+
SELENIUM_PROMISE_MANAGER: false,
89

910
framework: 'jasmine',
1011

@@ -16,15 +17,15 @@ exports.config = {
1617

1718
baseUrl: env.baseUrl + '/ng1/',
1819

19-
onPrepare: function() {
20-
20+
onPrepare: async function() {
2121
// This is a reasonable use case - do some promise that takes some time,
2222
// and then do a wait until something is set up correctly.
23-
return webdriver.promise.delayed(100).then(function() {
24-
// This could also be replaced by an 'execute' to see the same behavior.
25-
return browser.driver.wait(function() {
26-
return true;
27-
}, 10000, 'onPrepare wait');
23+
await new Promise(resolve => {
24+
setTimeout(resolve, 100);
2825
});
26+
// This could also be replaced by an 'execute' to see the same behavior.
27+
return await browser.driver.wait(function() {
28+
return true;
29+
}, 10000, 'onPrepare wait');
2930
}
3031
};

spec/custom/smoke_spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
describe('smoke jasmine tests', function() {
2-
it('should do some dummy test', function() {
1+
describe('smoke jasmine tests', () => {
2+
it('should do some dummy test', () => {
33
expect(1).toBe(1);
44
});
55
});

spec/customFramework.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
var env = require('./environment.js');
1+
const env = require('./environment.js');
22

33
exports.config = {
44
seleniumAddress: env.seleniumAddress,
5+
SELENIUM_PROMISE_MANAGER: false,
56

67
framework: 'custom',
78
frameworkPath: './custom/framework.js',
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
describe('direct connect', function() {
2-
it('should instantiate and run', function() {
3-
var usernameInput = element(by.model('username'));
4-
var name = element(by.binding('username'));
1+
describe('direct connect', () => {
2+
it('should instantiate and run', async() => {
3+
const usernameInput = element(by.model('username'));
4+
const name = element(by.binding('username'));
55

6-
browser.get('index.html#/form');
6+
await browser.get('index.html#/form');
77

8-
expect(name.getText()).toEqual('Anon');
8+
expect(await name.getText()).toEqual('Anon');
99

10-
usernameInput.clear();
11-
usernameInput.sendKeys('Jane');
12-
expect(name.getText()).toEqual('Jane');
10+
await usernameInput.clear();
11+
await usernameInput.sendKeys('Jane');
12+
expect(await name.getText()).toEqual('Jane');
1313
});
1414
});

spec/directConnectConf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var env = require('./environment.js');
33
// A configuration file running a simple direct connect spec
44
exports.config = {
55
directConnect: true,
6+
SELENIUM_PROMISE_MANAGER: false,
67

78
framework: 'jasmine',
89

spec/driverProviderLocalConf.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ var env = require('./environment');
33
exports.config = {
44

55
framework: 'jasmine',
6+
SELENIUM_PROMISE_MANAGER: false,
67

78
specs: [
89
'driverProviders/local/*_spec.js'
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
describe('local driver provider', function() {
2-
var URL = '/ng2/#/async';
1+
describe('local driver provider', () => {
2+
const URL = '/ng2/#/async';
33

4-
it('should get a page and find an element', function() {
5-
browser.get(URL);
6-
var increment = $('#increment');
7-
expect(increment).toBeDefined();
4+
it('should get a page and find an element', async() => {
5+
await browser.get(URL);
6+
const increment = $('#increment');
7+
expect(await increment.isPresent()).toBeDefined();
88
});
99

10-
it('should get a forked instance, and find an element', function() {
11-
browser.get(URL);
12-
var browser2 = browser.forkNewDriverInstance();
13-
browser2.get(URL);
14-
var increment = browser2.$('#increment');
15-
expect(increment).toBeDefined();
10+
it('should get a forked instance, and find an element', async() => {
11+
await browser.get(URL);
12+
const browser2 = await browser.forkNewDriverInstance().ready;
13+
await browser2.get(URL);
14+
const increment = browser2.$('#increment');
15+
expect(await increment.isPresent()).toBeDefined();
1616
});
1717
});

spec/getCapabilitiesConf.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
1-
var env = require('./environment.js');
2-
var q = require('q');
1+
const env = require('./environment.js');
32

43
exports.config = {
54
seleniumAddress: env.seleniumAddress,
5+
SELENIUM_PROMISE_MANAGER: false,
66

77
// Spec patterns are relative to this directory.
88
specs: [
99
'basic/mock*'
1010
],
1111

1212
framework: 'debugprint',
13-
getMultiCapabilities: function() {
14-
var deferred = q.defer();
13+
getMultiCapabilities: async function() {
1514
// Wait for a server to be ready or get capabilities asynchronously.
16-
setTimeout(function() {
17-
deferred.resolve([{
18-
'browserName': 'firefox'
19-
}]);
20-
}, 1000);
21-
return deferred.promise;
15+
return await new Promise(resolve => {
16+
setTimeout(() => {
17+
resolve([{
18+
'browserName': 'firefox'
19+
}]);
20+
}, 1000);
21+
});
2222
},
2323

2424
baseUrl: env.baseUrl + '/ng1/'

spec/hybrid/async_spec.js

Lines changed: 54 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,72 @@
1-
describe('async angular1/2 hybrid using ngUpgrade application', function() {
2-
describe('@angular/upgrade/static', function() {
3-
it('should be able to click buttons and wait for $timeout', function() {
4-
browser.get('/upgrade');
1+
describe('async angular1/2 hybrid using ngUpgrade application', () => {
2+
describe('@angular/upgrade/static', () => {
3+
it('should be able to click buttons and wait for $timeout', async () => {
4+
await browser.get('/upgrade');
55

6-
var rootBtn = $$('my-app button').first();
7-
expect(rootBtn.getText()).toEqual('Click Count: 0');
8-
rootBtn.click();
9-
expect(rootBtn.getText()).toEqual('Click Count: 1');
6+
const rootBtn = $$('my-app button').first();
7+
expect(await rootBtn.getText()).toEqual('Click Count: 0');
8+
await rootBtn.click();
9+
expect(await rootBtn.getText()).toEqual('Click Count: 1');
1010

11-
var ng2Btn = $$('ng2 button').first();
12-
expect(ng2Btn.getText()).toEqual('Click Count: 0');
13-
ng2Btn.click();
14-
expect(ng2Btn.getText()).toEqual('Click Count: 1');
11+
const ng2Btn = $$('ng2 button').first();
12+
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
13+
await ng2Btn.click();
14+
expect(await ng2Btn.getText()).toEqual('Click Count: 1');
1515

16-
var ng1Btn = $('ng1 button');
17-
expect(ng1Btn.getText()).toEqual('Click Count: 0');
18-
ng1Btn.click();
19-
expect(ng1Btn.getText()).toEqual('Click Count: 1');
16+
const ng1Btn = $('ng1 button');
17+
expect(await ng1Btn.getText()).toEqual('Click Count: 0');
18+
await ng1Btn.click();
19+
expect(await ng1Btn.getText()).toEqual('Click Count: 1');
2020
});
2121

22-
it('should be able to automatically infer ng1/ng2/ngUpgrade', function() {
23-
browser.get('/upgrade');
24-
expect($('h1').getText()).toBe('My App');
25-
browser.get('/ng1');
26-
expect($$('h4').first().getText()).toBe('Bindings');
27-
browser.get('/upgrade');
28-
expect($('h1').getText()).toBe('My App');
29-
browser.get('/ng2');
30-
expect($('h1').getText()).toBe('Test App for Angular 2');
31-
browser.get('/upgrade');
32-
expect($('h1').getText()).toBe('My App');
22+
it('should be able to automatically infer ng1/ng2/ngUpgrade', async () => {
23+
await browser.get('/upgrade');
24+
expect(await $('h1').getText()).toBe('My App');
25+
await browser.get('/ng1');
26+
expect(await $$('h4').first().getText()).toBe('Bindings');
27+
await browser.get('/upgrade');
28+
expect(await $('h1').getText()).toBe('My App');
29+
await browser.get('/ng2');
30+
expect(await $('h1').getText()).toBe('Test App for Angular 2');
31+
await browser.get('/upgrade');
32+
expect(await $('h1').getText()).toBe('My App');
3333
});
3434
});
3535

36-
describe('@angular/upgrade (not static)', function() {
37-
it('should be able to click buttons and wait for $timeout', function() {
38-
browser.get('/upgrade?no_static');
36+
describe('@angular/upgrade (not static)', () => {
37+
it('should be able to click buttons and wait for $timeout', async () => {
38+
await browser.get('/upgrade?no_static');
3939

40-
var rootBtn = $$('my-app button').first();
41-
expect(rootBtn.getText()).toEqual('Click Count: 0');
42-
rootBtn.click();
43-
expect(rootBtn.getText()).toEqual('Click Count: 1');
40+
const rootBtn = $$('my-app button').first();
41+
expect(await rootBtn.getText()).toEqual('Click Count: 0');
42+
await rootBtn.click();
43+
expect(await rootBtn.getText()).toEqual('Click Count: 1');
4444

45-
var ng2Btn = $$('ng2 button').first();
46-
expect(ng2Btn.getText()).toEqual('Click Count: 0');
47-
ng2Btn.click();
48-
expect(ng2Btn.getText()).toEqual('Click Count: 1');
45+
const ng2Btn = $$('ng2 button').first();
46+
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
47+
await ng2Btn.click();
48+
expect(await ng2Btn.getText()).toEqual('Click Count: 1');
4949

50-
var ng1Btn = $('ng1 button');
51-
expect(ng1Btn.getText()).toEqual('Click Count: 0');
52-
ng1Btn.click();
53-
expect(ng1Btn.getText()).toEqual('Click Count: 1');
50+
const ng1Btn = $('ng1 button');
51+
expect(await ng1Btn.getText()).toEqual('Click Count: 0');
52+
await ng1Btn.click();
53+
expect(await ng1Btn.getText()).toEqual('Click Count: 1');
5454
});
5555
});
5656
});
57-
describe('async angular1/2 hybrid using downgrade application', function() {
58-
it('should be able to click buttons and wait for $timeout', function() {
59-
browser.get('/upgrade?downgrade');
6057

61-
var rootBtn = $$('my-app button').first();
62-
expect(rootBtn.getText()).toEqual('Click Count: 0');
63-
rootBtn.click();
64-
expect(rootBtn.getText()).toEqual('Click Count: 1');
58+
describe('async angular1/2 hybrid using downgrade application', () => {
59+
it('should be able to click buttons and wait for $timeout', async () => {
60+
await browser.get('/upgrade?downgrade');
6561

66-
var ng2Btn = $$('ng2 button').first();
67-
expect(ng2Btn.getText()).toEqual('Click Count: 0');
68-
ng2Btn.click();
69-
expect(ng2Btn.getText()).toEqual('Click Count: 1');
62+
const rootBtn = $$('my-app button').first();
63+
expect(await rootBtn.getText()).toEqual('Click Count: 0');
64+
await rootBtn.click();
65+
expect(await rootBtn.getText()).toEqual('Click Count: 1');
66+
67+
const ng2Btn = $$('ng2 button').first();
68+
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
69+
await ng2Btn.click();
70+
expect(await ng2Btn.getText()).toEqual('Click Count: 1');
7071
});
7172
});

spec/hybridConf.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
var env = require('./environment');
1+
const env = require('./environment');
22

33
// This is the configuration for a smoke test for a hybrid ng1/ng2 application.
44
exports.config = {
55
seleniumAddress: env.seleniumAddress,
6+
SELENIUM_PROMISE_MANAGER: false,
67

78
framework: 'jasmine',
89

0 commit comments

Comments
 (0)