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

chore(test): move polling_spec off of the control flow #5012

Merged
merged 5 commits into from
Nov 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 28 additions & 32 deletions spec/basic/polling_spec.js
Original file line number Diff line number Diff line change
@@ -3,59 +3,55 @@
* when using applications which poll with $http or $timeout.
* A better solution is to switch to the angular $interval service if possible.
*/
describe('synchronizing with pages that poll', function() {
beforeEach(function() {
browser.get('index.html#/polling');
describe('synchronizing with pages that poll', () => {
beforeEach(async () => {
await browser.get('index.html#/polling');
});

it('avoids timeouts using ignoreSynchronization', function() {
var startButton = element(by.id('pollstarter'));
it('avoids timeouts using ignoreSynchronization', async () => {
const startButton = element(by.id('pollstarter'));

const count = element(by.binding('count'));
expect(await count.getText()).toEqual('0');

var count = element(by.binding('count'));
expect(count.getText()).toEqual('0');

startButton.click();
await startButton.click();

// Turn this on to see timeouts.
browser.ignoreSynchronization = true;

count.getText().then(function(text) {
expect(text).toBeGreaterThan(-1);
});
const textBefore = await count.getText();
expect(textBefore).toBeGreaterThan(-1);

browser.sleep(2000);
await browser.sleep(2000);

count.getText().then(function(text) {
expect(text).toBeGreaterThan(1);
});
const textAfter = await count.getText();
expect(textAfter).toBeGreaterThan(1);
});

it('avoids timeouts using waitForAngularEnabled', function() {
var startButton = element(by.id('pollstarter'));
it('avoids timeouts using waitForAngularEnabled', async () => {
const startButton = element(by.id('pollstarter'));

var count = element(by.binding('count'));
expect(count.getText()).toEqual('0');
const count = element(by.binding('count'));
expect(await count.getText()).toEqual('0');

startButton.click();
await startButton.click();

// Turn this off to see timeouts.
browser.waitForAngularEnabled(false);
await browser.waitForAngularEnabled(false);

expect(browser.waitForAngularEnabled()).toBeFalsy();
expect(await browser.waitForAngularEnabled()).toBeFalsy();

count.getText().then(function(text) {
expect(text).toBeGreaterThan(-1);
});
const textBefore = await count.getText();
expect(textBefore).toBeGreaterThan(-1);

browser.sleep(2000);
await browser.sleep(2000);

count.getText().then(function(text) {
expect(text).toBeGreaterThan(1);
});
const textAfter = await count.getText();
expect(textAfter).toBeGreaterThan(1);
});

afterEach(function() {
afterEach(async () => {
// Remember to turn it back on when you're done!
browser.waitForAngularEnabled(true);
await browser.waitForAngularEnabled(true);
});
});
1 change: 1 addition & 0 deletions spec/basicConf.js
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@ exports.config = {
// 'basic/handling_spec.js',
// 'basic/mockmodule_spec.js',
// 'basic/navigation_spec.js',
// 'basic/polling_spec.js',
// 'basic/restart_spec.js',
],

1 change: 1 addition & 0 deletions spec/ciFullConf.js
Original file line number Diff line number Diff line change
@@ -17,6 +17,7 @@ exports.config = {
// 'basic/handling_spec.js'
// 'basic/mockmodule_spec.js',
// 'basic/navigation_spec.js',
// 'basic/polling_spec.js',
// 'basic/restart_spec.js',
],