diff options
| author | Raphael Kabo <raphaelkabo@hey.com> | 2023-10-10 15:50:33 +0100 | 
|---|---|---|
| committer | Raphael Kabo <raphaelkabo@hey.com> | 2023-10-10 15:50:33 +0100 | 
| commit | 61a0c53b7b82bc875c855358df2c81c91e7e5a94 (patch) | |
| tree | b0741471592cad5a760173a25ed39564e3443ee6 /cypress/support | |
| parent | 2f4ffd5d86aa695afaffed9c6780f695d0bfde9d (diff) | |
Update Cypress tests
Diffstat (limited to 'cypress/support')
| -rw-r--r-- | cypress/support/commands.ts | 37 | 
1 files changed, 37 insertions, 0 deletions
diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index 95857ae..6fc8768 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -35,3 +35,40 @@  //     }  //   }  // } + +declare namespace Cypress { +    interface Chainable<Subject> { +        createGroup(groupData: { +            eventGroupName: string; +            eventGroupDescription: string; +            eventGroupURL: string; +            hostName: string; +            creatorEmail: string; +        }): Chainable<Subject>; +    } +} + +Cypress.Commands.add("createGroup", (groupData) => { +    cy.visit("/new"); +    cy.get("#showNewEventGroupFormButton").click(); + +    // Fill in the form +    cy.get("#eventGroupName").type(groupData.eventGroupName); +    cy.get("#eventGroupDescription").type(groupData.eventGroupDescription); +    cy.get("#eventGroupURL").type(groupData.eventGroupURL); +    cy.get("#eventGroupHostName").type(groupData.hostName); +    cy.get("#eventGroupCreatorEmail").type(groupData.creatorEmail); + +    // Submit the form +    cy.get("#newEventGroupForm").submit(); + +    // Wait for the new page to load +    cy.url().should("not.include", "/new"); + +    // Get the new group ID from the URL +    cy.url().then((url) => { +        const [groupID, editToken] = url.split("/").pop().split("?"); +        cy.wrap(groupID).as("groupID"); +        cy.wrap(editToken.slice(2)).as("editToken"); +    }); +});  | 
