todos-contra-el-fuego-web/cucumber/features/steps_definitions/hooks.js
2018-05-23 06:29:31 +02:00

50 lines
1.7 KiB
JavaScript

/* global client */
(function () {
module.exports = function () {
this.Before(() => {
// global.expect = require('@xolvio/jasmine-expect').expect;
// https://github.com/webdriverio/webdriverio/issues/1145
if (!this.initMyCmds) {
client.addCommand('waitForClickable', function elementClickable(selector, timeout) {
this.waitForVisible(selector, timeout);
this.waitForEnabled(selector, timeout);
});
client.addCommand('waitUntilText', function waitUntilText(selector, text, ms) {
ms = ms || 5000;
this.waitForVisible(selector);
const self = this;
this.waitUntil(() => self.getText(selector).includes(text), ms, `expected text in ${selector} be different after ${ms / 1000}s. Obtained: '${self.getText(selector)}' expected: '${text}'`);
});
this.initMyCmds = true;
}
client.windowHandleSize({ width: 1500, height: 1000 });
// server.call('fixtures/reset');
// server.call('emailStub/reset');
// server.call('emailStub/stub');
// server.call('fixtures/stubCloudFrontClient');
// go to the page first so we have access to the Meteor object
// console.log('Before all tests...');
// client.url(process.env.ROOT_URL);
/* client.executeAsync(function (done) {
* var customer = {
* id: 'randomId',
* email: 'me@example.com',
* subscriptions: {
* data: [{
* current_period_start: 1436716844,
* current_period_end: 1436716844
* }]
* }
* }; */
// this call will stub stripe both on the client and server
// Meteor.call('stripeStub/stub', customer, done);
});
};
}());