WIP: Jest und Cypress Test
This commit is contained in:
@@ -1,46 +0,0 @@
|
||||
describe("Map Initial Load Test", () => {
|
||||
it("should load the map with the correct center and zoom", () => {
|
||||
// Besuche die Seite, auf der die Karte angezeigt wird
|
||||
cy.visit("http://192.168.10.167:3000/?m=12&u=485");
|
||||
|
||||
// Überprüfe, ob das Kartenelement existiert
|
||||
cy.get("#map").should("be.visible");
|
||||
|
||||
// Überprüfe, ob die Karte das korrekte Zentrum und den korrekten Zoom hat
|
||||
cy.window().then((win) => {
|
||||
const map = win.L.map;
|
||||
const center = map.getCenter();
|
||||
const zoom = map.getZoom();
|
||||
|
||||
expect(center.lat).to.be.closeTo(53.111111, 0.0001);
|
||||
expect(center.lng).to.be.closeTo(8.4625, 0.0001);
|
||||
expect(zoom).to.eq(12);
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("Map Context Menu Test", () => {
|
||||
it("should show context menu on right click", () => {
|
||||
cy.visit("http://192.168.10.167:3000/?m=12&u=485");
|
||||
|
||||
// Rechte Maustaste auf eine Koordinate in der Karte klicken
|
||||
cy.get("#map").rightclick(400, 300); // Rechtsklick auf eine Position in der Karte
|
||||
|
||||
// Überprüfen, ob das Kontextmenü angezeigt wird
|
||||
cy.contains("Station öffnen (Tab)").should("be.visible");
|
||||
});
|
||||
|
||||
it("should open a new tab when context menu option is clicked", () => {
|
||||
cy.visit("http://192.168.10.167:3000/?m=12&u=485");
|
||||
|
||||
cy.get("#map").rightclick(400, 300);
|
||||
|
||||
cy.contains("Station öffnen (Tab)").click();
|
||||
|
||||
// Testen, ob ein neuer Tab mit dem richtigen Link geöffnet wird
|
||||
cy.window().then((win) => {
|
||||
cy.stub(win, "open").as("windowOpen");
|
||||
});
|
||||
|
||||
cy.get("@windowOpen").should("be.calledWith", "https://example.com"); // Ersetze dies durch die tatsächliche URL
|
||||
});
|
||||
});
|
||||
26
cypress/e2e/tk-components.cy.js
Normal file
26
cypress/e2e/tk-components.cy.js
Normal file
@@ -0,0 +1,26 @@
|
||||
describe("TK-Komponenten", () => {
|
||||
beforeEach(() => {
|
||||
cy.visit("http://10.10.0.70:3000/?m=12&u=484");
|
||||
});
|
||||
|
||||
it("should toggle TK-Komponenten visibility", () => {
|
||||
// Sicherstellen, dass die Checkbox vorhanden und sichtbar ist
|
||||
cy.get("input[type='checkbox'][id='system-10']").should("exist").and("be.visible");
|
||||
|
||||
// Deaktivieren der Checkbox und sicherstellen, dass die Marker verschwinden
|
||||
cy.get("input[type='checkbox'][id='system-10']")
|
||||
.uncheck({ force: true })
|
||||
.then(() => {
|
||||
// Überprüfen, ob keine Marker mehr vorhanden sind
|
||||
cy.get(".leaflet-marker-icon", { timeout: 10000 }).should("not.exist");
|
||||
});
|
||||
|
||||
// Aktivieren der Checkbox und sicherstellen, dass die Marker wieder sichtbar werden
|
||||
cy.get("input[type='checkbox'][id='system-10']")
|
||||
.check({ force: true })
|
||||
.then(() => {
|
||||
// Überprüfen, ob die Marker sichtbar sind
|
||||
cy.get(".leaflet-marker-icon", { timeout: 10000 }).should("be.visible");
|
||||
});
|
||||
});
|
||||
});
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 672 KiB |
Reference in New Issue
Block a user