e2e - debug / slomo fix (#105554)

e2e - slomo fix
pull/105685/head
Scott Lepper 1 week ago committed by GitHub
parent b1c1d080e2
commit 902073ead7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 23
      e2e/cypress/support/e2e.js
  2. 2
      e2e/run-suite

@ -7,9 +7,23 @@ Cypress.Screenshot.defaults({
const COMMAND_DELAY = 1000;
function delay(ms) {
let now = Date.now();
const end = now + ms;
do {
now = Date.now();
} while (now < end);
}
if (Cypress.env('SLOWMO')) {
const commandsToModify = ['clear', 'click', 'contains', 'reload', 'then', 'trigger', 'type', 'visit'];
Cypress.Commands.overwriteQuery('contains', function (contains, filter, text, userOptions = {}) {
delay(COMMAND_DELAY);
const call = contains.bind(this);
return call(filter, text, userOptions);
});
const commandsToModify = ['clear', 'click', 'reload', 'then', 'trigger', 'type', 'visit'];
commandsToModify.forEach((command) => {
// @ts-ignore -- https://github.com/cypress-io/cypress/issues/7807
Cypress.Commands.overwrite(command, (originalFn, ...args) => {
@ -65,3 +79,10 @@ beforeEach(() => {
cy.setLocalStorage('grafana.featureToggles', toggles.join(','));
}
});
afterEach(() => {
// in slowmo mode, wait to see the last command
if (Cypress.env('SLOWMO')) {
cy.wait(COMMAND_DELAY);
}
});

@ -164,6 +164,8 @@ case "$1" in
;;
"dev")
echo "Dev mode"
# remove comment to run in slomo ( demo mode )
# env[SLOWMO]=1
CMD="cypress open"
enterpriseSuite=$(basename "${args[2]}")
;;

Loading…
Cancel
Save