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

Commit b3c7404

Browse files
committed
Revert "fix(jasmine): Update Jasmine to support Node8 async/await (#4608)"
This reverts commit 5d13b00. This commit is unnecessary, revert this commit to avoid breaking changes
1 parent 8e5ad1f commit b3c7404

File tree

3 files changed

+21
-25
lines changed

3 files changed

+21
-25
lines changed

lib/frameworks/jasmine.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,7 @@ exports.run = function(runner, specs) {
6363
var jrunner = new JasmineRunner();
6464
/* global jasmine */
6565

66-
// Don't even require JasmineWD if the control
67-
// flow is turned off.
68-
if (webdriver.promise.USE_PROMISE_MANAGER) {
69-
require('jasminewd2').init(webdriver.promise.controlFlow(), webdriver);
70-
}
66+
require('jasminewd2').init(webdriver.promise.controlFlow(), webdriver);
7167

7268
var jasmineNodeOpts = runner.getConfig().jasmineNodeOpts;
7369

spec/ts/basic/element_spec.ts

+19-19
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ describe('ElementFinder', function() {
88
await browser.get('index.html#/form');
99
const nameByElement = element(by.binding('username'));
1010

11-
expect(await nameByElement.getText())
12-
.toEqual(await browser.findElement(by.binding('username')).getText());
11+
await expect(nameByElement.getText())
12+
.toEqual(browser.findElement(by.binding('username')).getText());
1313
});
1414

1515
it('should wait to grab the WebElement until a method is called', async function() {
@@ -19,11 +19,11 @@ describe('ElementFinder', function() {
1919

2020
await browser.get('index.html#/form');
2121

22-
expect(await name.getText()).toEqual('Anon');
22+
await expect(name.getText()).toEqual('Anon');
2323

2424
await usernameInput.clear();
2525
await usernameInput.sendKeys('Jane');
26-
expect(await name.getText()).toEqual('Jane');
26+
await expect(name.getText()).toEqual('Jane');
2727
});
2828

2929
it('should chain element actions', async function() {
@@ -32,10 +32,10 @@ describe('ElementFinder', function() {
3232
const usernameInput = element(by.model('username'));
3333
const name = element(by.binding('username'));
3434

35-
expect(await name.getText()).toEqual('Anon');
35+
await expect(name.getText()).toEqual('Anon');
3636

3737
await((usernameInput.clear() as any) as ElementFinder).sendKeys('Jane');
38-
expect(await name.getText()).toEqual('Jane');
38+
await expect(name.getText()).toEqual('Jane');
3939
});
4040

4141
it('should run chained element actions in sequence', function(done: any) {
@@ -75,8 +75,8 @@ describe('ElementFinder', function() {
7575

7676
await browser.get('index.html#/conflict');
7777

78-
expect(await reused.getText()).toEqual('Inner: inner');
79-
expect(await reused.isPresent()).toBe(true);
78+
await expect(reused.getText()).toEqual('Inner: inner');
79+
await expect(reused.isPresent()).toBe(true);
8080
});
8181

8282
it('should differentiate elements with the same binding by chaining', async function() {
@@ -85,8 +85,8 @@ describe('ElementFinder', function() {
8585
const outerReused = element(by.binding('item.reusedBinding'));
8686
const innerReused = element(by.id('baz')).element(by.binding('item.reusedBinding'));
8787

88-
expect(await outerReused.getText()).toEqual('Outer: outer');
89-
expect(await innerReused.getText()).toEqual('Inner: inner');
88+
await expect(outerReused.getText()).toEqual('Outer: outer');
89+
await expect(innerReused.getText()).toEqual('Inner: inner');
9090
});
9191

9292
it('should chain deeper than 2', async function() {
@@ -96,7 +96,7 @@ describe('ElementFinder', function() {
9696

9797
await browser.get('index.html#/conflict');
9898

99-
expect(await reused.getText()).toEqual('Inner: inner');
99+
await expect(reused.getText()).toEqual('Inner: inner');
100100
});
101101

102102
it('should allow handling errors', async function() {
@@ -129,8 +129,8 @@ describe('ElementFinder', function() {
129129
const byCss = by.css('body');
130130
const byBinding = by.binding('greet');
131131

132-
expect(await element(byCss).locator()).toEqual(byCss);
133-
expect(await element(byBinding).locator()).toEqual(byBinding);
132+
await expect(element(byCss).locator()).toEqual(byCss);
133+
await expect(element(byBinding).locator()).toEqual(byBinding);
134134
});
135135

136136
it('should propagate exceptions', async function() {
@@ -144,7 +144,7 @@ describe('ElementFinder', function() {
144144
function() {
145145
return false;
146146
} as any as (() => ppromise.Promise<void>));
147-
expect(await successful).toEqual(false);
147+
await expect(successful).toEqual(false);
148148
});
149149

150150
it('should be returned from a helper without infinite loops', async function() {
@@ -154,7 +154,7 @@ describe('ElementFinder', function() {
154154
});
155155

156156
await helperPromise.then(async function(finalResult: ElementFinder) {
157-
expect(await finalResult.getText()).toEqual('Hiya');
157+
await expect(finalResult.getText()).toEqual('Hiya');
158158
} as any as (() => ppromise.Promise<void>));
159159
});
160160

@@ -169,8 +169,8 @@ describe('ElementFinder', function() {
169169

170170
const name = element(by.binding('username'));
171171

172-
expect(await name.getText()).toEqual('Anon');
173-
expect(await name.getText().then(null, function() {})).toEqual('Anon');
172+
await expect(name.getText()).toEqual('Anon');
173+
await expect(name.getText().then(null, function() {})).toEqual('Anon');
174174

175175
});
176176

@@ -180,7 +180,7 @@ describe('ElementFinder', function() {
180180
const usernameInput = element(by.model('username'));
181181
const name = element(by.binding('username'));
182182

183-
expect(await usernameInput.equals(usernameInput)).toEqual(true);
184-
expect(await usernameInput.equals(name)).toEqual(false);
183+
await expect(usernameInput.equals(usernameInput)).toEqual(true);
184+
await expect(usernameInput.equals(name)).toEqual(false);
185185
});
186186
});

spec/ts/plugin/plugin_spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ import {browser, protractor} from '../../..';
33
describe('plugins', function() {
44
it('should have run the onPageLoad hook', async function() {
55
await browser.get('index.html');
6-
expect(await (protractor as any).ON_PAGE_LOAD).toBe(true);
6+
await expect((protractor as any).ON_PAGE_LOAD).toBe(true);
77
});
88
});

0 commit comments

Comments
 (0)