Skip to content
Permalink
Browse files

test(e2e): correct some timing issues in e2e tests

  • Loading branch information...
bitjson committed Apr 3, 2018
1 parent 7d04c71 commit 55b099b969db450e91fb0a67db00b8935875f731
@@ -22,7 +22,8 @@
"--multiCapabilities",
// Reasonable window size for side-by-side debugging
"--capabilities.chromeOptions.args=window-size=1050,800",
"--capabilities.chromeOptions.args=auto-open-devtools-for-tabs"
"--capabilities.chromeOptions.args=auto-open-devtools-for-tabs",
"--jasmineNodeOpts.defaultTimeoutInterval=600000"
],
"skipFiles": [
"<node_internals>/**/*.js",
@@ -11,8 +11,8 @@ const flags = [
];

exports.config = {
allScriptsTimeout: 1000 * 60 * 5,
jasmineNodeOpts: { defaultTimeoutInterval: 1000 * 60 * 5 },
allScriptsTimeout: 1000 * 10,
jasmineNodeOpts: { showColors: true, defaultTimeoutInterval: 1000 * 10 },
maxSessions: 4,
specs: ['./test/e2e/**/*.e2e-spec.ts'],
directConnect: true,
@@ -2,7 +2,7 @@ import { $, browser, by, element, ExpectedConditions as EC } from 'protractor';
import {
clearStorage,
clickIonAlertButton,
disableAnimations,
disableCSSAnimations,
expectPage,
holdMyProtractorIAmGoingIn,
ionicPageIs,
@@ -16,7 +16,7 @@ describe('Onboarding: Get Started', () => {
afterEach(clearStorage);
beforeEach(async () => {
await browser.get('');
await disableAnimations();
await disableCSSAnimations();
});

// The onboarding mega-test. Try everything:
@@ -1,6 +1,8 @@
import { $, browser, by, element, ExpectedConditions as EC } from 'protractor';
import {
clearStorage,
clickIonAlertButton,
disableCSSAnimations,
expectPage,
holdMyProtractorIAmGoingIn,
sendKeys,
@@ -12,23 +14,22 @@ import {
describe('Onboarding: Import Wallet', () => {
beforeEach(async () => {
await browser.get('');
await disableCSSAnimations();
await element(by.partialButtonText('backup')).click();
await waitForIonicPage('import-wallet');
});
afterEach(clearStorage);

it('initially shows words view', async () => {
it('has two views, each with advanced options', async () => {
await expectPage('import-wallet');
await element(
by.cssContainingText('ion-label', 'advanced options')
).click();
await takeScreenshot('import-wallet-advanced');
});

it('has file view', async () => {
await element(
by.cssContainingText('ion-label', 'advanced options')
).click();
await element(by.css('ion-segment-button[value=file]')).click();
// Tests often catch this view mid-animation (even with animations disabled)
browser.sleep(1000);
await takeScreenshot('import-wallet-file');
await element(
by.cssContainingText('ion-label', 'advanced options')
@@ -46,23 +47,13 @@ describe('Onboarding: Import Wallet', () => {
await element(by.css('ion-footer')).click();
await waitForIonAlert();
await takeScreenshot('import-wallet-with-encryption');
await element(
by.cssContainingText('ion-alert .alert-button', 'Yes')
).click();
await waitForIonAlert();
await clickIonAlertButton('Yes');
const p = 'hunter2';
await sendKeys(element(by.css('ion-alert input.alert-input')), p);
await takeScreenshot('import-wallet-with-encryption-input');
await element(
by.cssContainingText('ion-alert .alert-button', 'Ok')
).click();
await waitForIonAlert();
await clickIonAlertButton('Ok');
await sendKeys(element(by.css('ion-alert input.alert-input')), p);
await takeScreenshot('import-wallet-with-encryption-input-confirm');
// TODO: language: 'Ok' -> 'Confirm'
await element(
by.cssContainingText('ion-alert .alert-button', 'Ok')
).click();
});
it('without encryption', async () => {
await sendKeys(
@@ -71,15 +62,12 @@ describe('Onboarding: Import Wallet', () => {
);
await element(by.css('ion-footer')).click();
await waitForIonAlert();
await element(
by.cssContainingText('ion-alert .alert-button', 'No')
).click();
await waitForIonAlert();
await clickIonAlertButton('No');
await element(
by.cssContainingText('ion-alert .alert-button', "I'm sure")
).click();
await holdMyProtractorIAmGoingIn(async () => {
await browser.wait(EC.presenceOf($('page-home')), 5000);
await waitForIonicPage('home');
// Since waitForAngular is disabled, give it a moment to render
browser.sleep(1000);
await expectPage('home');
@@ -1,15 +1,20 @@
import { browser, by, element } from 'protractor';
import { clearStorage, expectPage, ionicPageIs } from '../../utils';
import {
clearStorage,
disableCSSAnimations,
expectPage,
ionicPageIs
} from '../../utils';

describe('Onboarding: Landing', () => {
beforeEach(async () => {
await browser.get('');
await disableCSSAnimations();
});
afterEach(clearStorage);

it('Should display the logo on the landing page', async () => {
it('Should render the landing page', async () => {
await expectPage('onboarding');
expect(await element(by.css('.logo-tagline')).isDisplayed()).toEqual(true);
});

it('On restart, should return to the landing page if wallet has not been created', async () => {
@@ -3,6 +3,7 @@ import { testWallets } from '../fixtures/test-wallets';
import {
clearAndLoadStorage,
clearStorage,
disableCSSAnimations,
expectPage,
holdMyProtractorIAmGoingIn,
ionicPageIs,
@@ -11,11 +12,12 @@ import {
waitForIonicPage
} from '../utils';

describe('Onboarding: Landing', () => {
describe('Scan', () => {
afterEach(clearStorage);

it('Should not hide the QR Scanner (rendered behind the app)', async () => {
await clearAndLoadStorage(testWallets);
await disableCSSAnimations();
await holdMyProtractorIAmGoingIn(async () => {
await waitForIonicPage('home');
let scanTab = '#tab-t0-2';
@@ -64,7 +64,7 @@ ${log ? `console.log("${log}")` : ''}
* animations to complete. It also ensures we get screenshots between
* animations, making them easier to compare.
*/
export function disableAnimations() {
export function disableCSSAnimations() {
return browser.executeScript(
injector(
'e2eAnimationControl',
@@ -75,7 +75,7 @@ export function disableAnimations() {
)
);
}
export function enableAnimations() {
export function enableCSSAnimations() {
return browser.executeScript(
injector(
'e2eAnimationControl',

0 comments on commit 55b099b

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.