adds a badge owner sending a notification
Renders//badges/badges/:id/badges/:id/edit
Setup
Arrange
- Create badge display name “4v4 Sundaes” manager ids N-ZAP → badge
const badge = await factories.BadgeFactory.create( { displayName: BADGE_NAME }, { managerIds: [NZAP_TEST_ID] }, );
the popover links onwards only once its peek list is full
Repeatfor (let seasonNth = 1; seasonNth < NOTIFICATIONS.PEEK_COUNT; seasonNth++)for (let seasonNth = 1; seasonNth < NOTIFICATIONS.PEEK_COUNT; seasonNth++) { await factories.NotificationFactory.create({ notification: { type: "SEASON_STARTED", meta: { seasonNth } }, users: [{ userId: ADMIN_ID, seen: 1 }], }); }
- Create notification notification type “SEASON_STARTED” meta
seasonNthusers user Sendou seen 1await factories.NotificationFactory.create({ notification: { type: "SEASON_STARTED", meta: { seasonNth } }, users: [{ userId: ADMIN_ID, seen: 1 }], });
NN-ZAP
Badge page
Act
- Open the badge page
badge.idawait badgeDetails.goto(badge.id);
- Open edit → badgeEdit
const badgeEdit = await badgeDetails.openEdit();
Badge edit dialog
Act
- Add owner “Sendou”
await badgeEdit.addOwner("Sendou");
- Save
await badgeEdit.save();
Badge page
Assert
- owner “Sendou” is visible
await expect(badgeDetails.owner("Sendou")).toBeVisible();
SSendou
Act
- Go to “/”
await navigate({ page, url: "/" });
Notification popover
Act
- Open
await notifications.open();
- Open notification
`New badge (${BADGE_NAME})`await notifications.openNotification(`New badge (${BADGE_NAME})`);
Assert
- the page URL is
badgePage(badge.id)await expect(page).toHaveURL(badgePage(badge.id));
Act
- Open
await notifications.open();
- Open all → allNotifications
const allNotifications = await notifications.openAll();
Notifications page
Assert
- heading is visible
await expect(allNotifications.locators.heading).toBeVisible();
Source
test("adds a badge owner sending a notification", async ({ page, factories, }) => { const badge = await factories.BadgeFactory.create( { displayName: BADGE_NAME }, { managerIds: [NZAP_TEST_ID] }, ); // the popover links onwards only once its peek list is full for (let seasonNth = 1; seasonNth < NOTIFICATIONS.PEEK_COUNT; seasonNth++) { await factories.NotificationFactory.create({ notification: { type: "SEASON_STARTED", meta: { seasonNth } }, users: [{ userId: ADMIN_ID, seen: 1 }], }); } await impersonate(page, NZAP_TEST_ID); const badgeDetails = new BadgePage(page); await badgeDetails.goto(badge.id); const badgeEdit = await badgeDetails.openEdit(); await badgeEdit.addOwner("Sendou"); await badgeEdit.save(); await expect(badgeDetails.owner("Sendou")).toBeVisible(); await impersonate(page); await navigate({ page, url: "/" }); const notifications = new NotificationPopover(page); await notifications.open(); await notifications.openNotification(`New badge (${BADGE_NAME})`); await expect(page).toHaveURL(badgePage(badge.id)); await notifications.open(); const allNotifications = await notifications.openAll(); await expect(allNotifications.locators.heading).toBeVisible(); })