libreoffice-online/cypress_test/support/index.js
Michael Meeks d04547da1b cypress: reduce interval in waitUntil to speedup tests.
165s to 145s for impress/slide_properties_spec.js

Change-Id: I3dcce9a0d0c63123a0cde5cb89c074e6a08b8824
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2021-06-29 17:12:01 +01:00

43 lines
1.1 KiB
JavaScript

/* global require Cypress Promise */
require('cypress-failed-log');
require('cypress-wait-until');
require('cypress-file-upload');
if (Cypress.env('INTEGRATION') === 'php-proxy') {
Cypress.Server.defaults({
ignore: function() {
return true;
}
});
}
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);
});
});
}
// 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);
});