1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 09:23:13 +01:00

Use environment to configure timeouts

Apparently node doesn’t accept destructuring yet…
This commit is contained in:
Brett Sun 2016-02-04 11:59:25 +01:00
parent fd6371e2f1
commit f09201d8c3
9 changed files with 113 additions and 83 deletions

View File

@ -1,22 +1,35 @@
'use strict'; 'use strict';
const mainUser = { const MAIN_USER = {
email: 'dimi@mailinator.com', email: 'dimi@mailinator.com',
password: '0000000000' password: '0000000000'
}; };
const mainPieceId = '12374'; const MAIN_PIECE_ID = '12374';
const mainEditionId = '14gw9x3VA9oJaxp4cHaAuK2bvJzvEj4Xvc'; const MAIN_EDITION_ID = '14gw9x3VA9oJaxp4cHaAuK2bvJzvEj4Xvc';
const TIMEOUTS = {
SHORT: 3000,
NORMAL: 5000,
LONG: 10000,
SUPER_DUPER_EXTRA_LONG: 30000
};
console.log('================== Test environment ==================\n'); console.log('================== Test environment ==================\n');
console.log('Main user:'); console.log('Main user:');
console.log(` Email: ${mainUser.email}`); console.log(` Email: ${MAIN_USER.email}`);
console.log(` Password: ${mainUser.password}\n`); console.log(` Password: ${MAIN_USER.password}\n`);
console.log(`Main piece: ${mainPieceId}`); console.log(`Main piece: ${MAIN_PIECE_ID}`);
console.log(`Main edition: ${mainEditionId}\n`); console.log(`Main edition: ${MAIN_EDITION_ID}\n`);
console.log('Timeouts:');
console.log(` Short: ${TIMEOUTS.SHORT}`);
console.log(` Normal: ${TIMEOUTS.NORMAL}\n`);
console.log(` Long: ${TIMEOUTS.LONG}\n`);
console.log(` Super super extra long: ${TIMEOUTS.SUPER_DUPER_EXTRA_LONG}\n`);
console.log('========================================================\n'); console.log('========================================================\n');
module.exports = { module.exports = {
mainUser, MAIN_USER,
mainPieceId, MAIN_PIECE_ID,
mainEditionId MAIN_EDITION_ID,
TIMEOUTS
}; };

View File

@ -2,6 +2,8 @@
const gemini = require('gemini'); const gemini = require('gemini');
const environment = require('../environment'); const environment = require('../environment');
const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS;
/** /**
* Suite of tests against routes that require the user to be authenticated. * Suite of tests against routes that require the user to be authenticated.
@ -15,7 +17,7 @@ gemini.suite('Authenticated', (suite) => {
// also defines a `.before()` // also defines a `.before()`
// FIXME: use a more generic class for this, like just '.app', // FIXME: use a more generic class for this, like just '.app',
// when we can use this file with the whitelabels // when we can use this file with the whitelabels
actions.waitForElementToShow('.ascribe-default-app', 5000); actions.waitForElementToShow('.ascribe-default-app', TIMEOUTS.NORMAL);
}); });
// Suite just to log us in before any other suites run // Suite just to log us in before any other suites run
@ -24,13 +26,13 @@ gemini.suite('Authenticated', (suite) => {
.setUrl('/login') .setUrl('/login')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.capture('logged in', (actions, find) => { .capture('logged in', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
actions.sendKeys(find('.ascribe-login-wrapper input[name=email]'), environment.mainUser.email); actions.sendKeys(find('.ascribe-login-wrapper input[name=email]'), MAIN_USER.email);
actions.sendKeys(find('.ascribe-login-wrapper input[name=password]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-login-wrapper input[name=password]'), MAIN_USER.password);
actions.click(find('.ascribe-login-wrapper button[type=submit]')); actions.click(find('.ascribe-login-wrapper button[type=submit]'));
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', 5000); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}); });
}); });
@ -41,7 +43,7 @@ gemini.suite('Authenticated', (suite) => {
.ignoreElements('.client--cyland img.img-brand') .ignoreElements('.client--cyland img.img-brand')
.skip(/Mobile/) .skip(/Mobile/)
.before((actions, find) => { .before((actions, find) => {
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', 5000); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}) })
.capture('desktop header'); .capture('desktop header');
@ -70,7 +72,7 @@ gemini.suite('Authenticated', (suite) => {
.ignoreElements('.client--cyland img.img-brand') .ignoreElements('.client--cyland img.img-brand')
.skip(/Desktop/) .skip(/Desktop/)
.before((actions, find) => { .before((actions, find) => {
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', 5000); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}) })
.capture('mobile header') .capture('mobile header')
.capture('expanded mobile header', (actions, find) => { .capture('expanded mobile header', (actions, find) => {
@ -90,18 +92,18 @@ gemini.suite('Authenticated', (suite) => {
collectionSuite collectionSuite
.setCaptureElements('.ascribe-accordion-list') .setCaptureElements('.ascribe-accordion-list')
.before((actions, find) => { .before((actions, find) => {
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', 5000); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
// Wait for the images to load // Wait for the images to load
// FIXME: unfortuntately gemini doesn't support ignoring multiple elements from a single selector // FIXME: unfortuntately gemini doesn't support ignoring multiple elements from a single selector
// so we're forced to wait and hope that the images will all finish loading after 5s. // so we're forced to wait and hope that the images will all finish loading after 5s.
// We could also change the thumbnails with JS, but setting up a test user is probably easier. // We could also change the thumbnails with JS, but setting up a test user is probably easier.
actions.wait(5000); actions.wait(TIMEOUTS.NORMAL);
}) })
.capture('collection') .capture('collection')
.capture('expanded edition in collection', (actions, find) => { .capture('expanded edition in collection', (actions, find) => {
actions.click(find('.ascribe-accordion-list-item .ascribe-accordion-list-item-edition-widget')); actions.click(find('.ascribe-accordion-list-item .ascribe-accordion-list-item-edition-widget'));
// Wait for editions to load // Wait for editions to load
actions.waitForElementToShow('.ascribe-accordion-list-item-table', 10000); actions.waitForElementToShow('.ascribe-accordion-list-item-table', TIMEOUTS.LONG);
}) })
gemini.suite('Collection placeholder', (collectionPlaceholderSuite) => { gemini.suite('Collection placeholder', (collectionPlaceholderSuite) => {
@ -109,7 +111,7 @@ gemini.suite('Authenticated', (suite) => {
.setCaptureElements('.ascribe-accordion-list-placeholder') .setCaptureElements('.ascribe-accordion-list-placeholder')
.capture('collection empty search', (actions, find) => { .capture('collection empty search', (actions, find) => {
actions.sendKeys(find('.ascribe-piece-list-toolbar .search-bar input[type="text"]'), 'no search result'); actions.sendKeys(find('.ascribe-piece-list-toolbar .search-bar input[type="text"]'), 'no search result');
actions.waitForElementToShow('.ascribe-accordion-list-placeholder', 5000); actions.waitForElementToShow('.ascribe-accordion-list-placeholder', TIMEOUTS.NORMAL);
}); });
}); });
@ -119,7 +121,7 @@ gemini.suite('Authenticated', (suite) => {
.capture('items selected', (actions, find) => { .capture('items selected', (actions, find) => {
actions.click(find('.ascribe-accordion-list-item .ascribe-accordion-list-item-edition-widget')); actions.click(find('.ascribe-accordion-list-item .ascribe-accordion-list-item-edition-widget'));
// Wait for editions to load // Wait for editions to load
actions.waitForElementToShow('.ascribe-accordion-list-item-table', 5000); actions.waitForElementToShow('.ascribe-accordion-list-item-table', TIMEOUTS.NORMAL);
actions.click('.ascribe-table thead tr input[type="checkbox"]'); actions.click('.ascribe-table thead tr input[type="checkbox"]');
actions.waitForElementToShow('.piece-list-bulk-modal'); actions.waitForElementToShow('.piece-list-bulk-modal');
@ -133,7 +135,7 @@ gemini.suite('Authenticated', (suite) => {
.capture('piece list toolbar') .capture('piece list toolbar')
.capture('piece list toolbar search filled', (actions, find) => { .capture('piece list toolbar search filled', (actions, find) => {
actions.sendKeys(find('.ascribe-piece-list-toolbar .search-bar input[type="text"]'), 'search text'); actions.sendKeys(find('.ascribe-piece-list-toolbar .search-bar input[type="text"]'), 'search text');
actions.waitForElementToShow('.ascribe-piece-list-toolbar .search-bar .icon-ascribe-search', 5000); actions.waitForElementToShow('.ascribe-piece-list-toolbar .search-bar .icon-ascribe-search', TIMEOUTS.NORMAL);
}) })
gemini.suite('Order widget dropdown', (pieceListToolbarOrderWidgetSuite) => { gemini.suite('Order widget dropdown', (pieceListToolbarOrderWidgetSuite) => {
@ -144,7 +146,7 @@ gemini.suite('Authenticated', (suite) => {
actions.click(find('#ascribe-piece-list-toolbar-order-widget-dropdown')); actions.click(find('#ascribe-piece-list-toolbar-order-widget-dropdown'));
// Wait as the dropdown screenshot still includes the collection in the background // Wait as the dropdown screenshot still includes the collection in the background
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', 5000); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}); });
}); });
@ -156,7 +158,7 @@ gemini.suite('Authenticated', (suite) => {
actions.click(find('#ascribe-piece-list-toolbar-filter-widget-dropdown')); actions.click(find('#ascribe-piece-list-toolbar-filter-widget-dropdown'));
// Wait as the dropdown screenshot still includes the collection in the background // Wait as the dropdown screenshot still includes the collection in the background
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', 5000); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}); });
}); });
}); });
@ -167,7 +169,7 @@ gemini.suite('Authenticated', (suite) => {
.capture('register work', (actions, find) => { .capture('register work', (actions, find) => {
// The uploader options are only rendered after the user is fetched, so // The uploader options are only rendered after the user is fetched, so
// we have to wait for it here // we have to wait for it here
actions.waitForElementToShow('.file-drag-and-drop-dialog .present-options', 5000); actions.waitForElementToShow('.file-drag-and-drop-dialog .present-options', TIMEOUTS.NORMAL);
}) })
.capture('register work filled', (actions, find) => { .capture('register work filled', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name="artist_name"]'), 'artist name'); actions.sendKeys(find('.ascribe-form input[name="artist_name"]'), 'artist name');
@ -199,7 +201,7 @@ gemini.suite('Authenticated', (suite) => {
.before((actions, find) => { .before((actions, find) => {
// This will be called before every nested suite begins unless that suite // This will be called before every nested suite begins unless that suite
// also defines a `.before()` // also defines a `.before()`
actions.waitForElementToShow('.settings-container', 5000); actions.waitForElementToShow('.settings-container', TIMEOUTS.NORMAL);
}) })
.capture('user settings'); .capture('user settings');
}); });
@ -210,7 +212,7 @@ gemini.suite('Authenticated', (suite) => {
.setUrl('/logout') .setUrl('/logout')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.capture('logout', (actions, find) => { .capture('logout', (actions, find) => {
actions.waitForElementToShow('.ascribe-login-wrapper', 10000); actions.waitForElementToShow('.ascribe-login-wrapper', TIMEOUTS.LONG);
}); });
}); });
}); });

View File

@ -2,6 +2,8 @@
const gemini = require('gemini'); const gemini = require('gemini');
const environment = require('../environment'); const environment = require('../environment');
const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS;
/** /**
* Basic suite of tests against routes that do not require the user to be authenticated. * Basic suite of tests against routes that do not require the user to be authenticated.
@ -14,7 +16,7 @@ gemini.suite('Basic', (suite) => {
// This will be called before every nested suite begins unless that suite // This will be called before every nested suite begins unless that suite
// also defines a `.before()` // also defines a `.before()`
// FIXME: use a more generic class for this, like just '.ascribe-app' // FIXME: use a more generic class for this, like just '.ascribe-app'
actions.waitForElementToShow('.ascribe-default-app', 5000); actions.waitForElementToShow('.ascribe-default-app', TIMEOUTS.NORMAL);
}); });
gemini.suite('Header-desktop', (headerSuite) => { gemini.suite('Header-desktop', (headerSuite) => {
@ -22,7 +24,7 @@ gemini.suite('Basic', (suite) => {
.setCaptureElements('nav.navbar .container') .setCaptureElements('nav.navbar .container')
.skip(/Mobile/) .skip(/Mobile/)
.capture('desktop header', (actions, find) => { .capture('desktop header', (actions, find) => {
actions.waitForElementToShow('nav.navbar .container', 5000); actions.waitForElementToShow('nav.navbar .container', TIMEOUTS.NORMAL);
}) })
.capture('hover on active item', (actions, find) => { .capture('hover on active item', (actions, find) => {
const activeItem = find('nav.navbar li.active'); const activeItem = find('nav.navbar li.active');
@ -40,7 +42,7 @@ gemini.suite('Basic', (suite) => {
.setCaptureElements('nav.navbar .container') .setCaptureElements('nav.navbar .container')
.skip(/Desktop/) .skip(/Desktop/)
.capture('mobile header', (actions, find) => { .capture('mobile header', (actions, find) => {
actions.waitForElementToShow('nav.navbar .container', 5000); actions.waitForElementToShow('nav.navbar .container', TIMEOUTS.NORMAL);
}) })
.capture('expanded mobile header', (actions, find) => { .capture('expanded mobile header', (actions, find) => {
actions.click(find('nav.navbar .navbar-toggle')); actions.click(find('nav.navbar .navbar-toggle'));
@ -56,7 +58,7 @@ gemini.suite('Basic', (suite) => {
footerSuite footerSuite
.setCaptureElements('.ascribe-footer') .setCaptureElements('.ascribe-footer')
.capture('footer', (actions, find) => { .capture('footer', (actions, find) => {
actions.waitForElementToShow('.ascribe-footer', 5000); actions.waitForElementToShow('.ascribe-footer', TIMEOUTS.NORMAL);
}) })
.capture('hover on footer item', (actions, find) => { .capture('hover on footer item', (actions, find) => {
const footerItem = find('.ascribe-footer a:not(.social)'); const footerItem = find('.ascribe-footer a:not(.social)');
@ -71,7 +73,7 @@ gemini.suite('Basic', (suite) => {
gemini.suite('Login', (loginSuite) => { gemini.suite('Login', (loginSuite) => {
loginSuite loginSuite
.capture('login', (actions, find) => { .capture('login', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
}) })
.capture('hover on login submit', (actions, find) => { .capture('hover on login submit', (actions, find) => {
actions.mouseMove(find('.ascribe-form button[type=submit]')); actions.mouseMove(find('.ascribe-form button[type=submit]'));
@ -85,8 +87,8 @@ gemini.suite('Basic', (suite) => {
// Remove hover from sign up link // Remove hover from sign up link
actions.click(emailInput); actions.click(emailInput);
actions.sendKeys(emailInput, environment.mainUser.email); actions.sendKeys(emailInput, MAIN_USER.email);
actions.sendKeys(find('.ascribe-form input[name=password]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password]'), MAIN_USER.password);
}) })
.capture('login form filled', (actions, find) => { .capture('login form filled', (actions, find) => {
actions.click(find('.ascribe-form-header')); actions.click(find('.ascribe-form-header'));
@ -97,12 +99,12 @@ gemini.suite('Basic', (suite) => {
signUpSuite signUpSuite
.setUrl('/signup') .setUrl('/signup')
.capture('sign up', (actions, find) => { .capture('sign up', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
}) })
.capture('sign up form filled with focus', (actions, find) => { .capture('sign up form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name=email]'), environment.mainUser.email); actions.sendKeys(find('.ascribe-form input[name=email]'), MAIN_USER.email);
actions.sendKeys(find('.ascribe-form input[name=password]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password]'), MAIN_USER.password);
actions.sendKeys(find('.ascribe-form input[name=password_confirm]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password_confirm]'), MAIN_USER.password);
}) })
.capture('sign up form filled with check', (actions, find) => { .capture('sign up form filled with check', (actions, find) => {
actions.click(find('.ascribe-form input[type="checkbox"] ~ .checkbox')); actions.click(find('.ascribe-form input[type="checkbox"] ~ .checkbox'));
@ -113,10 +115,10 @@ gemini.suite('Basic', (suite) => {
passwordResetSuite passwordResetSuite
.setUrl('/password_reset') .setUrl('/password_reset')
.capture('password reset', (actions, find) => { .capture('password reset', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
}) })
.capture('password reset form filled with focus', (actions, find) => { .capture('password reset form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name="email"]'), environment.mainUser.email); actions.sendKeys(find('.ascribe-form input[name="email"]'), MAIN_USER.email);
}) })
.capture('password reset form filled', (actions, find) => { .capture('password reset form filled', (actions, find) => {
actions.click(find('.ascribe-form-header')); actions.click(find('.ascribe-form-header'));
@ -127,7 +129,7 @@ gemini.suite('Basic', (suite) => {
coaVerifySuite coaVerifySuite
.setUrl('/coa_verify') .setUrl('/coa_verify')
.capture('coa verify', (actions, find) => { .capture('coa verify', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
}) })
.capture('coa verify form filled with focus', (actions, find) => { .capture('coa verify form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name="message"]'), 'sample text'); actions.sendKeys(find('.ascribe-form input[name="message"]'), 'sample text');

View File

@ -2,8 +2,11 @@
const gemini = require('gemini'); const gemini = require('gemini');
const environment = require('../environment'); const environment = require('../environment');
const pieceUrl = `/pieces/${environment.mainPieceId}`; const MAIN_USER = environment.MAIN_USER;
const editionUrl = `/editions/${environment.mainEditionId}`; const TIMEOUTS = environment.TIMEOUTS;
const pieceUrl = `/pieces/${environment.MAIN_PIECE_ID}`;
const editionUrl = `/editions/${environment.MAIN_EDITION_ID}`;
/** /**
* Suite of tests against the piece and edition routes. * Suite of tests against the piece and edition routes.
@ -18,12 +21,12 @@ gemini.suite('Work detail', (suite) => {
// also defines a `.before()` // also defines a `.before()`
// FIXME: use a more generic class for this, like just '.app', // FIXME: use a more generic class for this, like just '.app',
// when we can use this file with the whitelabels // when we can use this file with the whitelabels
actions.waitForElementToShow('.ascribe-default-app', 5000); actions.waitForElementToShow('.ascribe-default-app', TIMEOUTS.NORMAL);
// Wait for the social media buttons to appear // Wait for the social media buttons to appear
actions.waitForElementToShow('.ascribe-social-button-list .fb-share-button iframe', 20000); actions.waitForElementToShow('.ascribe-social-button-list .fb-share-button iframe', TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
actions.waitForElementToShow('.ascribe-social-button-list .twitter-share-button', 20000); actions.waitForElementToShow('.ascribe-social-button-list .twitter-share-button', TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
actions.waitForElementToShow('.ascribe-media-player', 10000); actions.waitForElementToShow('.ascribe-media-player', TIMEOUTS.LONG);
}); });
gemini.suite('Basic piece', (basicPieceSuite) => { gemini.suite('Basic piece', (basicPieceSuite) => {
@ -36,7 +39,7 @@ gemini.suite('Work detail', (suite) => {
setCaptureElements('.shmui-wrap') setCaptureElements('.shmui-wrap')
.capture('shmui', (actions, find) => { .capture('shmui', (actions, find) => {
actions.click(find('.ascribe-media-player')); actions.click(find('.ascribe-media-player'));
actions.waitForElementToShow('.shmui-wrap:not(.loading)', 30000); actions.waitForElementToShow('.shmui-wrap:not(.loading)', TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
// Wait for the transition to end // Wait for the transition to end
actions.wait(1000); actions.wait(1000);
}); });
@ -55,14 +58,14 @@ gemini.suite('Work detail', (suite) => {
.setUrl('/login') .setUrl('/login')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.before((actions, find) => { .before((actions, find) => {
actions.waitForElementToShow('.ascribe-default-app', 5000); actions.waitForElementToShow('.ascribe-default-app', TIMEOUTS.NORMAL);
}) })
.capture('logged in', (actions, find) => { .capture('logged in', (actions, find) => {
actions.sendKeys(find('.ascribe-login-wrapper input[name=email]'), environment.mainUser.email); actions.sendKeys(find('.ascribe-login-wrapper input[name=email]'), MAIN_USER.email);
actions.sendKeys(find('.ascribe-login-wrapper input[name=password]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-login-wrapper input[name=password]'), MAIN_USER.password);
actions.click(find('.ascribe-login-wrapper button[type=submit]')); actions.click(find('.ascribe-login-wrapper button[type=submit]'));
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', 5000); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}); });
}); });
@ -122,10 +125,10 @@ gemini.suite('Work detail', (suite) => {
.setUrl('/logout') .setUrl('/logout')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.before((actions, find) => { .before((actions, find) => {
actions.waitForElementToShow('.ascribe-default-app', 5000); actions.waitForElementToShow('.ascribe-default-app', TIMEOUTS.NORMAL);
}) })
.capture('logout', (actions, find) => { .capture('logout', (actions, find) => {
actions.waitForElementToShow('.ascribe-login-wrapper', 10000); actions.waitForElementToShow('.ascribe-login-wrapper', TIMEOUTS.LONG);
}); });
}); });
}); });

View File

@ -1,6 +1,8 @@
'use strict'; 'use strict';
const gemini = require('gemini'); const gemini = require('gemini');
const environment = require('../../environment');
const TIMEOUTS = environment.TIMEOUTS;
/** /**
* Suite of tests against 23vivi specific routes * Suite of tests against 23vivi specific routes
@ -11,7 +13,7 @@ gemini.suite('23vivi', (suite) => {
.setCaptureElements('.ascribe-wallet-app') .setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => { .before((actions, find) => {
// This will be called before every nested suite begins // This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-wallet-app', 5000); actions.waitForElementToShow('.ascribe-wallet-app', TIMEOUTS.NORMAL);
}); });
gemini.suite('Landing', (landingSuite) => { gemini.suite('Landing', (landingSuite) => {
@ -19,7 +21,7 @@ gemini.suite('23vivi', (suite) => {
.setUrl('/') .setUrl('/')
.capture('landing', (actions, find) => { .capture('landing', (actions, find) => {
// Wait for the logo to appear // Wait for the logo to appear
actions.waitForElementToShow('.vivi23-landing--header-logo', 10000); actions.waitForElementToShow('.vivi23-landing--header-logo', TIMEOUTS.LONG);
}); });
}); });

View File

@ -1,6 +1,8 @@
'use strict'; 'use strict';
const gemini = require('gemini'); const gemini = require('gemini');
const environment = require('../../environment');
const TIMEOUTS = environment.TIMEOUTS;
/** /**
* Suite of tests against Cyland specific routes * Suite of tests against Cyland specific routes
@ -11,7 +13,7 @@ gemini.suite('Cyland', (suite) => {
.setCaptureElements('.ascribe-wallet-app') .setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => { .before((actions, find) => {
// This will be called before every nested suite begins // This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-wallet-app', 5000); actions.waitForElementToShow('.ascribe-wallet-app', TIMEOUTS.NORMAL);
}); });
gemini.suite('Landing', (landingSuite) => { gemini.suite('Landing', (landingSuite) => {
@ -20,7 +22,7 @@ gemini.suite('Cyland', (suite) => {
// Ignore Cyland's logo as it's a gif // Ignore Cyland's logo as it's a gif
.ignoreElements('.cyland-landing img') .ignoreElements('.cyland-landing img')
.capture('landing', (actions, find) => { .capture('landing', (actions, find) => {
actions.waitForElementToShow('.cyland-landing img', 10000); actions.waitForElementToShow('.cyland-landing img', TIMEOUTS.LONG);
}); });
}); });

View File

@ -2,6 +2,8 @@
const gemini = require('gemini'); const gemini = require('gemini');
const environment = require('../../environment'); const environment = require('../../environment');
const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS;
/** /**
* Suite of tests against Cyland specific routes * Suite of tests against Cyland specific routes
@ -12,7 +14,7 @@ gemini.suite('Ikonotv', (suite) => {
.setCaptureElements('.ascribe-wallet-app') .setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => { .before((actions, find) => {
// This will be called before every nested suite begins // This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-wallet-app', 5000); actions.waitForElementToShow('.ascribe-wallet-app', TIMEOUTS.NORMAL);
}); });
gemini.suite('Landing', (landingSuite) => { gemini.suite('Landing', (landingSuite) => {
@ -30,7 +32,7 @@ gemini.suite('Ikonotv', (suite) => {
}); });
// Wait for logo to appear // Wait for logo to appear
actions.waitForElementToShow('.ikonotv-landing header img', 10000); actions.waitForElementToShow('.ikonotv-landing header img', TIMEOUTS.LONG);
}); });
}); });
@ -44,13 +46,13 @@ gemini.suite('Ikonotv', (suite) => {
// also defines a `.before()` // also defines a `.before()`
// FIXME: use a more generic class for this, like just '.app', // FIXME: use a more generic class for this, like just '.app',
// when we can use this file with the whitelabels // when we can use this file with the whitelabels
actions.waitForElementToShow('.ascribe-wallet-app', 5000); actions.waitForElementToShow('.ascribe-wallet-app', TIMEOUTS.NORMAL);
// Wait for the forms to appear // Wait for the forms to appear
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
// Just use a dumb wait because the logo is set as a background image // Just use a dumb wait because the logo is set as a background image
actions.wait(3000); actions.wait(TIMEOUTS.SHORT);
}); });
gemini.suite('Login', (loginSuite) => { gemini.suite('Login', (loginSuite) => {
@ -69,8 +71,8 @@ gemini.suite('Ikonotv', (suite) => {
// Remove hover from sign up link // Remove hover from sign up link
actions.click(emailInput); actions.click(emailInput);
actions.sendKeys(emailInput, environment.mainUser.email); actions.sendKeys(emailInput, MAIN_USER.email);
actions.sendKeys(find('.ascribe-form input[name=password]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password]'), MAIN_USER.password);
}) })
.capture('login form filled', (actions, find) => { .capture('login form filled', (actions, find) => {
actions.click(find('.ascribe-form-header')); actions.click(find('.ascribe-form-header'));
@ -82,9 +84,9 @@ gemini.suite('Ikonotv', (suite) => {
.setUrl('/signup') .setUrl('/signup')
.capture('sign up') .capture('sign up')
.capture('sign up form filled with focus', (actions, find) => { .capture('sign up form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name=email]'), environment.mainUser.email); actions.sendKeys(find('.ascribe-form input[name=email]'), MAIN_USER.email);
actions.sendKeys(find('.ascribe-form input[name=password]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password]'), MAIN_USER.password);
actions.sendKeys(find('.ascribe-form input[name=password_confirm]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password_confirm]'), MAIN_USER.password);
}) })
.capture('sign up form filled with check', (actions, find) => { .capture('sign up form filled with check', (actions, find) => {
actions.click(find('.ascribe-form input[type="checkbox"] ~ .checkbox')); actions.click(find('.ascribe-form input[type="checkbox"] ~ .checkbox'));

View File

@ -1,6 +1,8 @@
'use strict'; 'use strict';
const gemini = require('gemini'); const gemini = require('gemini');
const environment = require('../../environment');
const TIMEOUTS = environment.TIMEOUTS;
/** /**
* Suite of tests against lumenus specific routes * Suite of tests against lumenus specific routes
@ -11,7 +13,7 @@ gemini.suite('Lumenus', (suite) => {
.setCaptureElements('.ascribe-wallet-app') .setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => { .before((actions, find) => {
// This will be called before every nested suite begins // This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-wallet-app', 5000); actions.waitForElementToShow('.ascribe-wallet-app', TIMEOUTS.NORMAL);
}); });
gemini.suite('Landing', (landingSuite) => { gemini.suite('Landing', (landingSuite) => {
@ -19,7 +21,7 @@ gemini.suite('Lumenus', (suite) => {
.setUrl('/') .setUrl('/')
.capture('landing', (actions, find) => { .capture('landing', (actions, find) => {
// Wait for the logo to appear // Wait for the logo to appear
actions.waitForElementToShow('.wp-landing-wrapper img', 10000); actions.waitForElementToShow('.wp-landing-wrapper img', TIMEOUTS.LONG);
}); });
}); });

View File

@ -2,6 +2,8 @@
const gemini = require('gemini'); const gemini = require('gemini');
const environment = require('../../environment'); const environment = require('../../environment');
const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS;
/** /**
* Basic suite of tests against whitelabel routes that do not require authentication. * Basic suite of tests against whitelabel routes that do not require authentication.
@ -13,7 +15,7 @@ gemini.suite('Whitelabel basic', (suite) => {
// This will be called before every nested suite begins unless that suite // This will be called before every nested suite begins unless that suite
// also defines a `.before()` // also defines a `.before()`
// FIXME: use a more generic class for this, like just '.ascribe-app' // FIXME: use a more generic class for this, like just '.ascribe-app'
actions.waitForElementToShow('.ascribe-wallet-app', 5000); actions.waitForElementToShow('.ascribe-wallet-app', TIMEOUTS.NORMAL);
// Use a dumb wait in case we're still waiting for other assets, like fonts, to load // Use a dumb wait in case we're still waiting for other assets, like fonts, to load
actions.wait(1000); actions.wait(1000);
@ -25,12 +27,12 @@ gemini.suite('Whitelabel basic', (suite) => {
// See Ikono // See Ikono
.skip(/Ikono/) .skip(/Ikono/)
.capture('login', (actions, find) => { .capture('login', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
// For some reason, the screenshots seem to keep catching the whitelabel login form // For some reason, the screenshots seem to keep catching the whitelabel login form
// on a refresh and without fonts loaded (maybe because they're the first tests run // on a refresh and without fonts loaded (maybe because they're the first tests run
// and the cache isn't hot yet?). // and the cache isn't hot yet?).
// Let's wait a bit and hope they load. // Let's wait a bit and hope they load.
actions.wait(3000); actions.wait(TIMEOUTS.SHORT);
}) })
.capture('hover on login submit', (actions, find) => { .capture('hover on login submit', (actions, find) => {
actions.mouseMove(find('.ascribe-form button[type=submit]')); actions.mouseMove(find('.ascribe-form button[type=submit]'));
@ -44,8 +46,8 @@ gemini.suite('Whitelabel basic', (suite) => {
// Remove hover from sign up link // Remove hover from sign up link
actions.click(emailInput); actions.click(emailInput);
actions.sendKeys(emailInput, environment.mainUser.email); actions.sendKeys(emailInput, MAIN_USER.email);
actions.sendKeys(find('.ascribe-form input[name=password]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password]'), MAIN_USER.password);
}) })
.capture('login form filled', (actions, find) => { .capture('login form filled', (actions, find) => {
actions.click(find('.ascribe-form-header')); actions.click(find('.ascribe-form-header'));
@ -58,14 +60,14 @@ gemini.suite('Whitelabel basic', (suite) => {
// See Ikono // See Ikono
.skip(/Ikono/) .skip(/Ikono/)
.capture('sign up', (actions, find) => { .capture('sign up', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
// Wait in case the form reloads due to other assets loading // Wait in case the form reloads due to other assets loading
actions.wait(500); actions.wait(500);
}) })
.capture('sign up form filled with focus', (actions, find) => { .capture('sign up form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name=email]'), environment.mainUser.email); actions.sendKeys(find('.ascribe-form input[name=email]'), MAIN_USER.email);
actions.sendKeys(find('.ascribe-form input[name=password]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password]'), MAIN_USER.password);
actions.sendKeys(find('.ascribe-form input[name=password_confirm]'), environment.mainUser.password); actions.sendKeys(find('.ascribe-form input[name=password_confirm]'), MAIN_USER.password);
}) })
.capture('sign up form filled with check', (actions, find) => { .capture('sign up form filled with check', (actions, find) => {
actions.click(find('.ascribe-form input[type="checkbox"] ~ .checkbox')); actions.click(find('.ascribe-form input[type="checkbox"] ~ .checkbox'));
@ -76,12 +78,12 @@ gemini.suite('Whitelabel basic', (suite) => {
passwordResetSuite passwordResetSuite
.setUrl('/password_reset') .setUrl('/password_reset')
.capture('password reset', (actions, find) => { .capture('password reset', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
// Wait in case the form reloads due to other assets loading // Wait in case the form reloads due to other assets loading
actions.wait(500); actions.wait(500);
}) })
.capture('password reset form filled with focus', (actions, find) => { .capture('password reset form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name="email"]'), environment.mainUser.email); actions.sendKeys(find('.ascribe-form input[name="email"]'), MAIN_USER.email);
}) })
.capture('password reset form filled', (actions, find) => { .capture('password reset form filled', (actions, find) => {
actions.click(find('.ascribe-form-header')); actions.click(find('.ascribe-form-header'));
@ -92,7 +94,7 @@ gemini.suite('Whitelabel basic', (suite) => {
coaVerifySuite coaVerifySuite
.setUrl('/coa_verify') .setUrl('/coa_verify')
.capture('coa verify', (actions, find) => { .capture('coa verify', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
// Wait in case the form reloads due to other assets loading // Wait in case the form reloads due to other assets loading
actions.wait(500); actions.wait(500);
}) })