summaryrefslogtreecommitdiff
path: root/cypress/e2e/publicEvent.cy.ts
diff options
context:
space:
mode:
authorRaphael Kabo <raphaelkabo@hey.com>2024-02-26 12:10:32 +0000
committerRaphael Kabo <raphaelkabo@hey.com>2024-02-26 12:10:32 +0000
commit9e11c3667e027f805fca37b5dffe9d8a52303a14 (patch)
tree58a2369cde40717bb6b34273566f3e31ab8c9932 /cypress/e2e/publicEvent.cy.ts
parentc93fd6e2d455ea4208f9e5ca6bfbd1c0e9fd1ad9 (diff)
testing: E2E tests for public and restricted events
Diffstat (limited to 'cypress/e2e/publicEvent.cy.ts')
-rw-r--r--cypress/e2e/publicEvent.cy.ts75
1 files changed, 75 insertions, 0 deletions
diff --git a/cypress/e2e/publicEvent.cy.ts b/cypress/e2e/publicEvent.cy.ts
new file mode 100644
index 0000000..f110c02
--- /dev/null
+++ b/cypress/e2e/publicEvent.cy.ts
@@ -0,0 +1,75 @@
+import eventData from "../fixtures/eventData.json";
+
+describe("Events", () => {
+ beforeEach(() => {
+ cy.setCookie(
+ "cypressConfigOverride",
+ JSON.stringify({
+ general: {
+ show_public_event_list: true,
+ },
+ }),
+ );
+ cy.visit("/new");
+ cy.get("#showNewEventFormButton").click();
+
+ cy.get("#eventName").type(eventData.eventName);
+ cy.get("#eventLocation").type(eventData.eventLocation);
+ // These are datetime-local inputs
+ cy.get("#eventStart").type(eventData.eventStart);
+ cy.get("#eventEnd").type(eventData.eventEnd);
+
+ cy.get("select#timezone + span.select2").click();
+ cy.get(".select2-results__option")
+ .contains(eventData.timezone)
+ .click({ force: true });
+
+ cy.get("#eventDescription").type(eventData.eventDescription);
+ cy.get("#eventURL").type(eventData.eventURL);
+
+ cy.get("#hostName").type(eventData.hostName);
+ cy.get("#creatorEmail").type(eventData.creatorEmail);
+
+ // Check checkboxes based on eventData
+ if (eventData.interactionCheckbox) {
+ cy.get("#interactionCheckbox").check();
+ }
+
+ if (eventData.joinCheckbox) {
+ cy.get("#joinCheckbox").check();
+ }
+
+ if (eventData.maxAttendeesCheckbox) {
+ cy.get("#maxAttendeesCheckbox").check();
+ cy.get("#maxAttendees").type(eventData.maxAttendees.toString());
+ }
+
+ cy.get("#publicEventCheckbox").check();
+
+ // Submit the form
+ cy.get("#newEventFormSubmit").click();
+
+ // Wait for the new page to load
+ cy.url({ timeout: 10000 }).should("not.include", "/new");
+
+ // Get the new event ID from the URL
+ cy.url().then((url) => {
+ const [eventID, editToken] = url.split("/").pop().split("?");
+ cy.wrap(eventID).as("eventID");
+ cy.wrap(editToken).as("editToken");
+ });
+ });
+
+ it("should be visible in the public event list", function () {
+ cy.setCookie(
+ "cypressConfigOverride",
+ JSON.stringify({
+ general: {
+ show_public_event_list: true,
+ },
+ }),
+ );
+ cy.visit("/");
+ cy.get("#upcomingEvents").should("contain", eventData.eventName);
+ });
+});