1
0
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:
Brett Sun 2016-06-03 11:38:42 +02:00
parent c13a24a107
commit 319261f15e
11 changed files with 256 additions and 229 deletions

View File

@ -45,10 +45,9 @@
"chai-as-promised": "^5.1.0", "chai-as-promised": "^5.1.0",
"colors": "^1.1.2", "colors": "^1.1.2",
"dotenv": "^1.2.0", "dotenv": "^1.2.0",
"gemini": "^2.1.0", "gemini": "^4.3.0",
"jest-cli": "^0.4.0", "jest-cli": "^0.4.0",
"mocha": "^2.3.4", "mocha": "^2.3.4",
"phantomjs2": "^2.0.2",
"rimraf": "^2.5.2", "rimraf": "^2.5.2",
"sauce-connect-launcher": "^0.13.0", "sauce-connect-launcher": "^0.13.0",
"wd": "^0.4.0" "wd": "^0.4.0"

View File

@ -1,4 +1,7 @@
{ {
"globals": {
"gemini": true
},
"rules": { "rules": {
"max-len": [2, { "code": 125 }] "max-len": [2, { "code": 125 }]
} }

View File

@ -23,30 +23,41 @@ Then, install [PhantomJS2](https://www.npmjs.com/package/phantomjs2):
```bash ```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) # 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 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
# If using OSX, you may have to install upx and decompress the binary downloaded by npm manually: # If using OSX, you may have to install upx and decompress the binary downloaded by npm manually:
brew install upx 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 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 Running Tests
============= =============
Run Spool and Onion (on localhost.com:3000).
Run PhantomJS: Run PhantomJS:
```bash ```bash
npm run vi-phantom 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 ```bash
npm run vi-test npm run vi-test
@ -61,8 +72,8 @@ npm run vi-test:whitelabel
npm run vi-test:cyland 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 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
no regressions first!), use there are no regressions first!), use:
```bash ```bash
npm run vi-update npm run vi-update

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const gemini = require('gemini');
const environment = require('../environment'); const environment = require('../environment');
const MAIN_USER = environment.MAIN_USER; const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS; 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.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)', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.LONG);
}); });
}); });
gemini.suite('Header-desktop', (headerSuite) => { gemini.suite('Authenticated', (authenticatedSuite) => {
headerSuite gemini.suite('Header-desktop', (headerSuite) => {
.setCaptureElements('nav.navbar .container') headerSuite
// Ignore Cyland's logo as it's a gif .setCaptureElements('nav.navbar .container')
.ignoreElements('.client--cyland img.img-brand') // Ignore Cyland's logo as it's a gif
.skip(/Mobile/) .ignoreElements('.client--cyland img.img-brand')
.before((actions) => { .skip(/Mobile/)
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL); .before((actions) => {
}) actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.LONG);
.capture('desktop header'); actions.waitForElementToShow('#header-notification-dropdown', TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
})
.capture('desktop header');
gemini.suite('User dropdown', (headerUserSuite) => { gemini.suite('User dropdown', (headerUserSuite) => {
headerUserSuite headerUserSuite
.setCaptureElements('#nav-route-user-dropdown ~ .dropdown-menu') .setCaptureElements('#nav-route-user-dropdown ~ .dropdown-menu')
.capture('expanded user dropdown', (actions, find) => { .capture('expanded user dropdown', (actions, find) => {
actions.click(find('#nav-route-user-dropdown')); 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) => { // Test for the collapsed header in mobile
headerNotificationSuite gemini.suite('Header-mobile', (headerMobileSuite) => {
.setCaptureElements('#header-notification-dropdown ~ .dropdown-menu') 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) => { .capture('expanded notifications dropdown', (actions, find) => {
actions.click(find('#header-notification-dropdown')); actions.click(find('#header-notification-dropdown'));
}); });
}); });
});
// Test for the collapsed header in mobile gemini.suite('Collection', (collectionSuite) => {
gemini.suite('Header-mobile', (headerMobileSuite) => { collectionSuite
headerMobileSuite .setCaptureElements('.ascribe-accordion-list')
.setCaptureElements('nav.navbar .container') .before((actions) => {
// Ignore Cyland's logo as it's a gif actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
.ignoreElements('.client--cyland img.img-brand') // Wait for the images to load
.skip(/Desktop/) // FIXME: unfortuntately gemini doesn't support ignoring multiple elements from a single selector
.before((actions) => { // so we're forced to wait and hope that the images will all finish loading after 5s.
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL); // We could also change the thumbnails with JS, but setting up a test user is probably easier.
}) actions.wait(TIMEOUTS.NORMAL);
.capture('mobile header') })
.capture('expanded mobile header', (actions, find) => { .capture('collection')
actions.click(find('nav.navbar .navbar-toggle')); .capture('expanded edition in collection', (actions, find) => {
// 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) => {
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.NORMAL); actions.waitForElementToShow('.ascribe-accordion-list-item-table', TIMEOUTS.LONG);
actions.click('.ascribe-table thead tr input[type="checkbox"]');
actions.waitForElementToShow('.piece-list-bulk-modal');
}); });
});
});
gemini.suite('PieceListToolbar', (pieceListToolbarSuite) => { gemini.suite('Collection placeholder', (collectionPlaceholderSuite) => {
pieceListToolbarSuite collectionPlaceholderSuite
.setCaptureElements('.ascribe-piece-list-toolbar') .setCaptureElements('.ascribe-accordion-list-placeholder')
.capture('piece list toolbar') .capture('collection empty search', (actions, find) => {
.capture('piece list toolbar search filled', (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"]'), 'search text'); actions.waitForElementToShow('.ascribe-accordion-list-placeholder', TIMEOUTS.NORMAL);
actions.waitForElementToShow('.ascribe-piece-list-toolbar .search-bar .icon-ascribe-search', });
TIMEOUTS.NORMAL);
}); });
gemini.suite('Order widget dropdown', (pieceListToolbarOrderWidgetSuite) => { gemini.suite('PieceListBulkModal', (pieceListBulkModalSuite) => {
pieceListToolbarOrderWidgetSuite pieceListBulkModalSuite
.setCaptureElements('#ascribe-piece-list-toolbar-order-widget-dropdown', .setCaptureElements('.piece-list-bulk-modal')
'#ascribe-piece-list-toolbar-order-widget-dropdown ~ .dropdown-menu') .capture('items selected', (actions, find) => {
.capture('expanded order dropdown', (actions, find) => { actions.click(find('.ascribe-accordion-list-item .ascribe-accordion-list-item-edition-widget'));
actions.click(find('#ascribe-piece-list-toolbar-order-widget-dropdown')); // 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.click('.ascribe-table thead tr input[type="checkbox"]');
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL); actions.waitForElementToShow('.piece-list-bulk-modal');
}); });
});
}); });
gemini.suite('Filter widget dropdown', (pieceListToolbarFilterWidgetSuite) => { gemini.suite('PieceListToolbar', (pieceListToolbarSuite) => {
pieceListToolbarFilterWidgetSuite pieceListToolbarSuite
.setCaptureElements('#ascribe-piece-list-toolbar-filter-widget-dropdown', .setCaptureElements('.ascribe-piece-list-toolbar')
'#ascribe-piece-list-toolbar-filter-widget-dropdown ~ .dropdown-menu') .capture('piece list toolbar')
.capture('expanded filter dropdown', (actions, find) => { .capture('piece list toolbar search filled', (actions, find) => {
actions.click(find('#ascribe-piece-list-toolbar-filter-widget-dropdown')); 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',
// Wait as the dropdown screenshot still includes the collection in the background TIMEOUTS.NORMAL);
actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.NORMAL);
}); });
});
});
gemini.suite('Register work', (registerSuite) => { gemini.suite('Order widget dropdown', (pieceListToolbarOrderWidgetSuite) => {
registerSuite pieceListToolbarOrderWidgetSuite
.setUrl('/register_piece') .setCaptureElements('#ascribe-piece-list-toolbar-order-widget-dropdown',
.before((actions) => { '#ascribe-piece-list-toolbar-order-widget-dropdown ~ .dropdown-menu')
// The editions options are only rendered after the whitelabel is fetched, so .capture('expanded order dropdown', (actions, find) => {
// we have to wait for it here actions.click(find('#ascribe-piece-list-toolbar-order-widget-dropdown'));
// 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', // Wait as the dropdown screenshot still includes the collection in the background
TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', 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('Register work hash', (registerHashSuite) => { gemini.suite('Filter widget dropdown', (pieceListToolbarFilterWidgetSuite) => {
registerHashSuite pieceListToolbarFilterWidgetSuite
.setUrl('/register_piece?method=hash') .setCaptureElements('#ascribe-piece-list-toolbar-filter-widget-dropdown',
.capture('register work hash method'); '#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) => { gemini.suite('Register work', (registerSuite) => {
registerUploadSuite registerSuite
.setUrl('/register_piece?method=upload') .setUrl('/register_piece')
.capture('register work upload method'); .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) => { gemini.suite('Register work hash', (registerHashSuite) => {
userSettingsSuite registerHashSuite
.setUrl('/settings') .setUrl('/register_piece?method=hash')
.before((actions) => { .capture('register work hash method');
// This will be called before every nested suite begins unless that suite });
// also defines a `.before()`
actions.waitForElementToShow('.settings-container', TIMEOUTS.NORMAL); gemini.suite('Register work upload', (registerUploadSuite) => {
}) registerUploadSuite
.capture('user settings'); .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 // Suite just to log out after suites have run

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const gemini = require('gemini');
const environment = require('../environment'); const environment = require('../environment');
const MAIN_USER = environment.MAIN_USER; const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS; const TIMEOUTS = environment.TIMEOUTS;

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const gemini = require('gemini');
const environment = require('../environment'); const environment = require('../environment');
const MAIN_USER = environment.MAIN_USER; const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS; 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 * Tests include accessing the piece / edition as the owner or as another user
* (we can just use an anonymous user in this case). * (we can just use an anonymous user in this case).
*/ */
gemini.suite('Work detail', (suite) => { gemini.suite('Basic work detail', (suite) => {
suite suite
.setCaptureElements('.ascribe-body') .setCaptureElements('.ascribe-body')
.before((actions) => { .before((actions) => {
// This will be called before every nested suite begins unless that suite
// 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
@ -51,78 +48,97 @@ gemini.suite('Work detail', (suite) => {
.setUrl(editionUrl) .setUrl(editionUrl)
.capture('basic edition'); .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) => { gemini.suite('Login', (loginSuite) => {
loginSuite loginSuite
.setUrl('/login') .setUrl('/login')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.before((actions) => {
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
})
.capture('logged in', (actions, find) => { .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=email]'), MAIN_USER.email);
actions.sendKeys(find('.ascribe-login-wrapper input[name=password]'), MAIN_USER.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)', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-accordion-list:not(.ascribe-loading-position)', TIMEOUTS.LONG);
}); });
}); });
gemini.suite('Authorized piece', (authorizedPieceSuite) => { gemini.suite('Authenticated', (authenticatedSuite) => {
authorizedPieceSuite authenticatedSuite
.setUrl(pieceUrl) .before((actions) => {
.capture('authorized piece'); // Wait for the social media buttons to appear
}); actions.waitForElementToShow('.ascribe-social-button-list .fb-share-button iframe',
TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
gemini.suite('Authorized edition', (authorizedEditionSuite) => { actions.waitForElementToShow('.ascribe-social-button-list .twitter-share-button',
authorizedEditionSuite TIMEOUTS.SUPER_DUPER_EXTRA_LONG);
.setUrl(editionUrl) actions.waitForElementToShow('.ascribe-media-player', TIMEOUTS.LONG);
.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('Action form modal', (actionFormModalSuite) => { gemini.suite('Authorized piece', (authorizedPieceSuite) => {
actionFormModalSuite console.log('authorized piece');
.setUrl(editionUrl) authorizedPieceSuite
.setCaptureElements('.modal-dialog') .setUrl(pieceUrl)
.capture('open email form', (actions, find) => { .capture('authorized piece');
// Add class names to make the action buttons easier to select });
// eslint-disable-next-line prefer-arrow-callback
actions.executeJS(function addButtonTypeAsClass(window) { gemini.suite('Authorized edition', (authorizedEditionSuite) => {
/* eslint-disable no-var, prefer-template */ authorizedEditionSuite
var actionButtonsSelector = '.ascribe-detail-property .ascribe-button-list button.btn-default'; .setUrl(editionUrl)
var actionButtons = window.document.querySelectorAll(actionButtonsSelector); .capture('authorized edition');
var ii = 0; });
for (; ii < actionButtons.length; ++ii) {
if (actionButtons[ii].textContent) { gemini.suite('Detail action buttons', (detailActionButtonSuite) => {
actionButtons[ii].className += ' ascribe-action-button-' + detailActionButtonSuite
actionButtons[ii].textContent.toLowerCase(); .setUrl(editionUrl)
} .capture('hover on action button', (actions, find) => {
} console.log('hover on action button');
/* eslint-enable no-var */ 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 gemini.suite('Action form modal', (actionFormModalSuite) => {
actions.wait(1000); 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 // Suite just to log out after suites have run
@ -131,6 +147,7 @@ gemini.suite('Work detail', (suite) => {
.setUrl('/logout') .setUrl('/logout')
.ignoreElements('.ascribe-body') .ignoreElements('.ascribe-body')
.before((actions) => { .before((actions) => {
console.log('before log out');
actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL); actions.waitForElementToShow('.ascribe-app', TIMEOUTS.NORMAL);
}) })
.capture('logout', (actions) => { .capture('logout', (actions) => {

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const gemini = require('gemini');
const environment = require('../../environment'); const environment = require('../../environment');
const TIMEOUTS = environment.TIMEOUTS; const TIMEOUTS = environment.TIMEOUTS;

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const gemini = require('gemini');
const environment = require('../../environment'); const environment = require('../../environment');
const TIMEOUTS = environment.TIMEOUTS; const TIMEOUTS = environment.TIMEOUTS;

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const gemini = require('gemini');
const environment = require('../../environment'); const environment = require('../../environment');
const MAIN_USER = environment.MAIN_USER; const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS; const TIMEOUTS = environment.TIMEOUTS;

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const gemini = require('gemini');
const environment = require('../../environment'); const environment = require('../../environment');
const TIMEOUTS = environment.TIMEOUTS; const TIMEOUTS = environment.TIMEOUTS;

View File

@ -1,6 +1,5 @@
'use strict'; 'use strict';
const gemini = require('gemini');
const environment = require('../../environment'); const environment = require('../../environment');
const MAIN_USER = environment.MAIN_USER; const MAIN_USER = environment.MAIN_USER;
const TIMEOUTS = environment.TIMEOUTS; const TIMEOUTS = environment.TIMEOUTS;