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

Add whitelabel visual test suite

Currently just checks landing page and some pages accessible to
unauthorized users.
This commit is contained in:
Brett Sun 2016-01-29 11:24:01 +01:00
parent 1d09ef1120
commit e895c76561
6 changed files with 405 additions and 0 deletions

View File

@ -15,3 +15,119 @@ browsers:
windowSize: 600x1056
desiredCapabilities:
browserName: phantomjs
CcDesktop:
rootUrl: http://cc.localhost.com:3000/
screenshotsDir: './gemini-screens/cc-desktop'
windowSize: 1900x1080
desiredCapabilities:
browserName: phantomjs
CcMobile:
rootUrl: http://cc.localhost.com:3000/
screenshotsDir: './gemini-screens/cc-mobile'
windowSize: 600x1056
desiredCapabilities:
browserName: phantomjs
CylandDesktop:
rootUrl: http://cyland.localhost.com:3000/
screenshotsDir: './gemini-screens/cyland-desktop'
windowSize: 1900x1080
desiredCapabilities:
browserName: phantomjs
CylandMobile:
rootUrl: http://cyland.localhost.com:3000/
screenshotsDir: './gemini-screens/cyland-mobile'
windowSize: 600x1056
desiredCapabilities:
browserName: phantomjs
IkonotvDesktop:
rootUrl: http://ikonotv.localhost.com:3000/
screenshotsDir: './gemini-screens/ikonotv-desktop'
windowSize: 1900x1080
desiredCapabilities:
browserName: phantomjs
IkonotvMobile:
rootUrl: http://ikonotv.localhost.com:3000/
screenshotsDir: './gemini-screens/ikonotv-mobile'
windowSize: 600x1056
desiredCapabilities:
browserName: phantomjs
LumenusDesktop:
rootUrl: http://lumenus.localhost.com:3000/
screenshotsDir: './gemini-screens/lumenus-desktop'
windowSize: 1900x1080
desiredCapabilities:
browserName: phantomjs
LumenusMobile:
rootUrl: http://lumenus.localhost.com:3000/
screenshotsDir: './gemini-screens/lumenus-mobile'
windowSize: 600x1056
desiredCapabilities:
browserName: phantomjs
23viviDesktop:
rootUrl: http://23vivi.localhost.com:3000/
screenshotsDir: './gemini-screens/23vivi-desktop'
windowSize: 1900x1080
desiredCapabilities:
browserName: phantomjs
23viviMobile:
rootUrl: http://23vivi.localhost.com:3000/
screenshotsDir: './gemini-screens/23vivi-mobile'
windowSize: 600x1056
desiredCapabilities:
browserName: phantomjs
sets:
main:
files:
- gemini/main
browsers:
- MainDesktop
- MainMobile
cc:
files:
- gemini/whitelabel/shared
browsers:
- CcDesktop
- CcMobile
cyland:
files:
- gemini/whitelabel/shared
- gemini/whitelabel/cyland
browsers:
- CylandDesktop
- CylandMobile
ikonotv:
files:
- gemini/whitelabel/shared
- gemini/whitelabel/ikonotv
browsers:
- IkonotvDesktop
- IkonotvMobile
lumenus:
files:
- gemini/whitelabel/shared
- gemini/whitelabel/lumenus
browsers:
- LumenusDesktop
- LumenusMobile
23vivi:
files:
- gemini/whitelabel/shared
- gemini/whitelabel/23vivi
browsers:
- 23viviDesktop
- 23viviMobile

View File

@ -0,0 +1,27 @@
'use strict';
const gemini = require('gemini');
/**
* Suite of tests against 23vivi specific routes
*/
gemini.suite('23vivi', (suite) => {
suite
//TODO: maybe this should be changed to .ascribe-body once the PR that does this is merged
.setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => {
// This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-wallet-app', 5000);
});
gemini.suite('Landing', (landingSuite) => {
landingSuite
.setUrl('/')
.capture('landing', (actions, find) => {
// Wait for the logo to appear
actions.waitForElementToShow('.vivi23-landing--header-logo', 10000);
});
});
// TODO: add more tests for market specific pages after authentication
});

View File

@ -0,0 +1,28 @@
'use strict';
const gemini = require('gemini');
/**
* Suite of tests against Cyland specific routes
*/
gemini.suite('Cyland', (suite) => {
suite
//TODO: maybe this should be changed to .ascribe-body once the PR that does this is merged
.setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => {
// This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-wallet-app', 5000);
});
gemini.suite('Landing', (landingSuite) => {
landingSuite
.setUrl('/')
// Ignore Cyland's logo as it's a gif
.ignoreElements('.cyland-landing img')
.capture('landing', (actions, find) => {
actions.waitForElementToShow('.cyland-landing img', 10000);
});
});
// TODO: add more tests for cyland specific pages after authentication
});

View File

@ -0,0 +1,95 @@
'use strict';
const gemini = require('gemini');
/**
* Suite of tests against Cyland specific routes
*/
gemini.suite('Ikonotv', (suite) => {
suite
//TODO: maybe this should be changed to .ascribe-body once the PR that does this is merged
.setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => {
// This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-wallet-app', 5000);
});
gemini.suite('Landing', (landingSuite) => {
landingSuite
.setUrl('/')
// Gemini complains if we try to capture the entire app for Ikonotv's landing page for some reason
.setCaptureElements('.ikonotv-landing')
.setTolerance(5)
.capture('landing', (actions, find) => {
// Stop background animation
actions.executeJS(function (window) {
var landingBackground = window.document.querySelector('.client--ikonotv .route--landing');
landingBackground.style.animation = 'none';
landingBackground.style.webkitAnimation = 'none';
});
// Wait for logo to appear
actions.waitForElementToShow('.ikonotv-landing header img', 10000);
});
});
// Ikono needs its own set of tests for some pre-authorization pages to wait for
// its logo to appear
gemini.suite('Ikonotv basic', (suite) => {
suite
.setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => {
// This will be called before every nested suite begins unless that suite
// also defines a `.before()`
// FIXME: use a more generic class for this, like just '.app',
// when we can use this file with the whitelabels
actions.waitForElementToShow('.ascribe-wallet-app', 5000);
// Wait for the forms to appear
actions.waitForElementToShow('.ascribe-form', 5000);
// Just use a dumb wait because the logo is set as a background image
actions.wait(3000);
});
gemini.suite('Login', (loginSuite) => {
loginSuite
.setUrl('/login')
.capture('login')
.capture('hover on login submit', (actions, find) => {
actions.mouseMove(find('.ascribe-form button[type=submit]'));
})
.capture('hover on sign up link', (actions, find) => {
actions.mouseMove(find('.ascribe-login-text a[href="/signup"]'));
})
.capture('login form filled with focus', (actions, find) => {
const emailInput = find('.ascribe-form input[name=email]');
// Remove hover from sign up link
actions.click(emailInput);
actions.sendKeys(emailInput, 'dimi@mailinator.com');
actions.sendKeys(find('.ascribe-form input[name=password]'), '0000000000');
})
.capture('login form filled', (actions, find) => {
actions.click(find('.ascribe-form-header'));
});
});
gemini.suite('Sign up', (signUpSuite) => {
signUpSuite
.setUrl('/signup')
.capture('sign up')
.capture('sign up form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name=email]'), 'dimi@mailinator.com');
actions.sendKeys(find('.ascribe-form input[name=password]'), '0000000000');
actions.sendKeys(find('.ascribe-form input[name=password_confirm]'), '0000000000');
})
.capture('sign up form filled with check', (actions, find) => {
actions.click(find('.ascribe-form input[type="checkbox"] ~ .checkbox'));
});
});
});
// TODO: add more tests for ikonotv specific pages after authentication
});

View File

@ -0,0 +1,27 @@
'use strict';
const gemini = require('gemini');
/**
* Suite of tests against lumenus specific routes
*/
gemini.suite('Lumenus', (suite) => {
suite
//TODO: maybe this should be changed to .ascribe-body once the PR that does this is merged
.setCaptureElements('.ascribe-wallet-app')
.before((actions, find) => {
// This will be called before every nested suite begins
actions.waitForElementToShow('.ascribe-wallet-app', 5000);
});
gemini.suite('Landing', (landingSuite) => {
landingSuite
.setUrl('/')
.capture('landing', (actions, find) => {
// Wait for the logo to appear
actions.waitForElementToShow('.wp-landing-wrapper img', 10000);
});
});
// TODO: add more tests for market specific pages after authentication
});

View File

@ -0,0 +1,112 @@
'use strict';
const gemini = require('gemini');
/**
* Basic suite of tests against whitelabel routes that do not require authentication.
*/
gemini.suite('Whitelabel basic', (suite) => {
suite
.setCaptureElements('.ascribe-wallet-app > .container')
.before((actions, find) => {
// This will be called before every nested suite begins unless that suite
// also defines a `.before()`
// FIXME: use a more generic class for this, like just '.ascribe-app'
actions.waitForElementToShow('.ascribe-wallet-app', 5000);
// Use a dumb wait in case we're still waiting for other assets, like fonts, to load
actions.wait(1000);
});
gemini.suite('Login', (loginSuite) => {
loginSuite
.setUrl('/login')
// See Ikono
.skip(/Ikono/)
.capture('login', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000);
// 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
// and the cache isn't hot yet?).
// Let's wait a bit and hope they load.
actions.wait(3000);
})
.capture('hover on login submit', (actions, find) => {
actions.mouseMove(find('.ascribe-form button[type=submit]'));
})
.capture('hover on sign up link', (actions, find) => {
actions.mouseMove(find('.ascribe-login-text a[href="/signup"]'));
})
.capture('login form filled with focus', (actions, find) => {
const emailInput = find('.ascribe-form input[name=email]');
// Remove hover from sign up link
actions.click(emailInput);
actions.sendKeys(emailInput, 'dimi@mailinator.com');
actions.sendKeys(find('.ascribe-form input[name=password]'), '0000000000');
})
.capture('login form filled', (actions, find) => {
actions.click(find('.ascribe-form-header'));
});
});
gemini.suite('Sign up', (signUpSuite) => {
signUpSuite
.setUrl('/signup')
// See Ikono
.skip(/Ikono/)
.capture('sign up', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000);
// Wait in case the form reloads due to other assets loading
actions.wait(500);
})
.capture('sign up form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name=email]'), 'dimi@mailinator.com');
actions.sendKeys(find('.ascribe-form input[name=password]'), '0000000000');
actions.sendKeys(find('.ascribe-form input[name=password_confirm]'), '0000000000');
})
.capture('sign up form filled with check', (actions, find) => {
actions.click(find('.ascribe-form input[type="checkbox"] ~ .checkbox'));
});
});
gemini.suite('Password reset', (passwordResetSuite) => {
passwordResetSuite
.setUrl('/password_reset')
.capture('password reset', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000);
// Wait in case the form reloads due to other assets loading
actions.wait(500);
})
.capture('password reset form filled with focus', (actions, find) => {
actions.sendKeys(find('.ascribe-form input[name="email"]'), 'dimi@mailinator.com');
})
.capture('password reset form filled', (actions, find) => {
actions.click(find('.ascribe-form-header'));
});
});
gemini.suite('Coa verify', (coaVerifySuite) => {
coaVerifySuite
.setUrl('/coa_verify')
.capture('coa verify', (actions, find) => {
actions.waitForElementToShow('.ascribe-form', 5000);
// Wait in case the form reloads due to other assets loading
actions.wait(500);
})
.capture('coa verify form filled with focus', (actions, find) => {
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');
})
.capture('coa verify form filled', (actions, find) => {
actions.click(find('.ascribe-login-header'));
});
});
gemini.suite('Not found', (notFoundSuite) => {
notFoundSuite
.setUrl('/not_found_page')
.capture('not found page');
});
});