summaryrefslogtreecommitdiff
path: root/cypress/e2e
diff options
context:
space:
mode:
Diffstat (limited to 'cypress/e2e')
-rw-r--r--cypress/e2e/event.cy.ts24
-rw-r--r--cypress/e2e/group.cy.ts10
-rw-r--r--cypress/e2e/magicLink.cy.ts14
-rw-r--r--cypress/e2e/publicEvent.cy.ts75
-rw-r--r--cypress/e2e/publicGroup.cy.ts28
5 files changed, 120 insertions, 31 deletions
diff --git a/cypress/e2e/event.cy.ts b/cypress/e2e/event.cy.ts
index 8870164..c49c518 100644
--- a/cypress/e2e/event.cy.ts
+++ b/cypress/e2e/event.cy.ts
@@ -1,19 +1,4 @@
-const eventData = {
- eventName: "Your Event Name",
- eventLocation: "Event Location",
- timezone: "America/New York",
- eventDescription: "Event Description",
- eventURL: "https://example.com",
- hostName: "Your Name",
- creatorEmail: "test@example.com",
- eventGroupCheckbox: false,
- interactionCheckbox: true,
- joinCheckbox: true,
- maxAttendeesCheckbox: true,
- maxAttendees: 10,
- eventStart: "2030-01-01T00:00",
- eventEnd: "2030-01-01T01:00",
-};
+import eventData from "../fixtures/eventData.json";
describe("Events", () => {
beforeEach(() => {
@@ -37,13 +22,6 @@ describe("Events", () => {
cy.get("#hostName").type(eventData.hostName);
cy.get("#creatorEmail").type(eventData.creatorEmail);
- // Check checkboxes based on eventData
- if (eventData.eventGroupCheckbox) {
- cy.get("#eventGroupCheckbox").check();
- cy.get("#eventGroupID").type(eventData.eventGroupID);
- cy.get("#eventGroupEditToken").type(eventData.eventGroupEditToken);
- }
-
if (eventData.interactionCheckbox) {
cy.get("#interactionCheckbox").check();
}
diff --git a/cypress/e2e/group.cy.ts b/cypress/e2e/group.cy.ts
index 279cb6c..69c722a 100644
--- a/cypress/e2e/group.cy.ts
+++ b/cypress/e2e/group.cy.ts
@@ -1,14 +1,8 @@
-const groupData = {
- eventGroupName: "Test Group",
- eventGroupDescription: "Test Group Description",
- eventGroupURL: "https://example.com",
- hostName: "Test Host",
- creatorEmail: "test@example.com",
-};
+import groupData from "../fixtures/groupData.json";
describe("Groups", () => {
beforeEach(() => {
- cy.createGroup(groupData);
+ cy.createGroup(groupData, false);
});
it("creates a new group", function () {
cy.get("#eventGroupName").should("have.text", groupData.eventGroupName);
diff --git a/cypress/e2e/magicLink.cy.ts b/cypress/e2e/magicLink.cy.ts
new file mode 100644
index 0000000..5540415
--- /dev/null
+++ b/cypress/e2e/magicLink.cy.ts
@@ -0,0 +1,14 @@
+describe("Restricted Event Creation", () => {
+ it("should redirect to the magic link form", () => {
+ cy.setCookie(
+ "cypressConfigOverride",
+ JSON.stringify({
+ general: {
+ creator_email_addresses: ["test@test.com"],
+ },
+ }),
+ );
+ cy.visit("/new");
+ cy.get("h2").should("contain", "Request a link to create a new event");
+ });
+});
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);
+ });
+});
diff --git a/cypress/e2e/publicGroup.cy.ts b/cypress/e2e/publicGroup.cy.ts
new file mode 100644
index 0000000..4536195
--- /dev/null
+++ b/cypress/e2e/publicGroup.cy.ts
@@ -0,0 +1,28 @@
+import groupData from "../fixtures/groupData.json";
+
+describe("Groups", () => {
+ beforeEach(() => {
+ cy.setCookie(
+ "cypressConfigOverride",
+ JSON.stringify({
+ general: {
+ show_public_event_list: true,
+ },
+ }),
+ );
+ cy.createGroup(groupData, true);
+ });
+ it("should be visible in the public group list", function () {
+ cy.setCookie(
+ "cypressConfigOverride",
+ JSON.stringify({
+ general: {
+ show_public_event_list: true,
+ },
+ }),
+ );
+ cy.visit("/");
+ cy.get("#groupsTab").click();
+ cy.get("#eventGroups").should("contain", groupData.eventGroupName);
+ });
+});