cypress update v13.17.0

This commit is contained in:
ISA
2025-01-02 09:46:12 +01:00
parent e6dff1dcf8
commit 60d9c9a9ae
22 changed files with 49 additions and 20 deletions

View File

@@ -1,27 +1,56 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
// Diese Datei wird automatisch geladen, bevor Tests ausgeführt werden.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
// Dies ist ein guter Platz für globale Konfigurationen
// und Änderungen, die Cypress beeinflussen.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// Weitere Infos: https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
// Importiere zusätzliche Befehle
import "./commands";
// Alternatively you can use CommonJS syntax:
// Alternativ: CommonJS-Syntax verwenden
// require('./commands')
// Verstecke unnötige Logs für XHR- und Fetch-Anfragen
const app = window.top;
if (!app.document.head.querySelector("[data-hide-command-log-request]")) {
const style = app.document.createElement("style");
style.innerHTML = ".command-name-request, .command-name-xhr { display: none }";
style.innerHTML = `
.command-name-request, .command-name-xhr {
display: none; /* Verstecke Fetch- und XHR-Logs */
}
.runnable-pass .collapsible-header {
display: none; /* Verstecke den Header erfolgreicher Tests */
}
`;
style.setAttribute("data-hide-command-log-request", "");
app.document.head.appendChild(style);
}
// Globale Ereignisse für Cypress konfigurieren
Cypress.on("test:after:run", (test, runnable) => {
// Minimiert die Logs für erfolgreiche Tests
if (test.state === "passed") {
runnable._testConfigBody = null; // Löscht den Test Body
}
});
// Schließe automatisch erfolgreiche Tests in der GUI
Cypress.on("log:added", (log) => {
if (log.state === "passed") {
log.displayName = ""; // Versteckt Log-Details für erfolgreiche Schritte
}
});
// Screenshot nach jedem fehlgeschlagenen Test
Cypress.on("fail", (error, runnable) => {
cy.screenshot(`error-${runnable.title}`); // Screenshot für Fehler erstellen
throw error; // Fehler weitergeben
});
// Logge die Dauer jedes Tests
Cypress.on("test:after:run", (test) => {
cy.log(`Test "${test.title}" abgeschlossen in ${test.duration} ms`);
});