diff --git a/TODO.md b/TODO.md index e7c960aab..43f8bc1f2 100644 --- a/TODO.md +++ b/TODO.md @@ -13,7 +13,7 @@ Calendar - [x] Edit page - [x] E2E test form controls (adding/removing date, adding/removing tags) etc. - [ ] E2E test browsing events + event page -- [ ] E2E test adding and editing event +- [x] E2E test adding and editing event - [ ] Add winners page - [ ] Winners on the event info page - [ ] There should be a banner on the list page if you have past tournaments to report diff --git a/app/db/seed.ts b/app/db/seed.ts index b70c3e911..835c0f04d 100644 --- a/app/db/seed.ts +++ b/app/db/seed.ts @@ -17,6 +17,7 @@ const ADMIN_TEST_AVATAR = "e424e1ba50d2019fdc4730d261e56c55"; const NZAP_TEST_DISCORD_ID = "455039198672453645"; const NZAP_TEST_AVATAR = "f809176af93132c3db5f0a5019e96339"; // https://cdn.discordapp.com/avatars/455039198672453645/f809176af93132c3db5f0a5019e96339.webp?size=160 +const NZAP_TEST_ID = 2; const AMOUNT_OF_CALENDAR_EVENTS = 100; @@ -353,7 +354,7 @@ function calendarEvents() { description: faker.lorem.paragraph(), discordInviteCode: faker.lorem.word(), bracketUrl: faker.internet.url(), - authorId: userIds.pop(), + authorId: id === 1 ? NZAP_TEST_ID : userIds.pop(), tags: Math.random() > 0.2 ? tags diff --git a/cypress/e2e/calendar.cy.ts b/cypress/e2e/calendar.cy.ts index e1ad90626..c1236e4e2 100644 --- a/cypress/e2e/calendar.cy.ts +++ b/cypress/e2e/calendar.cy.ts @@ -64,6 +64,17 @@ describe("New calendar event page", () => { cy.getCy("badges-select").select(1); cy.getCy("submit-button").click(); - cy.url().should("include", "101"); // we should have been redirected to the new event's page + cy.url().should("include", "/101"); // we should have been redirected to the new event's page + }); + + it("edits an event", () => { + cy.auth(2); + cy.visit(calendarEditPage(1)); + + cy.getCy("name-input").clear().type("Edited Event"); + + cy.getCy("submit-button").click(); + cy.url().should("include", "/1"); // we should have been redirected to the new event's page + cy.contains("Edited Event"); }); });