Skip to content
This repository has been archived by the owner on Apr 15, 2019. It is now read-only.

Commit

Permalink
Ensure that protractor waits for the first element to interact with
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed May 15, 2017

Unverified

The committer email address is not verified.
1 parent 5f3c1da commit a8c1a29
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/spec/spec.js
Original file line number Diff line number Diff line change
@@ -42,6 +42,12 @@ function waitForElemAndClickIt(selector) {
elem.click();
}

function waitForElemAndSendKeys(selector, keys) {
const elem = element.all(by.css(selector)).get(0);
browser.wait(EC.presenceOf(elem), waitTime, `waiting for element '${selector}'`);
elem.sendKeys(keys);
}

function checkErrorMessage(message) {
waitForElemAndCheckItsText('transfer .md-input-message-animation', message);
}
@@ -55,7 +61,7 @@ function launchApp() {

function login(account) {
launchApp();
element(by.css('input[type="password"]')).sendKeys(account.passphrase);
waitForElemAndSendKeys('input[type="password"]', account.passphrase);
element(by.css('.md-button.md-primary.md-raised')).click();
}

@@ -147,7 +153,7 @@ function doPassphraseGenerationProcedure(callback) {
function testNewAccount() {
launchApp();

element.all(by.css('.md-button.md-primary')).get(0).click();
waitForElemAndClickIt('.md-button.md-primary');
doPassphraseGenerationProcedure(checkIsLoggedIn);
}

@@ -159,16 +165,14 @@ function testAddress() {
function testPeer() {
launchApp();
login(masterAccount);
expect(element.all(by.css('.peer .md-title')).get(0).getText()).toEqual('Peer');
expect(element.all(by.css('.peer .value')).get(0).getText()).toEqual('localhost:4000');
waitForElemAndCheckItsText('.peer .md-title', 'Peer');
waitForElemAndCheckItsText('.peer .value', 'localhost:4000');
}

function testChangeNetwork() {
launchApp();

const peerElem = element(by.css('form md-select'));
browser.wait(EC.presenceOf(peerElem), waitTime);
peerElem.click();
waitForElemAndClickIt('form md-select');

const optionElem = element.all(by.css('md-select-menu md-option')).get(1);
browser.wait(EC.presenceOf(optionElem), waitTime);

0 comments on commit a8c1a29

Please sign in to comment.