From 6c06956e9a51b2cd621a35bf7f3c1cd1e40a5fef Mon Sep 17 00:00:00 2001 From: Patrick Burns Date: Sun, 7 Apr 2024 20:29:50 -0500 Subject: [PATCH] add station logbook create tests --- cypress/e2e/5-station-logbook.cy.js | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cypress/e2e/5-station-logbook.cy.js diff --git a/cypress/e2e/5-station-logbook.cy.js b/cypress/e2e/5-station-logbook.cy.js new file mode 100644 index 00000000..e0c3b735 --- /dev/null +++ b/cypress/e2e/5-station-logbook.cy.js @@ -0,0 +1,44 @@ +describe("Create station logbook", () => { + beforeEach(() => { + cy.login(); + }); + + it("should load an empty list of station locations", () => { + cy.visit("/index.php/logbooks"); + + // Check that the table is not present + cy.get("#station_logbooks_table").should("not.exist"); + }); + + it("should have a button to create a new station location", () => { + cy.visit("/index.php/logbooks"); + + // Check that the button is present + cy.get("a").contains("Create Station Logbook").should("exist").click(); + + cy.url().should("include", "/logbooks/create"); + }); + + it("should create a new station location", () => { + cy.visit("/index.php/logbooks/create"); + + // Define the station location name + const stationLogbookName = "Home QTH"; + + // Type the station location name into the input field + cy.get('input[name="stationLogbook_Name"]').type(stationLogbookName); + + // Click the save button + cy.get('button[type="submit"]') + .contains("Create Station Logbook") + .click(); + + // Check if the station location was created successfully + cy.url().should("include", "/logbooks"); + + // // Check if the station location is present in the table + cy.get("#station_logbooks_table") + .contains(stationLogbookName) + .should("exist"); + }); +});