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

Fix ESLint errors on visual and integration test code

This commit is contained in:
Brett Sun 2016-06-02 16:42:20 +02:00
parent 42d35e7807
commit 92978269cc
17 changed files with 111 additions and 102 deletions

View File

@ -43,6 +43,7 @@
"babel-jest": "^5.2.0", "babel-jest": "^5.2.0",
"chai": "^3.4.1", "chai": "^3.4.1",
"chai-as-promised": "^5.1.0", "chai-as-promised": "^5.1.0",
"colors": "^1.1.2",
"dotenv": "^1.2.0", "dotenv": "^1.2.0",
"gemini": "^2.1.0", "gemini": "^2.1.0",
"jest-cli": "^0.4.0", "jest-cli": "^0.4.0",

View File

@ -1,36 +0,0 @@
{
"parser": "babel-eslint",
"env": {
"mocha": true,
"node": true
},
"rules": {
"new-cap": [2, {newIsCap: true, capIsNew: false}],
"quotes": [2, "single"],
"eol-last": [0],
"no-mixed-requires": [0],
"no-underscore-dangle": [0],
"global-strict": [2, "always"],
"no-trailing-spaces": [2, { skipBlankLines: true }],
"no-console": 0,
"camelcase": [2, {"properties": "never"}],
},
"globals": {},
"plugins": [],
"ecmaFeatures": {
"modules": 1,
"arrowFunctions",
"classes": 1,
"blockBindings": 1,
"defaultParams": 1,
"destructuring": 1,
"objectLiteralComputedProperties": 1,
"objectLiteralDuplicateProperties": 0,
"objectLiteralShorthandMethods": 1,
"objectLiteralShorthandProperties": 1,
"restParams": 1,
"spread": 1,
"superInFunctions": 1,
"templateStrings": 1
}
}

13
test/.eslintrc.json Normal file
View File

@ -0,0 +1,13 @@
{
"env": {
"node": true
},
"rules": {
"func-names": [0],
"no-console": [0],
"no-process-exit": [0],
"strict": [0],
"import/newline-after-import": [0],
"import/no-extraneous-dependencies": [2, { "devDependencies": true, "optionalDependencies": false }]
}
}

View File

@ -0,0 +1,5 @@
{
"rules": {
"max-len": [2, { "code": 125 }]
}
}

View File

@ -1,3 +1,4 @@
/* eslint-disable strict, no-console */
'use strict'; 'use strict';
const MAIN_USER = { const MAIN_USER = {

View File

@ -12,7 +12,7 @@ gemini.suite('Authenticated', (suite) => {
suite suite
.setUrl('/collection') .setUrl('/collection')
.setCaptureElements('.ascribe-body') .setCaptureElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
// 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('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
@ -40,7 +40,7 @@ gemini.suite('Authenticated', (suite) => {
// Ignore Cyland's logo as it's a gif // Ignore Cyland's logo as it's a gif
.ignoreElements('.client--cyland img.img-brand') .ignoreElements('.client--cyland img.img-brand')
.skip(/Mobile/) .skip(/Mobile/)
.before((actions, find) => { .before((actions) => {
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}) })
.capture('desktop header'); .capture('desktop header');
@ -69,7 +69,7 @@ gemini.suite('Authenticated', (suite) => {
// Ignore Cyland's logo as it's a gif // Ignore Cyland's logo as it's a gif
.ignoreElements('.client--cyland img.img-brand') .ignoreElements('.client--cyland img.img-brand')
.skip(/Desktop/) .skip(/Desktop/)
.before((actions, find) => { .before((actions) => {
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}) })
.capture('mobile header') .capture('mobile header')
@ -89,7 +89,7 @@ gemini.suite('Authenticated', (suite) => {
gemini.suite('Collection', (collectionSuite) => { gemini.suite('Collection', (collectionSuite) => {
collectionSuite collectionSuite
.setCaptureElements('.ascribe-accordion-list') .setCaptureElements('.ascribe-accordion-list')
.before((actions, find) => { .before((actions) => {
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL); 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
@ -102,7 +102,7 @@ gemini.suite('Authenticated', (suite) => {
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', TIMEOUTS.LONG); actions.waitForElementToShow('.ascribe-accordion-list-item-table', TIMEOUTS.LONG);
}) });
gemini.suite('Collection placeholder', (collectionPlaceholderSuite) => { gemini.suite('Collection placeholder', (collectionPlaceholderSuite) => {
collectionPlaceholderSuite collectionPlaceholderSuite
@ -133,8 +133,9 @@ 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', TIMEOUTS.NORMAL); 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) => {
pieceListToolbarOrderWidgetSuite pieceListToolbarOrderWidgetSuite
@ -164,13 +165,14 @@ gemini.suite('Authenticated', (suite) => {
gemini.suite('Register work', (registerSuite) => { gemini.suite('Register work', (registerSuite) => {
registerSuite registerSuite
.setUrl('/register_piece') .setUrl('/register_piece')
.before((actions, find) => { .before((actions) => {
// The editions options are only rendered after the whitelabel is fetched, so // The editions options are only rendered after the whitelabel is fetched, so
// we have to wait for it here // we have to wait for it here
// We have to check for the sibling checkbox class as the input itself is hidden // We have to check for the sibling checkbox class as the input itself is hidden
actions.waitForElementToShow('.ascribe-form input[name="num_editions-checkbox"] ~ .checkbox', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-form input[name="num_editions-checkbox"] ~ .checkbox',
TIMEOUTS.NORMAL);
}) })
.capture('register work', (actions, find) => { .capture('register work', (actions) => {
// 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 also have to wait for it here // we also have to wait for it here
actions.waitForElementToShow('.file-drag-and-drop-dialog .present-options', TIMEOUTS.NORMAL); actions.waitForElementToShow('.file-drag-and-drop-dialog .present-options', TIMEOUTS.NORMAL);
@ -203,7 +205,7 @@ gemini.suite('Authenticated', (suite) => {
gemini.suite('User settings', (userSettingsSuite) => { gemini.suite('User settings', (userSettingsSuite) => {
userSettingsSuite userSettingsSuite
.setUrl('/settings') .setUrl('/settings')
.before((actions, find) => { .before((actions) => {
// 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', TIMEOUTS.NORMAL); actions.waitForElementToShow('.settings-container', TIMEOUTS.NORMAL);
@ -216,7 +218,7 @@ gemini.suite('Authenticated', (suite) => {
logoutSuite logoutSuite
.setUrl('/logout') .setUrl('/logout')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.capture('logout', (actions, find) => { .capture('logout', (actions) => {
actions.waitForElementToShow('.ascribe-login-wrapper', TIMEOUTS.LONG); actions.waitForElementToShow('.ascribe-login-wrapper', TIMEOUTS.LONG);
}); });
}); });

View File

@ -12,7 +12,7 @@ gemini.suite('Basic', (suite) => {
suite suite
.setUrl('/login') .setUrl('/login')
.setCaptureElements('.ascribe-body') .setCaptureElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
// 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('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
@ -22,7 +22,7 @@ gemini.suite('Basic', (suite) => {
headerSuite headerSuite
.setCaptureElements('nav.navbar .container') .setCaptureElements('nav.navbar .container')
.skip(/Mobile/) .skip(/Mobile/)
.capture('desktop header', (actions, find) => { .capture('desktop header', (actions) => {
actions.waitForElementToShow('nav.navbar .container', TIMEOUTS.NORMAL); actions.waitForElementToShow('nav.navbar .container', TIMEOUTS.NORMAL);
}) })
.capture('hover on active item', (actions, find) => { .capture('hover on active item', (actions, find) => {
@ -40,7 +40,7 @@ gemini.suite('Basic', (suite) => {
headerMobileSuite headerMobileSuite
.setCaptureElements('nav.navbar .container') .setCaptureElements('nav.navbar .container')
.skip(/Desktop/) .skip(/Desktop/)
.capture('mobile header', (actions, find) => { .capture('mobile header', (actions) => {
actions.waitForElementToShow('nav.navbar .container', TIMEOUTS.NORMAL); actions.waitForElementToShow('nav.navbar .container', TIMEOUTS.NORMAL);
}) })
.capture('expanded mobile header', (actions, find) => { .capture('expanded mobile header', (actions, find) => {
@ -56,7 +56,7 @@ gemini.suite('Basic', (suite) => {
gemini.suite('Footer', (footerSuite) => { gemini.suite('Footer', (footerSuite) => {
footerSuite footerSuite
.setCaptureElements('.ascribe-footer') .setCaptureElements('.ascribe-footer')
.capture('footer', (actions, find) => { .capture('footer', (actions) => {
actions.waitForElementToShow('.ascribe-footer', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-footer', TIMEOUTS.NORMAL);
}) })
.capture('hover on footer item', (actions, find) => { .capture('hover on footer item', (actions, find) => {
@ -64,14 +64,14 @@ gemini.suite('Basic', (suite) => {
actions.mouseMove(footerItem); actions.mouseMove(footerItem);
}) })
.capture('hover on footer social item', (actions, find) => { .capture('hover on footer social item', (actions, find) => {
const footerSocialItem = find('.ascribe-footer a.social') const footerSocialItem = find('.ascribe-footer a.social');
actions.mouseMove(footerSocialItem); actions.mouseMove(footerSocialItem);
}); });
}); });
gemini.suite('Login', (loginSuite) => { gemini.suite('Login', (loginSuite) => {
loginSuite loginSuite
.capture('login', (actions, find) => { .capture('login', (actions) => {
actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
}) })
.capture('hover on login submit', (actions, find) => { .capture('hover on login submit', (actions, find) => {
@ -97,7 +97,7 @@ gemini.suite('Basic', (suite) => {
gemini.suite('Sign up', (signUpSuite) => { gemini.suite('Sign up', (signUpSuite) => {
signUpSuite signUpSuite
.setUrl('/signup') .setUrl('/signup')
.capture('sign up', (actions, find) => { .capture('sign up', (actions) => {
actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
}) })
.capture('sign up form filled with focus', (actions, find) => { .capture('sign up form filled with focus', (actions, find) => {
@ -113,7 +113,7 @@ gemini.suite('Basic', (suite) => {
gemini.suite('Password reset', (passwordResetSuite) => { gemini.suite('Password reset', (passwordResetSuite) => {
passwordResetSuite passwordResetSuite
.setUrl('/password_reset') .setUrl('/password_reset')
.capture('password reset', (actions, find) => { .capture('password reset', (actions) => {
actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL);
}) })
.capture('password reset form filled with focus', (actions, find) => { .capture('password reset form filled with focus', (actions, find) => {
@ -127,12 +127,13 @@ gemini.suite('Basic', (suite) => {
gemini.suite('Coa verify', (coaVerifySuite) => { gemini.suite('Coa verify', (coaVerifySuite) => {
coaVerifySuite coaVerifySuite
.setUrl('/coa_verify') .setUrl('/coa_verify')
.capture('coa verify', (actions, find) => { .capture('coa verify', (actions) => {
actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL); 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');
actions.sendKeys(find('.ascribe-form .ascribe-property-wrapper:nth-of-type(2) textarea'), 'sample signature'); actions.sendKeys(find('.ascribe-form .ascribe-property-wrapper:nth-of-type(2) textarea'),
'sample signature');
}) })
.capture('coa verify form filled', (actions, find) => { .capture('coa verify form filled', (actions, find) => {
actions.click(find('.ascribe-login-header')); actions.click(find('.ascribe-login-header'));

View File

@ -16,21 +16,23 @@ const editionUrl = `/editions/${environment.MAIN_EDITION_ID}`;
gemini.suite('Work detail', (suite) => { gemini.suite('Work detail', (suite) => {
suite suite
.setCaptureElements('.ascribe-body') .setCaptureElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
// 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('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-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', TIMEOUTS.SUPER_DUPER_EXTRA_LONG); actions.waitForElementToShow('.ascribe-social-button-list .fb-share-button iframe',
actions.waitForElementToShow('.ascribe-social-button-list .twitter-share-button', TIMEOUTS.SUPER_DUPER_EXTRA_LONG); TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
actions.waitForElementToShow('.ascribe-social-button-list .twitter-share-button',
TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
actions.waitForElementToShow('.ascribe-media-player', TIMEOUTS.LONG); actions.waitForElementToShow('.ascribe-media-player', TIMEOUTS.LONG);
}); });
gemini.suite('Basic piece', (basicPieceSuite) => { gemini.suite('Basic piece', (basicPieceSuite) => {
basicPieceSuite basicPieceSuite
.setUrl(pieceUrl) .setUrl(pieceUrl)
.capture('basic piece') .capture('basic piece');
gemini.suite('Shmui', (shmuiSuite) => { gemini.suite('Shmui', (shmuiSuite) => {
shmuiSuite. shmuiSuite.
@ -55,7 +57,7 @@ gemini.suite('Work detail', (suite) => {
loginSuite loginSuite
.setUrl('/login') .setUrl('/login')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
}) })
.capture('logged in', (actions, find) => { .capture('logged in', (actions, find) => {
@ -76,7 +78,7 @@ gemini.suite('Work detail', (suite) => {
gemini.suite('Authorized edition', (authorizedEditionSuite) => { gemini.suite('Authorized edition', (authorizedEditionSuite) => {
authorizedEditionSuite authorizedEditionSuite
.setUrl(editionUrl) .setUrl(editionUrl)
.capture('authorized edition') .capture('authorized edition');
}); });
gemini.suite('Detail action buttons', (detailActionButtonSuite) => { gemini.suite('Detail action buttons', (detailActionButtonSuite) => {
@ -102,13 +104,19 @@ gemini.suite('Work detail', (suite) => {
.setCaptureElements('.modal-dialog') .setCaptureElements('.modal-dialog')
.capture('open email form', (actions, find) => { .capture('open email form', (actions, find) => {
// Add class names to make the action buttons easier to select // Add class names to make the action buttons easier to select
actions.executeJS(function (window) { // eslint-disable-next-line prefer-arrow-callback
var actionButtons = window.document.querySelectorAll('.ascribe-detail-property .ascribe-button-list button.btn-default'); actions.executeJS(function addButtonTypeAsClass(window) {
for (var ii = 0; ii < actionButtons.length; ++ii) { /* eslint-disable no-var, prefer-template */
var actionButtonsSelector = '.ascribe-detail-property .ascribe-button-list button.btn-default';
var actionButtons = window.document.querySelectorAll(actionButtonsSelector);
var ii = 0;
for (; ii < actionButtons.length; ++ii) {
if (actionButtons[ii].textContent) { if (actionButtons[ii].textContent) {
actionButtons[ii].className += ' ascribe-action-button-' + actionButtons[ii].textContent.toLowerCase(); actionButtons[ii].className += ' ascribe-action-button-' +
actionButtons[ii].textContent.toLowerCase();
} }
} }
/* eslint-enable no-var */
}); });
actions.click(find('.ascribe-detail-property .ascribe-button-list button.ascribe-action-button-email')); actions.click(find('.ascribe-detail-property .ascribe-button-list button.ascribe-action-button-email'));
@ -122,10 +130,10 @@ gemini.suite('Work detail', (suite) => {
logoutSuite logoutSuite
.setUrl('/logout') .setUrl('/logout')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
}) })
.capture('logout', (actions, find) => { .capture('logout', (actions) => {
actions.waitForElementToShow('.ascribe-login-wrapper', TIMEOUTS.LONG); actions.waitForElementToShow('.ascribe-login-wrapper', TIMEOUTS.LONG);
}); });
}); });

View File

@ -10,7 +10,7 @@ const TIMEOUTS = environment.TIMEOUTS;
gemini.suite('23vivi', (suite) => { gemini.suite('23vivi', (suite) => {
suite suite
.setCaptureElements('.ascribe-body') .setCaptureElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
// This will be called before every nested suite begins // This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
}); });
@ -18,7 +18,7 @@ gemini.suite('23vivi', (suite) => {
gemini.suite('Landing', (landingSuite) => { gemini.suite('Landing', (landingSuite) => {
landingSuite landingSuite
.setUrl('/') .setUrl('/')
.capture('landing', (actions, find) => { .capture('landing', (actions) => {
// Wait for the logo to appear // Wait for the logo to appear
actions.waitForElementToShow('.vivi23-landing--header-logo', TIMEOUTS.LONG); actions.waitForElementToShow('.vivi23-landing--header-logo', TIMEOUTS.LONG);
}); });

View File

@ -10,7 +10,7 @@ const TIMEOUTS = environment.TIMEOUTS;
gemini.suite('Cyland', (suite) => { gemini.suite('Cyland', (suite) => {
suite suite
.setCaptureElements('.ascribe-body') .setCaptureElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
// This will be called before every nested suite begins // This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
}); });
@ -20,7 +20,7 @@ gemini.suite('Cyland', (suite) => {
.setUrl('/') .setUrl('/')
// 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) => {
actions.waitForElementToShow('.cyland-landing img', TIMEOUTS.LONG); actions.waitForElementToShow('.cyland-landing img', TIMEOUTS.LONG);
}); });
}); });

View File

@ -11,7 +11,7 @@ const TIMEOUTS = environment.TIMEOUTS;
gemini.suite('Ikonotv', (suite) => { gemini.suite('Ikonotv', (suite) => {
suite suite
.setCaptureElements('.ascribe-body') .setCaptureElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
// This will be called before every nested suite begins // This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
}); });
@ -22,9 +22,11 @@ gemini.suite('Ikonotv', (suite) => {
// Gemini complains if we try to capture the entire app for Ikonotv's landing page for some reason // Gemini complains if we try to capture the entire app for Ikonotv's landing page for some reason
.setCaptureElements('.ikonotv-landing') .setCaptureElements('.ikonotv-landing')
.setTolerance(5) .setTolerance(5)
.capture('landing', (actions, find) => { .capture('landing', (actions) => {
// Stop background animation // Stop background animation
actions.executeJS(function (window) { // eslint-disable-next-line prefer-arrow-callback
actions.executeJS(function removeBackgroundAnimation(window) {
/* eslint-disable no-var */
var landingBackground = window.document.querySelector('.client--ikonotv .route--landing'); var landingBackground = window.document.querySelector('.client--ikonotv .route--landing');
landingBackground.style.animation = 'none'; landingBackground.style.animation = 'none';
landingBackground.style.webkitAnimation = 'none'; landingBackground.style.webkitAnimation = 'none';
@ -37,10 +39,10 @@ gemini.suite('Ikonotv', (suite) => {
// Ikono needs its own set of tests for some pre-authorization pages to wait for // Ikono needs its own set of tests for some pre-authorization pages to wait for
// its logo to appear // its logo to appear
gemini.suite('Ikonotv basic', (suite) => { gemini.suite('Ikonotv basic', (basicSuite) => {
suite basicSuite
.setCaptureElements('.ascribe-app') .setCaptureElements('.ascribe-app')
.before((actions, find) => { .before((actions) => {
// 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('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);

View File

@ -10,7 +10,7 @@ const TIMEOUTS = environment.TIMEOUTS;
gemini.suite('Lumenus', (suite) => { gemini.suite('Lumenus', (suite) => {
suite suite
.setCaptureElements('.ascribe-body') .setCaptureElements('.ascribe-body')
.before((actions, find) => { .before((actions) => {
// This will be called before every nested suite begins // This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
}); });
@ -18,7 +18,7 @@ gemini.suite('Lumenus', (suite) => {
gemini.suite('Landing', (landingSuite) => { gemini.suite('Landing', (landingSuite) => {
landingSuite landingSuite
.setUrl('/') .setUrl('/')
.capture('landing', (actions, find) => { .capture('landing', (actions) => {
// Wait for the logo to appear // Wait for the logo to appear
actions.waitForElementToShow('.wp-landing-wrapper img', TIMEOUTS.LONG); actions.waitForElementToShow('.wp-landing-wrapper img', TIMEOUTS.LONG);
}); });

View File

@ -11,7 +11,7 @@ const TIMEOUTS = environment.TIMEOUTS;
gemini.suite('Whitelabel basic', (suite) => { gemini.suite('Whitelabel basic', (suite) => {
suite suite
.setCaptureElements('.ascribe-wallet-app > .container') .setCaptureElements('.ascribe-wallet-app > .container')
.before((actions, find) => { .before((actions) => {
// 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'
@ -26,7 +26,7 @@ gemini.suite('Whitelabel basic', (suite) => {
.setUrl('/login') .setUrl('/login')
// See Ikono // See Ikono
.skip(/Ikono/) .skip(/Ikono/)
.capture('login', (actions, find) => { .capture('login', (actions) => {
actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL); 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
@ -59,7 +59,7 @@ gemini.suite('Whitelabel basic', (suite) => {
.setUrl('/signup') .setUrl('/signup')
// See Ikono // See Ikono
.skip(/Ikono/) .skip(/Ikono/)
.capture('sign up', (actions, find) => { .capture('sign up', (actions) => {
actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL); 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);
@ -77,7 +77,7 @@ gemini.suite('Whitelabel basic', (suite) => {
gemini.suite('Password reset', (passwordResetSuite) => { gemini.suite('Password reset', (passwordResetSuite) => {
passwordResetSuite passwordResetSuite
.setUrl('/password_reset') .setUrl('/password_reset')
.capture('password reset', (actions, find) => { .capture('password reset', (actions) => {
actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL); 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);
@ -93,14 +93,15 @@ gemini.suite('Whitelabel basic', (suite) => {
gemini.suite('Coa verify', (coaVerifySuite) => { gemini.suite('Coa verify', (coaVerifySuite) => {
coaVerifySuite coaVerifySuite
.setUrl('/coa_verify') .setUrl('/coa_verify')
.capture('coa verify', (actions, find) => { .capture('coa verify', (actions) => {
actions.waitForElementToShow('.ascribe-form', TIMEOUTS.NORMAL); 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('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');
actions.sendKeys(find('.ascribe-form .ascribe-property-wrapper:nth-of-type(2) textarea'), 'sample signature'); actions.sendKeys(find('.ascribe-form .ascribe-property-wrapper:nth-of-type(2) textarea'),
'sample signature');
}) })
.capture('coa verify form filled', (actions, find) => { .capture('coa verify form filled', (actions, find) => {
actions.click(find('.ascribe-login-header')); actions.click(find('.ascribe-login-header'));

View File

@ -0,0 +1,9 @@
{
"env": {
"mocha": true
},
"rules": {
"max-len": [2, { "code": 125 }],
"prefer-arrow-callback": [0]
}
}

View File

@ -1,25 +1,25 @@
'use strict'; 'use strict';
const config = require('./config');
const colors = require('colors'); const colors = require('colors');
const sauceConnectLauncher = require('sauce-connect-launcher'); const sauceConnectLauncher = require('sauce-connect-launcher');
const config = require('./config');
let globalSauceProcess; let globalSauceProcess;
if (!process.env.SAUCE_USERNAME) { if (!process.env.SAUCE_USERNAME) {
console.log(colors.red('SAUCE_USERNAME is missing. Please check the README.md file.')); console.log(colors.red('SAUCE_USERNAME is missing. Please check the README.md file.'));
process.exit(1); //eslint-disable-line no-process-exit process.exit(1);
} }
if (!process.env.SAUCE_ACCESS_KEY) { if (!process.env.SAUCE_ACCESS_KEY) {
console.log(colors.red('SAUCE_ACCESS_KEY is missing. Please check the README.md file.')); console.log(colors.red('SAUCE_ACCESS_KEY is missing. Please check the README.md file.'));
process.exit(1); //eslint-disable-line no-process-exit process.exit(1);
} }
if (process.env.SAUCE_AUTO_CONNECT) { if (process.env.SAUCE_AUTO_CONNECT) {
before(function(done) { before(function (done) {
console.log(colors.yellow('Setting up tunnel from Saucelabs to your lovely computer, will take a while.')); console.log(colors.yellow('Setting up tunnel from Saucelabs to your lovely computer, will take a while.'));
// Creating the tunnel takes a bit of time. For this case we can safely disable Mocha timeouts. // Creating the tunnel takes a bit of time. For this case we can safely disable Mocha timeouts.
this.timeout(0); this.timeout(0);

View File

@ -12,12 +12,12 @@ chai.should();
function testSuite(browserName, version, platform) { function testSuite(browserName, version, platform) {
describe(`[${browserName} ${version} ${platform}] Login logs users in`, function() { describe(`[${browserName} ${version} ${platform}] Login logs users in`, function () {
// Set timeout to zero so Mocha won't time out. // Set timeout to zero so Mocha won't time out.
this.timeout(0); this.timeout(0);
let browser; let browser;
before(function() { before(function () {
// No need to inject `username` or `access_key`, by default the constructor // No need to inject `username` or `access_key`, by default the constructor
// looks up the values in `process.env.SAUCE_USERNAME` and `process.env.SAUCE_ACCESS_KEY` // looks up the values in `process.env.SAUCE_USERNAME` and `process.env.SAUCE_ACCESS_KEY`
browser = wd.promiseChainRemote('ondemand.saucelabs.com', 80); browser = wd.promiseChainRemote('ondemand.saucelabs.com', 80);
@ -35,14 +35,14 @@ function testSuite(browserName, version, platform) {
}); });
}); });
after(function() { after(function () {
return browser.quit(); return browser.quit();
}); });
it('should contain "Log in" in the title', function() { it('should contain "Log in" in the title', function () {
return browser. return browser
waitForElementByCss('.ascribe-login-wrapper', asserters.isDisplayed, 2000) .waitForElementByCss('.ascribe-login-wrapper', asserters.isDisplayed, 2000)
title().should.become('Log in'); .title().should.become('Log in');
}); });
}); });
} }

View File

@ -1,15 +1,17 @@
'use strict'; 'use strict';
const config = require('./config'); //eslint-disable-line no-unused-vars
const colors = require('colors'); const colors = require('colors');
const sauceConnectLauncher = require('sauce-connect-launcher'); const sauceConnectLauncher = require('sauce-connect-launcher');
const config = require('./config'); // eslint-disable-line no-unused-vars
function connect() { function connect() {
console.log(colors.yellow('Setting up tunnel from Saucelabs to your lovely computer, will take a while.')); console.log(
colors.yellow('Setting up tunnel from Saucelabs to your lovely computer, will take a while.')
);
// Creating the tunnel takes a bit of time. For this case we can safely disable Mocha timeouts. // Creating the tunnel takes a bit of time. For this case we can safely disable Mocha timeouts.
sauceConnectLauncher(function (err) { sauceConnectLauncher((err) => {
if (err) { if (err) {
console.error(err.message); console.error(err.message);
return; return;