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

Commit

Permalink
Merge branch 'selenium4' into suites
Browse files Browse the repository at this point in the history
  • Loading branch information
cnishina authored Nov 8, 2018
2 parents f0ab327 + 37043ca commit 7c45b34
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 53 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ env:
- LOGS_DIR=/tmp/protractor-build/logs
- BROWSER_PROVIDER_READY_FILE=/tmp/sauce-connect-ready
- CXX=g++-4.8
# TODO(selenium4): revert comments
matrix:
- JOB=full
- JOB=smoke
Expand Down Expand Up @@ -44,6 +45,7 @@ before_script:
- mkdir -p $LOGS_DIR
- ./scripts/travis_setup.sh


script:
- ./scripts/testserver.sh
- ./scripts/test_on_travis.sh
Expand Down
13 changes: 6 additions & 7 deletions spec/basic/handling_spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@

describe('handling timeout errors', function() {

it('should call error handler on a timeout', function() {
browser.get('http://dummyUrl', 1).then(function() {
describe('handling timeout errors', () => {
it('should call error handler on a timeout', async () => {
try {
await browser.get('http://dummyUrl', 1);
throw 'did not handle error';
}, function(err) {
} catch (err) {
expect(err instanceof Error).toBeTruthy();
});
}
});
});
80 changes: 36 additions & 44 deletions spec/basic/navigation_spec.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,50 @@
describe('navigation', function() {
beforeEach(function() {
browser.get('index.html#/form');
const env = require('./../environment.js');

describe('navigation', () => {
beforeEach(async () => {
await browser.get('index.html#/form');
});

it('should deal with alerts', function() {
var alertButton = $('#alertbutton');
alertButton.click();
var alertDialog = browser.switchTo().alert();
it('should deal with alerts', async () => {
const alertButton = $('#alertbutton');
await alertButton.click();
const alertDialog = await browser.switchTo().alert();

expect(alertDialog.getText()).toEqual('Hello');
expect(await alertDialog.getText()).toEqual('Hello');

alertDialog.accept();
await alertDialog.accept();
});

it('should refresh properly', function() {
var username = element(by.model('username'));
var name = element(by.binding('username'));
username.clear();
expect(name.getText()).toEqual('');

browser.navigate().refresh();
it('should refresh properly', async () => {
const username = element(by.model('username'));
const name = element(by.binding('username'));
await username.clear();
expect(await name.getText()).toEqual('');

expect(name.getText()).toEqual('Anon');
});
await browser.navigate().refresh();

// Back and forward do NOT work at the moment because of an issue
// bootstrapping with Angular
/*
it('should navigate back and forward properly', function() {
browser.get('index.html#/repeater');
expect(browser.getCurrentUrl()).
toEqual(env.baseUrl+'/ng1/index.html#/repeater');
browser.navigate().back();
expect(browser.getCurrentUrl()).
toEqual(env.baseUrl+'/ng1/index.html#/form');
browser.navigate().forward();
expect(browser.getCurrentUrl()).
toEqual(env.baseUrl+'/ng1/index.html#/repeater');
expect(await name.getText()).toEqual('Anon');
});
*/

it('should navigate back and forward properly', async () => {
await browser.get('index.html#/repeater');
expect(await browser.getCurrentUrl()).toEqual(`${env.baseUrl}/ng1/index.html#/repeater`);

it('should navigate back and forward properly from link', function() {
element(by.linkText('repeater')).click();
expect(browser.getCurrentUrl()).
toEqual(browser.baseUrl + 'index.html#/repeater');
await browser.navigate().back();
expect(await browser.getCurrentUrl()).toEqual(`${env.baseUrl}/ng1/index.html#/form`);

browser.navigate().back();
expect(browser.getCurrentUrl()).
toEqual(browser.baseUrl + 'index.html#/form');
await browser.navigate().forward();
expect(await browser.getCurrentUrl()).toEqual(`${env.baseUrl}/ng1/index.html#/repeater`);
});

browser.navigate().forward();
expect(browser.getCurrentUrl()).
toEqual(browser.baseUrl + 'index.html#/repeater');
it('should navigate back and forward properly from link', async () => {
await element(by.linkText('repeater')).click();
expect(await browser.getCurrentUrl()).toEqual(`${browser.baseUrl}index.html#/repeater`);

await browser.navigate().back();
expect(await browser.getCurrentUrl()).toEqual(`${browser.baseUrl}index.html#/form`);

await browser.navigate().forward();
expect(await browser.getCurrentUrl()).toEqual(`${browser.baseUrl}index.html#/repeater`);
});
});
4 changes: 3 additions & 1 deletion spec/basicConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ exports.config = {
// Spec patterns are relative to this directory.
specs: [
'basic/elements_spec.js',
'basic/lib_spec.js'
'basic/lib_spec.js',
'basic/navigation_spec.js',
'basic/handling_spec.js'
],

// Exclude patterns are relative to this directory.
Expand Down
4 changes: 3 additions & 1 deletion spec/ciFullConf.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ exports.config = {
// TODO(selenium4): revert back to basic/*_spec.js
specs: [
'basic/elements_spec.js',
'basic/lib_spec.js'
'basic/lib_spec.js',
'basic/navigation_spec.js',
'basic/handling_spec.js'
],

// Exclude patterns are relative to this directory.
Expand Down

0 comments on commit 7c45b34

Please sign in to comment.