summaryrefslogtreecommitdiff
path: root/cypress/e2e/group.cy.ts
blob: 69c722ac1126c77ec7a8fe4fc04200feb87d904e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import groupData from "../fixtures/groupData.json";

describe("Groups", () => {
    beforeEach(() => {
        cy.createGroup(groupData, false);
    });
    it("creates a new group", function () {
        cy.get("#eventGroupName").should("have.text", groupData.eventGroupName);
        cy.get("#eventDescription").should(
            "contain.text",
            groupData.eventGroupDescription,
        );
        cy.get("#eventGroupURL").should(
            "contain.text",
            groupData.eventGroupURL,
        );
        cy.get("#hostName").should("contain.text", groupData.hostName);
        cy.get("#eventGroupID").should("contain.text", this.groupID);
        cy.get("#eventGroupEditToken").should("contain.text", this.editToken);
    });

    it("edits a group", function () {
        cy.get("#editGroup").click();

        cy.get("#editEventGroupForm #eventGroupName").focus().clear();
        cy.get("#editEventGroupForm #eventGroupDescription").focus().clear();
        cy.get("#editEventGroupForm #eventGroupURL").focus().clear();
        cy.get("#editEventGroupForm #eventGroupHostName").focus().clear();
        cy.get("#editEventGroupForm #eventGroupCreatorEmail").focus().clear();

        cy.get("#editEventGroupForm #eventGroupName").type("Edited Group Name");
        cy.get("#editEventGroupForm #eventGroupDescription").type(
            "Edited Group Description",
        );
        cy.get("#editEventGroupForm #eventGroupURL").type(
            "https://edited.example.com",
        );
        cy.get("#editEventGroupForm #eventGroupHostName").type("Edited Name");
        cy.get("#editEventGroupForm #eventGroupCreatorEmail").type(
            "edited@example.com",
        );

        // Submit the form
        cy.get("#editEventGroupForm").submit();

        // Wait for the modal to not be visible
        cy.get("#editModal").should("not.be.visible");

        // Check that all the data is correct
        cy.get("#eventGroupName").should("have.text", "Edited Group Name");
        cy.get("#eventDescription").should(
            "contain.text",
            "Edited Group Description",
        );
        cy.get("#eventGroupURL").should(
            "contain.text",
            "https://edited.example.com",
        );
        cy.get("#hostName").should("contain.text", "Edited Name");
    });
});