mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Update gemini and docs for visual regression testing
This commit is contained in:
parent
c13a24a107
commit
319261f15e
@ -45,10 +45,9 @@
|
||||
"chai-as-promised": "^5.1.0",
|
||||
"colors": "^1.1.2",
|
||||
"dotenv": "^1.2.0",
|
||||
"gemini": "^2.1.0",
|
||||
"gemini": "^4.3.0",
|
||||
"jest-cli": "^0.4.0",
|
||||
"mocha": "^2.3.4",
|
||||
"phantomjs2": "^2.0.2",
|
||||
"rimraf": "^2.5.2",
|
||||
"sauce-connect-launcher": "^0.13.0",
|
||||
"wd": "^0.4.0"
|
||||
|
@ -1,4 +1,7 @@
|
||||
{
|
||||
"globals": {
|
||||
"gemini": true
|
||||
},
|
||||
"rules": {
|
||||
"max-len": [2, { "code": 125 }]
|
||||
}
|
||||
|
@ -23,30 +23,41 @@ Then, install [PhantomJS2](https://www.npmjs.com/package/phantomjs2):
|
||||
|
||||
```bash
|
||||
# Until phantomjs2 is updated for the new 2.1 version of PhantomJS, use the following (go to https://bitbucket.org/ariya/phantomjs/downloads to find a build for your OS)
|
||||
npm install -g phantomjs2 --phantomjs_downloadurl=https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip
|
||||
npm install --save-dev phantomjs2 --phantomjs_downloadurl=https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip
|
||||
npm install phantomjs2 --phantomjs_downloadurl=https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip
|
||||
|
||||
# If using OSX, you may have to install upx and decompress the binary downloaded by npm manually:
|
||||
brew install upx
|
||||
|
||||
# Navigate to the binary, ie. /Users/Brett/.nvm/versions/node/v5.4.0/lib/node_modules/phantomjs2/lib/phantom/bin/phantomjs
|
||||
# Navigate to the binary, ie. node_modules/phantomjs2/lib/phantom/bin/ (for the local installation)
|
||||
upx -d phantomjs
|
||||
|
||||
# If using Linux or OSX, you may also have to convert the binary using `dos2unix`:
|
||||
brew install dos2unix
|
||||
dos2unix phantomjs
|
||||
```
|
||||
|
||||
Finally, [install Gemini globally and locally with npm](https://github.com/gemini-testing/gemini/blob/master/README.md#installation).
|
||||
Finally, [install Gemini locally with npm](https://github.com/gemini-testing/gemini/blob/master/README.md#installation), if it
|
||||
hasn't already been installed through `package.json`.
|
||||
|
||||
|
||||
Running Tests
|
||||
=============
|
||||
|
||||
Run Spool and Onion (on localhost.com:3000).
|
||||
|
||||
Run PhantomJS:
|
||||
|
||||
```bash
|
||||
npm run vi-phantom
|
||||
```
|
||||
|
||||
And then run Gemini tests:
|
||||
Gather your initial baseline (on the master branch, for example):
|
||||
|
||||
```bash
|
||||
npm run vi-update
|
||||
```
|
||||
|
||||
And then run Gemini tests (on your current branch with changes, to test for regressions):
|
||||
|
||||
```bash
|
||||
npm run vi-test
|
||||
@ -61,8 +72,8 @@ npm run vi-test:whitelabel
|
||||
npm run vi-test:cyland
|
||||
```
|
||||
|
||||
If you've made changes and want them to be the new baseline (ie. it's a correct change--**make sure** to test there are
|
||||
no regressions first!), use
|
||||
Later on, if you've made changes and want them to be the new baseline (ie. it's a correct change--**make sure** to test
|
||||
there are no regressions first!), use:
|
||||
|
||||
```bash
|
||||
npm run vi-update
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gemini = require('gemini');
|
||||
const environment = require('../environment');
|
||||
const MAIN_USER = environment.MAIN_USER;
|
||||
const TIMEOUTS = environment.TIMEOUTS;
|
||||
@ -30,187 +29,191 @@ gemini.suite('Authenticated', (suite) => {
|
||||
actions.sendKeys(find('.ascribe-login-wrapper input[name=password]'), MAIN_USER.password);
|
||||
actions.click(find('.ascribe-login-wrapper button[type=submit]'));
|
||||
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.LONG);
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Header-desktop', (headerSuite) => {
|
||||
headerSuite
|
||||
.setCaptureElements('nav.navbar .container')
|
||||
// Ignore Cyland's logo as it's a gif
|
||||
.ignoreElements('.client--cyland img.img-brand')
|
||||
.skip(/Mobile/)
|
||||
.before((actions) => {
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('desktop header');
|
||||
gemini.suite('Authenticated', (authenticatedSuite) => {
|
||||
gemini.suite('Header-desktop', (headerSuite) => {
|
||||
headerSuite
|
||||
.setCaptureElements('nav.navbar .container')
|
||||
// Ignore Cyland's logo as it's a gif
|
||||
.ignoreElements('.client--cyland img.img-brand')
|
||||
.skip(/Mobile/)
|
||||
.before((actions) => {
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.LONG);
|
||||
actions.waitForElementToShow('#header-notification-dropdown', TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
|
||||
})
|
||||
.capture('desktop header');
|
||||
|
||||
gemini.suite('User dropdown', (headerUserSuite) => {
|
||||
headerUserSuite
|
||||
.setCaptureElements('#nav-route-user-dropdown ~ .dropdown-menu')
|
||||
.capture('expanded user dropdown', (actions, find) => {
|
||||
actions.click(find('#nav-route-user-dropdown'));
|
||||
});
|
||||
gemini.suite('User dropdown', (headerUserSuite) => {
|
||||
headerUserSuite
|
||||
.setCaptureElements('#nav-route-user-dropdown ~ .dropdown-menu')
|
||||
.capture('expanded user dropdown', (actions, find) => {
|
||||
actions.click(find('#nav-route-user-dropdown'));
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Notification dropdown', (headerNotificationSuite) => {
|
||||
headerNotificationSuite
|
||||
.setCaptureElements('#header-notification-dropdown ~ .dropdown-menu')
|
||||
.capture('expanded notifications dropdown', (actions, find) => {
|
||||
actions.click(find('#header-notification-dropdown'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Notification dropdown', (headerNotificationSuite) => {
|
||||
headerNotificationSuite
|
||||
.setCaptureElements('#header-notification-dropdown ~ .dropdown-menu')
|
||||
// Test for the collapsed header in mobile
|
||||
gemini.suite('Header-mobile', (headerMobileSuite) => {
|
||||
headerMobileSuite
|
||||
.setCaptureElements('nav.navbar .container')
|
||||
// Ignore Cyland's logo as it's a gif
|
||||
.ignoreElements('.client--cyland img.img-brand')
|
||||
.skip(/Desktop/)
|
||||
.before((actions) => {
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.LONG);
|
||||
})
|
||||
.capture('mobile header')
|
||||
.capture('expanded mobile header', (actions, find) => {
|
||||
actions.click(find('nav.navbar .navbar-toggle'));
|
||||
// Wait for the header to expand
|
||||
actions.wait(500);
|
||||
actions.waitForElementToShow('#header-notification-dropdown', TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
|
||||
})
|
||||
.capture('expanded user dropdown', (actions, find) => {
|
||||
actions.click(find('#nav-route-user-dropdown'));
|
||||
})
|
||||
.capture('expanded notifications dropdown', (actions, find) => {
|
||||
actions.click(find('#header-notification-dropdown'));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Test for the collapsed header in mobile
|
||||
gemini.suite('Header-mobile', (headerMobileSuite) => {
|
||||
headerMobileSuite
|
||||
.setCaptureElements('nav.navbar .container')
|
||||
// Ignore Cyland's logo as it's a gif
|
||||
.ignoreElements('.client--cyland img.img-brand')
|
||||
.skip(/Desktop/)
|
||||
.before((actions) => {
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('mobile header')
|
||||
.capture('expanded mobile header', (actions, find) => {
|
||||
actions.click(find('nav.navbar .navbar-toggle'));
|
||||
// Wait for the header to expand
|
||||
actions.wait(500);
|
||||
})
|
||||
.capture('expanded user dropdown', (actions, find) => {
|
||||
actions.click(find('#nav-route-user-dropdown'));
|
||||
})
|
||||
.capture('expanded notifications dropdown', (actions, find) => {
|
||||
actions.click(find('#header-notification-dropdown'));
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Collection', (collectionSuite) => {
|
||||
collectionSuite
|
||||
.setCaptureElements('.ascribe-accordion-list')
|
||||
.before((actions) => {
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
// Wait for the images to load
|
||||
// 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.
|
||||
// We could also change the thumbnails with JS, but setting up a test user is probably easier.
|
||||
actions.wait(TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('collection')
|
||||
.capture('expanded edition in collection', (actions, find) => {
|
||||
actions.click(find('.ascribe-accordion-list-item .ascribe-accordion-list-item-edition-widget'));
|
||||
// Wait for editions to load
|
||||
actions.waitForElementToShow('.ascribe-accordion-list-item-table', TIMEOUTS.LONG);
|
||||
});
|
||||
|
||||
gemini.suite('Collection placeholder', (collectionPlaceholderSuite) => {
|
||||
collectionPlaceholderSuite
|
||||
.setCaptureElements('.ascribe-accordion-list-placeholder')
|
||||
.capture('collection empty search', (actions, find) => {
|
||||
actions.sendKeys(find('.ascribe-piece-list-toolbar .search-bar input[type="text"]'), 'no search result');
|
||||
actions.waitForElementToShow('.ascribe-accordion-list-placeholder', TIMEOUTS.NORMAL);
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('PieceListBulkModal', (pieceListBulkModalSuite) => {
|
||||
pieceListBulkModalSuite
|
||||
.setCaptureElements('.piece-list-bulk-modal')
|
||||
.capture('items selected', (actions, find) => {
|
||||
gemini.suite('Collection', (collectionSuite) => {
|
||||
collectionSuite
|
||||
.setCaptureElements('.ascribe-accordion-list')
|
||||
.before((actions) => {
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
// Wait for the images to load
|
||||
// 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.
|
||||
// We could also change the thumbnails with JS, but setting up a test user is probably easier.
|
||||
actions.wait(TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('collection')
|
||||
.capture('expanded edition in collection', (actions, find) => {
|
||||
actions.click(find('.ascribe-accordion-list-item .ascribe-accordion-list-item-edition-widget'));
|
||||
// Wait for editions to load
|
||||
actions.waitForElementToShow('.ascribe-accordion-list-item-table', TIMEOUTS.NORMAL);
|
||||
|
||||
actions.click('.ascribe-table thead tr input[type="checkbox"]');
|
||||
actions.waitForElementToShow('.piece-list-bulk-modal');
|
||||
actions.waitForElementToShow('.ascribe-accordion-list-item-table', TIMEOUTS.LONG);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('PieceListToolbar', (pieceListToolbarSuite) => {
|
||||
pieceListToolbarSuite
|
||||
.setCaptureElements('.ascribe-piece-list-toolbar')
|
||||
.capture('piece list toolbar')
|
||||
.capture('piece list toolbar search filled', (actions, find) => {
|
||||
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);
|
||||
gemini.suite('Collection placeholder', (collectionPlaceholderSuite) => {
|
||||
collectionPlaceholderSuite
|
||||
.setCaptureElements('.ascribe-accordion-list-placeholder')
|
||||
.capture('collection empty search', (actions, find) => {
|
||||
actions.sendKeys(find('.ascribe-piece-list-toolbar .search-bar input[type="text"]'), 'no search result');
|
||||
actions.waitForElementToShow('.ascribe-accordion-list-placeholder', TIMEOUTS.NORMAL);
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Order widget dropdown', (pieceListToolbarOrderWidgetSuite) => {
|
||||
pieceListToolbarOrderWidgetSuite
|
||||
.setCaptureElements('#ascribe-piece-list-toolbar-order-widget-dropdown',
|
||||
'#ascribe-piece-list-toolbar-order-widget-dropdown ~ .dropdown-menu')
|
||||
.capture('expanded order dropdown', (actions, find) => {
|
||||
actions.click(find('#ascribe-piece-list-toolbar-order-widget-dropdown'));
|
||||
gemini.suite('PieceListBulkModal', (pieceListBulkModalSuite) => {
|
||||
pieceListBulkModalSuite
|
||||
.setCaptureElements('.piece-list-bulk-modal')
|
||||
.capture('items selected', (actions, find) => {
|
||||
actions.click(find('.ascribe-accordion-list-item .ascribe-accordion-list-item-edition-widget'));
|
||||
// Wait for editions to load
|
||||
actions.waitForElementToShow('.ascribe-accordion-list-item-table', TIMEOUTS.NORMAL);
|
||||
|
||||
// Wait as the dropdown screenshot still includes the collection in the background
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
});
|
||||
actions.click('.ascribe-table thead tr input[type="checkbox"]');
|
||||
actions.waitForElementToShow('.piece-list-bulk-modal');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Filter widget dropdown', (pieceListToolbarFilterWidgetSuite) => {
|
||||
pieceListToolbarFilterWidgetSuite
|
||||
.setCaptureElements('#ascribe-piece-list-toolbar-filter-widget-dropdown',
|
||||
'#ascribe-piece-list-toolbar-filter-widget-dropdown ~ .dropdown-menu')
|
||||
.capture('expanded filter dropdown', (actions, find) => {
|
||||
actions.click(find('#ascribe-piece-list-toolbar-filter-widget-dropdown'));
|
||||
|
||||
// Wait as the dropdown screenshot still includes the collection in the background
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
gemini.suite('PieceListToolbar', (pieceListToolbarSuite) => {
|
||||
pieceListToolbarSuite
|
||||
.setCaptureElements('.ascribe-piece-list-toolbar')
|
||||
.capture('piece list toolbar')
|
||||
.capture('piece list toolbar search filled', (actions, find) => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Register work', (registerSuite) => {
|
||||
registerSuite
|
||||
.setUrl('/register_piece')
|
||||
.before((actions) => {
|
||||
// The editions options are only rendered after the whitelabel is fetched, so
|
||||
// we have to wait for it here
|
||||
// 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);
|
||||
})
|
||||
.capture('register work', (actions) => {
|
||||
// The uploader options are only rendered after the user is fetched, so
|
||||
// we also have to wait for it here
|
||||
actions.waitForElementToShow('.file-drag-and-drop-dialog .present-options', TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('register work filled', (actions, find) => {
|
||||
actions.sendKeys(find('.ascribe-form input[name="artist_name"]'), 'artist name');
|
||||
actions.sendKeys(find('.ascribe-form input[name="title"]'), 'title');
|
||||
actions.sendKeys(find('.ascribe-form input[name="date_created"]'), 'date created');
|
||||
})
|
||||
.capture('register work filled with editions', (actions, find) => {
|
||||
actions.click(find('.ascribe-form input[name="num_editions-checkbox"] ~ .checkbox'));
|
||||
// Wait for transition
|
||||
actions.wait(500);
|
||||
actions.sendKeys(find('.ascribe-form input[name="num_editions"]'), '50');
|
||||
gemini.suite('Order widget dropdown', (pieceListToolbarOrderWidgetSuite) => {
|
||||
pieceListToolbarOrderWidgetSuite
|
||||
.setCaptureElements('#ascribe-piece-list-toolbar-order-widget-dropdown',
|
||||
'#ascribe-piece-list-toolbar-order-widget-dropdown ~ .dropdown-menu')
|
||||
.capture('expanded order dropdown', (actions, find) => {
|
||||
actions.click(find('#ascribe-piece-list-toolbar-order-widget-dropdown'));
|
||||
|
||||
// Wait as the dropdown screenshot still includes the collection in the background
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Register work hash', (registerHashSuite) => {
|
||||
registerHashSuite
|
||||
.setUrl('/register_piece?method=hash')
|
||||
.capture('register work hash method');
|
||||
gemini.suite('Filter widget dropdown', (pieceListToolbarFilterWidgetSuite) => {
|
||||
pieceListToolbarFilterWidgetSuite
|
||||
.setCaptureElements('#ascribe-piece-list-toolbar-filter-widget-dropdown',
|
||||
'#ascribe-piece-list-toolbar-filter-widget-dropdown ~ .dropdown-menu')
|
||||
.capture('expanded filter dropdown', (actions, find) => {
|
||||
actions.click(find('#ascribe-piece-list-toolbar-filter-widget-dropdown'));
|
||||
|
||||
// Wait as the dropdown screenshot still includes the collection in the background
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Register work upload', (registerUploadSuite) => {
|
||||
registerUploadSuite
|
||||
.setUrl('/register_piece?method=upload')
|
||||
.capture('register work upload method');
|
||||
});
|
||||
});
|
||||
gemini.suite('Register work', (registerSuite) => {
|
||||
registerSuite
|
||||
.setUrl('/register_piece')
|
||||
.before((actions) => {
|
||||
// The editions options are only rendered after the whitelabel is fetched, so
|
||||
// we have to wait for it here
|
||||
// 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);
|
||||
})
|
||||
.capture('register work', (actions) => {
|
||||
// The uploader options are only rendered after the user is fetched, so
|
||||
// we also have to wait for it here
|
||||
actions.waitForElementToShow('.file-drag-and-drop-dialog .present-options', TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('register work filled', (actions, find) => {
|
||||
actions.sendKeys(find('.ascribe-form input[name="artist_name"]'), 'artist name');
|
||||
actions.sendKeys(find('.ascribe-form input[name="title"]'), 'title');
|
||||
actions.sendKeys(find('.ascribe-form input[name="date_created"]'), 'date created');
|
||||
})
|
||||
.capture('register work filled with editions', (actions, find) => {
|
||||
actions.click(find('.ascribe-form input[name="num_editions-checkbox"] ~ .checkbox'));
|
||||
// Wait for transition
|
||||
actions.wait(500);
|
||||
actions.sendKeys(find('.ascribe-form input[name="num_editions"]'), '50');
|
||||
});
|
||||
|
||||
gemini.suite('User settings', (userSettingsSuite) => {
|
||||
userSettingsSuite
|
||||
.setUrl('/settings')
|
||||
.before((actions) => {
|
||||
// This will be called before every nested suite begins unless that suite
|
||||
// also defines a `.before()`
|
||||
actions.waitForElementToShow('.settings-container', TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('user settings');
|
||||
gemini.suite('Register work hash', (registerHashSuite) => {
|
||||
registerHashSuite
|
||||
.setUrl('/register_piece?method=hash')
|
||||
.capture('register work hash method');
|
||||
});
|
||||
|
||||
gemini.suite('Register work upload', (registerUploadSuite) => {
|
||||
registerUploadSuite
|
||||
.setUrl('/register_piece?method=upload')
|
||||
.capture('register work upload method');
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('User settings', (userSettingsSuite) => {
|
||||
userSettingsSuite
|
||||
.setUrl('/settings')
|
||||
.before((actions) => {
|
||||
// This will be called before every nested suite begins unless that suite
|
||||
// also defines a `.before()`
|
||||
actions.waitForElementToShow('.settings-container', TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('user settings');
|
||||
});
|
||||
});
|
||||
|
||||
// Suite just to log out after suites have run
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gemini = require('gemini');
|
||||
const environment = require('../environment');
|
||||
const MAIN_USER = environment.MAIN_USER;
|
||||
const TIMEOUTS = environment.TIMEOUTS;
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gemini = require('gemini');
|
||||
const environment = require('../environment');
|
||||
const MAIN_USER = environment.MAIN_USER;
|
||||
const TIMEOUTS = environment.TIMEOUTS;
|
||||
@ -13,12 +12,10 @@ const editionUrl = `/editions/${environment.MAIN_EDITION_ID}`;
|
||||
* Tests include accessing the piece / edition as the owner or as another user
|
||||
* (we can just use an anonymous user in this case).
|
||||
*/
|
||||
gemini.suite('Work detail', (suite) => {
|
||||
gemini.suite('Basic work detail', (suite) => {
|
||||
suite
|
||||
.setCaptureElements('.ascribe-body')
|
||||
.before((actions) => {
|
||||
// This will be called before every nested suite begins unless that suite
|
||||
// also defines a `.before()`
|
||||
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
|
||||
|
||||
// Wait for the social media buttons to appear
|
||||
@ -51,78 +48,97 @@ gemini.suite('Work detail', (suite) => {
|
||||
.setUrl(editionUrl)
|
||||
.capture('basic edition');
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Authenticated work detail', (suite) => {
|
||||
suite
|
||||
.setCaptureElements('.ascribe-body')
|
||||
.before((actions) => {
|
||||
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
|
||||
});
|
||||
|
||||
// Suite just to log us in before any other suites run
|
||||
gemini.suite('Login', (loginSuite) => {
|
||||
loginSuite
|
||||
.setUrl('/login')
|
||||
.ignoreElements('.ascribe-body')
|
||||
.before((actions) => {
|
||||
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('logged in', (actions, find) => {
|
||||
console.log('logging in');
|
||||
actions.sendKeys(find('.ascribe-login-wrapper input[name=email]'), MAIN_USER.email);
|
||||
actions.sendKeys(find('.ascribe-login-wrapper input[name=password]'), MAIN_USER.password);
|
||||
actions.click(find('.ascribe-login-wrapper button[type=submit]'));
|
||||
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
|
||||
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.LONG);
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Authorized piece', (authorizedPieceSuite) => {
|
||||
authorizedPieceSuite
|
||||
.setUrl(pieceUrl)
|
||||
.capture('authorized piece');
|
||||
});
|
||||
|
||||
gemini.suite('Authorized edition', (authorizedEditionSuite) => {
|
||||
authorizedEditionSuite
|
||||
.setUrl(editionUrl)
|
||||
.capture('authorized edition');
|
||||
});
|
||||
|
||||
gemini.suite('Detail action buttons', (detailActionButtonSuite) => {
|
||||
detailActionButtonSuite
|
||||
.setUrl(editionUrl)
|
||||
.capture('hover on action button', (actions, find) => {
|
||||
actions.mouseMove(find('.ascribe-detail-property .ascribe-button-list button.btn-default'));
|
||||
})
|
||||
.capture('hover on delete button', (actions, find) => {
|
||||
actions.mouseMove(find('.ascribe-detail-property .ascribe-button-list button.btn-tertiary'));
|
||||
})
|
||||
.capture('hover on info button', (actions, find) => {
|
||||
actions.mouseMove(find('.ascribe-detail-property .ascribe-button-list button.glyphicon-question-sign'));
|
||||
})
|
||||
.capture('expand info text', (actions, find) => {
|
||||
actions.click(find('.ascribe-detail-property .ascribe-button-list button.glyphicon-question-sign'));
|
||||
gemini.suite('Authenticated', (authenticatedSuite) => {
|
||||
authenticatedSuite
|
||||
.before((actions) => {
|
||||
// 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 .twitter-share-button',
|
||||
TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
|
||||
actions.waitForElementToShow('.ascribe-media-player', TIMEOUTS.LONG);
|
||||
});
|
||||
});
|
||||
|
||||
gemini.suite('Action form modal', (actionFormModalSuite) => {
|
||||
actionFormModalSuite
|
||||
.setUrl(editionUrl)
|
||||
.setCaptureElements('.modal-dialog')
|
||||
.capture('open email form', (actions, find) => {
|
||||
// Add class names to make the action buttons easier to select
|
||||
// eslint-disable-next-line prefer-arrow-callback
|
||||
actions.executeJS(function addButtonTypeAsClass(window) {
|
||||
/* 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) {
|
||||
actionButtons[ii].className += ' ascribe-action-button-' +
|
||||
actionButtons[ii].textContent.toLowerCase();
|
||||
}
|
||||
}
|
||||
/* eslint-enable no-var */
|
||||
gemini.suite('Authorized piece', (authorizedPieceSuite) => {
|
||||
console.log('authorized piece');
|
||||
authorizedPieceSuite
|
||||
.setUrl(pieceUrl)
|
||||
.capture('authorized piece');
|
||||
});
|
||||
|
||||
gemini.suite('Authorized edition', (authorizedEditionSuite) => {
|
||||
authorizedEditionSuite
|
||||
.setUrl(editionUrl)
|
||||
.capture('authorized edition');
|
||||
});
|
||||
|
||||
gemini.suite('Detail action buttons', (detailActionButtonSuite) => {
|
||||
detailActionButtonSuite
|
||||
.setUrl(editionUrl)
|
||||
.capture('hover on action button', (actions, find) => {
|
||||
console.log('hover on action button');
|
||||
actions.mouseMove(find('.ascribe-detail-property .ascribe-button-list button.btn-default'));
|
||||
})
|
||||
.capture('hover on delete button', (actions, find) => {
|
||||
actions.mouseMove(find('.ascribe-detail-property .ascribe-button-list button.btn-tertiary'));
|
||||
})
|
||||
.capture('hover on info button', (actions, find) => {
|
||||
actions.mouseMove(find('.ascribe-detail-property .ascribe-button-list button.glyphicon-question-sign'));
|
||||
})
|
||||
.capture('expand info text', (actions, find) => {
|
||||
actions.click(find('.ascribe-detail-property .ascribe-button-list button.glyphicon-question-sign'));
|
||||
});
|
||||
actions.click(find('.ascribe-detail-property .ascribe-button-list button.ascribe-action-button-email'));
|
||||
});
|
||||
|
||||
// Wait for transition
|
||||
actions.wait(1000);
|
||||
});
|
||||
gemini.suite('Action form modal', (actionFormModalSuite) => {
|
||||
actionFormModalSuite
|
||||
.setUrl(editionUrl)
|
||||
.setCaptureElements('.modal-dialog')
|
||||
.capture('open email form', (actions, find) => {
|
||||
// Add class names to make the action buttons easier to select
|
||||
// eslint-disable-next-line prefer-arrow-callback
|
||||
actions.executeJS(function addButtonTypeAsClass(window) {
|
||||
/* 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) {
|
||||
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'));
|
||||
|
||||
// Wait for transition
|
||||
actions.wait(1000);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Suite just to log out after suites have run
|
||||
@ -131,6 +147,7 @@ gemini.suite('Work detail', (suite) => {
|
||||
.setUrl('/logout')
|
||||
.ignoreElements('.ascribe-body')
|
||||
.before((actions) => {
|
||||
console.log('before log out');
|
||||
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
|
||||
})
|
||||
.capture('logout', (actions) => {
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gemini = require('gemini');
|
||||
const environment = require('../../environment');
|
||||
const TIMEOUTS = environment.TIMEOUTS;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gemini = require('gemini');
|
||||
const environment = require('../../environment');
|
||||
const TIMEOUTS = environment.TIMEOUTS;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gemini = require('gemini');
|
||||
const environment = require('../../environment');
|
||||
const MAIN_USER = environment.MAIN_USER;
|
||||
const TIMEOUTS = environment.TIMEOUTS;
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gemini = require('gemini');
|
||||
const environment = require('../../environment');
|
||||
const TIMEOUTS = environment.TIMEOUTS;
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
const gemini = require('gemini');
|
||||
const environment = require('../../environment');
|
||||
const MAIN_USER = environment.MAIN_USER;
|
||||
const TIMEOUTS = environment.TIMEOUTS;
|
||||
|
Loading…
Reference in New Issue
Block a user