diff --git a/scripts/test.js b/scripts/test.js index 3643d23e1..3e029983f 100755 --- a/scripts/test.js +++ b/scripts/test.js @@ -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', diff --git a/spec/hybrid/async_spec.js b/spec/hybrid/async_spec.js index 6a09bceb4..8b2235104 100644 --- a/spec/hybrid/async_spec.js +++ b/spec/hybrid/async_spec.js @@ -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'); }); }); diff --git a/spec/hybridConf.js b/spec/hybridConf.js index 114c4d1aa..3bf95e24d 100644 --- a/spec/hybridConf.js +++ b/spec/hybridConf.js @@ -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', diff --git a/spec/ng2/async_spec.js b/spec/ng2/async_spec.js index 11e3cc213..d747df5f7 100644 --- a/spec/ng2/async_spec.js +++ b/spec/ng2/async_spec.js @@ -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();