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

Commit

Permalink
Revert "fix(jasmine): Update Jasmine to support Node8 async/await (#4608
Browse files Browse the repository at this point in the history
)"

This reverts commit 5d13b00.
This commit is unnecessary, revert this commit to avoid breaking changes
  • Loading branch information
qiyigg committed Dec 12, 2017
1 parent 8e5ad1f commit b3c7404
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 25 deletions.
6 changes: 1 addition & 5 deletions lib/frameworks/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,7 @@ exports.run = function(runner, specs) {
var jrunner = new JasmineRunner();
/* global jasmine */

// Don't even require JasmineWD if the control
// flow is turned off.
if (webdriver.promise.USE_PROMISE_MANAGER) {
require('jasminewd2').init(webdriver.promise.controlFlow(), webdriver);
}
require('jasminewd2').init(webdriver.promise.controlFlow(), webdriver);

var jasmineNodeOpts = runner.getConfig().jasmineNodeOpts;

Expand Down
38 changes: 19 additions & 19 deletions spec/ts/basic/element_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ describe('ElementFinder', function() {
await browser.get('index.html#/form');
const nameByElement = element(by.binding('username'));

expect(await nameByElement.getText())
.toEqual(await browser.findElement(by.binding('username')).getText());
await expect(nameByElement.getText())
.toEqual(browser.findElement(by.binding('username')).getText());
});

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

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

expect(await name.getText()).toEqual('Anon');
await expect(name.getText()).toEqual('Anon');

await usernameInput.clear();
await usernameInput.sendKeys('Jane');
expect(await name.getText()).toEqual('Jane');
await expect(name.getText()).toEqual('Jane');
});

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

expect(await name.getText()).toEqual('Anon');
await expect(name.getText()).toEqual('Anon');

await((usernameInput.clear() as any) as ElementFinder).sendKeys('Jane');
expect(await name.getText()).toEqual('Jane');
await expect(name.getText()).toEqual('Jane');
});

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

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

expect(await reused.getText()).toEqual('Inner: inner');
expect(await reused.isPresent()).toBe(true);
await expect(reused.getText()).toEqual('Inner: inner');
await expect(reused.isPresent()).toBe(true);
});

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

expect(await outerReused.getText()).toEqual('Outer: outer');
expect(await innerReused.getText()).toEqual('Inner: inner');
await expect(outerReused.getText()).toEqual('Outer: outer');
await expect(innerReused.getText()).toEqual('Inner: inner');
});

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

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

expect(await reused.getText()).toEqual('Inner: inner');
await expect(reused.getText()).toEqual('Inner: inner');
});

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

expect(await element(byCss).locator()).toEqual(byCss);
expect(await element(byBinding).locator()).toEqual(byBinding);
await expect(element(byCss).locator()).toEqual(byCss);
await expect(element(byBinding).locator()).toEqual(byBinding);
});

it('should propagate exceptions', async function() {
Expand All @@ -144,7 +144,7 @@ describe('ElementFinder', function() {
function() {
return false;
} as any as (() => ppromise.Promise<void>));
expect(await successful).toEqual(false);
await expect(successful).toEqual(false);
});

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

await helperPromise.then(async function(finalResult: ElementFinder) {
expect(await finalResult.getText()).toEqual('Hiya');
await expect(finalResult.getText()).toEqual('Hiya');
} as any as (() => ppromise.Promise<void>));
});

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

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

expect(await name.getText()).toEqual('Anon');
expect(await name.getText().then(null, function() {})).toEqual('Anon');
await expect(name.getText()).toEqual('Anon');
await expect(name.getText().then(null, function() {})).toEqual('Anon');

});

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

expect(await usernameInput.equals(usernameInput)).toEqual(true);
expect(await usernameInput.equals(name)).toEqual(false);
await expect(usernameInput.equals(usernameInput)).toEqual(true);
await expect(usernameInput.equals(name)).toEqual(false);
});
});
2 changes: 1 addition & 1 deletion spec/ts/plugin/plugin_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import {browser, protractor} from '../../..';
describe('plugins', function() {
it('should have run the onPageLoad hook', async function() {
await browser.get('index.html');
expect(await (protractor as any).ON_PAGE_LOAD).toBe(true);
await expect((protractor as any).ON_PAGE_LOAD).toBe(true);
});
});

0 comments on commit b3c7404

Please sign in to comment.