2021-07-12 04:46:50 -05:00
|
|
|
/* global require cy Cypress Promise */
|
2020-03-13 07:47:15 -05:00
|
|
|
|
|
|
|
require('cypress-failed-log');
|
2020-12-28 06:28:59 -06:00
|
|
|
require('cypress-wait-until');
|
|
|
|
require('cypress-file-upload');
|
2021-07-12 04:46:50 -05:00
|
|
|
require('cypress-iframe');
|
2020-09-14 08:53:51 -05:00
|
|
|
|
|
|
|
if (Cypress.env('INTEGRATION') === 'php-proxy') {
|
|
|
|
Cypress.Server.defaults({
|
2020-09-17 07:55:03 -05:00
|
|
|
ignore: function() {
|
2020-09-14 08:53:51 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2020-10-19 05:59:50 -05:00
|
|
|
|
|
|
|
var COMMAND_DELAY = 1000;
|
|
|
|
|
|
|
|
if (Cypress.browser.isHeaded) {
|
|
|
|
Cypress.Commands.overwrite('get', function(originalFn, selector, options) {
|
|
|
|
return new Promise(function(resolve) {
|
|
|
|
setTimeout(function() {
|
|
|
|
resolve(originalFn(selector, options));
|
|
|
|
}, COMMAND_DELAY);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
Cypress.Commands.overwrite('contains', function(originalFn, selector, content, options) {
|
|
|
|
return new Promise(function(resolve) {
|
|
|
|
setTimeout(function() {
|
|
|
|
resolve(originalFn(selector, content, options));
|
|
|
|
}, COMMAND_DELAY);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
2021-06-26 10:54:01 -05:00
|
|
|
|
|
|
|
// reduce poll interval when waiting.
|
|
|
|
Cypress.Commands.overwrite('waitUntil', function(originalFn, subject, checkFunction, originalOptions) {
|
|
|
|
var options = originalOptions;
|
|
|
|
if (!options)
|
|
|
|
options = {};
|
|
|
|
if (!options.interval)
|
|
|
|
options.interval = 10; // ms
|
|
|
|
return originalFn(subject, checkFunction, options);
|
|
|
|
});
|
2021-07-12 04:46:50 -05:00
|
|
|
|
|
|
|
Cypress.Commands.add('customGet', function(selector, frameId, options) {
|
|
|
|
if (typeof frameId === 'undefined') {
|
|
|
|
return cy.get(selector, options);
|
|
|
|
} else {
|
|
|
|
return cy.iframe(frameId).find(selector,options);
|
|
|
|
}
|
|
|
|
});
|