Cypress Umgebung ok

This commit is contained in:
Ismail Ali
2025-01-26 20:47:56 +01:00
parent d9f2bc3465
commit b2d57fdaff
15 changed files with 6268 additions and 32 deletions

View File

@@ -0,0 +1,46 @@
describe('Kue705FO Integration Tests', () => {
beforeEach(() => {
// Besuche die Seite, auf der die Komponente gerendert wird
//cy.visit('/path-to-your-component'); // Passe den Pfad an deine App an
cy.visit('http://localhost:3000/kabelueberwachung');
});
it('should render the component with default props', () => {
// Überprüfe, ob der Modulname und die Slotnummer angezeigt werden
cy.contains('KÜ705-FO').should('be.visible');
cy.contains('Modul 1').should('be.visible'); // Beispiel für den Modulnamen
});
it('should update display when TDR button is clicked', () => {
// Klicke auf den TDR-Button
cy.contains('TDR').click();
// Überprüfe, ob der Text aktualisiert wurde
cy.contains('Entfernung [Km]').should('be.visible');
});
it('should switch back to Schleife display', () => {
// Klicke auf TDR, dann zurück zu Schleife
cy.contains('TDR').click();
cy.contains('Schleife').click();
// Überprüfe, ob der Text aktualisiert wurde
cy.contains('Schleifenwiderstand [kOhm]').should('be.visible');
});
it('should disable TDR button when tdrActive is 0', () => {
// Dies erfordert eine benutzerdefinierte Backend-Konfiguration oder Redux-Manipulation
cy.contains('TDR').should('be.disabled');
});
it('should open and close the settings modal', () => {
// Öffne das Modal
cy.contains('⚙').click();
cy.contains('KUE Einstellung - Slot 1').should('be.visible');
// Schließe das Modal
cy.contains('×').click();
cy.contains('KUE Einstellung - Slot 1').should('not.exist');
});
});

View File

@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

17
cypress/support/e2e.ts Normal file
View File

@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// 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
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands'