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

chore(test): move hybrid/async_spec off of the control flow #5024

Merged
merged 3 commits into from
Nov 9, 2018
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion scripts/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var passingTests = [
// 'node built/cli.js spec/customFramework.js',
// 'node built/cli.js spec/noGlobalsConf.js',
// 'node built/cli.js spec/angular2Conf.js',
// 'node built/cli.js spec/hybridConf.js',
'node built/cli.js spec/hybridConf.js',
'node built/cli.js spec/built/noCFBasicConf.js',
'node built/cli.js spec/built/noCFBasicConf.js --useBlockingProxy',
'node built/cli.js spec/built/noCFPluginConf.js',
Expand Down
107 changes: 54 additions & 53 deletions spec/hybrid/async_spec.js
Original file line number Diff line number Diff line change
@@ -1,71 +1,72 @@
describe('async angular1/2 hybrid using ngUpgrade application', function() {
describe('@angular/upgrade/static', function() {
it('should be able to click buttons and wait for $timeout', function() {
browser.get('/upgrade');
describe('async angular1/2 hybrid using ngUpgrade application', () => {
describe('@angular/upgrade/static', () => {
it('should be able to click buttons and wait for $timeout', async () => {
await browser.get('/upgrade');

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

var ng2Btn = $$('ng2 button').first();
expect(ng2Btn.getText()).toEqual('Click Count: 0');
ng2Btn.click();
expect(ng2Btn.getText()).toEqual('Click Count: 1');
const ng2Btn = $$('ng2 button').first();
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
await ng2Btn.click();
expect(await ng2Btn.getText()).toEqual('Click Count: 1');

var ng1Btn = $('ng1 button');
expect(ng1Btn.getText()).toEqual('Click Count: 0');
ng1Btn.click();
expect(ng1Btn.getText()).toEqual('Click Count: 1');
const ng1Btn = $('ng1 button');
expect(await ng1Btn.getText()).toEqual('Click Count: 0');
await ng1Btn.click();
expect(await ng1Btn.getText()).toEqual('Click Count: 1');
});

it('should be able to automatically infer ng1/ng2/ngUpgrade', function() {
browser.get('/upgrade');
expect($('h1').getText()).toBe('My App');
browser.get('/ng1');
expect($$('h4').first().getText()).toBe('Bindings');
browser.get('/upgrade');
expect($('h1').getText()).toBe('My App');
browser.get('/ng2');
expect($('h1').getText()).toBe('Test App for Angular 2');
browser.get('/upgrade');
expect($('h1').getText()).toBe('My App');
it('should be able to automatically infer ng1/ng2/ngUpgrade', async () => {
await browser.get('/upgrade');
expect(await $('h1').getText()).toBe('My App');
await browser.get('/ng1');
expect(await $$('h4').first().getText()).toBe('Bindings');
await browser.get('/upgrade');
expect(await $('h1').getText()).toBe('My App');
await browser.get('/ng2');
expect(await $('h1').getText()).toBe('Test App for Angular 2');
await browser.get('/upgrade');
expect(await $('h1').getText()).toBe('My App');
});
});

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

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

var ng2Btn = $$('ng2 button').first();
expect(ng2Btn.getText()).toEqual('Click Count: 0');
ng2Btn.click();
expect(ng2Btn.getText()).toEqual('Click Count: 1');
const ng2Btn = $$('ng2 button').first();
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
await ng2Btn.click();
expect(await ng2Btn.getText()).toEqual('Click Count: 1');

var ng1Btn = $('ng1 button');
expect(ng1Btn.getText()).toEqual('Click Count: 0');
ng1Btn.click();
expect(ng1Btn.getText()).toEqual('Click Count: 1');
const ng1Btn = $('ng1 button');
expect(await ng1Btn.getText()).toEqual('Click Count: 0');
await ng1Btn.click();
expect(await ng1Btn.getText()).toEqual('Click Count: 1');
});
});
});
describe('async angular1/2 hybrid using downgrade application', function() {
it('should be able to click buttons and wait for $timeout', function() {
browser.get('/upgrade?downgrade');

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

var ng2Btn = $$('ng2 button').first();
expect(ng2Btn.getText()).toEqual('Click Count: 0');
ng2Btn.click();
expect(ng2Btn.getText()).toEqual('Click Count: 1');
const rootBtn = $$('my-app button').first();
expect(await rootBtn.getText()).toEqual('Click Count: 0');
await rootBtn.click();
expect(await rootBtn.getText()).toEqual('Click Count: 1');

const ng2Btn = $$('ng2 button').first();
expect(await ng2Btn.getText()).toEqual('Click Count: 0');
await ng2Btn.click();
expect(await ng2Btn.getText()).toEqual('Click Count: 1');
});
});
3 changes: 2 additions & 1 deletion spec/hybridConf.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
var env = require('./environment');
const env = require('./environment');

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

framework: 'jasmine',

Expand Down
3 changes: 2 additions & 1 deletion spec/ng2/async_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ describe('async angular2 application', () => {
// Waits for the val to count 2.
const EC = protractor.ExpectedConditions;
await timeout.$('.action').click();
// Increase waiting time from 4s to 7s due to slow connection during SauceLabs tests
await browser.wait(EC.textToBePresentInElement(timeout.$('.val'), '1'),
4000);
7000);
await timeout.$('.cancel').click();

const text = timeout.$('.val').getText();
Expand Down