opening the popover clears the bell dot but keeps the unseen dots listed
Renders/
Setup
Arrange
- Repeat
for (let seasonNth = 1; seasonNth <= UNSEEN_COUNT; seasonNth++)for (let seasonNth = 1; seasonNth <= UNSEEN_COUNT; seasonNth++) { await factories.NotificationFactory.create({ notification: { type: "SEASON_STARTED", meta: { seasonNth } }, users: [{ userId: ADMIN_ID, seen: 0 }], }); }
- Create notification notification type “SEASON_STARTED” meta
seasonNthusers user Sendou seen 0await factories.NotificationFactory.create({ notification: { type: "SEASON_STARTED", meta: { seasonNth } }, users: [{ userId: ADMIN_ID, seen: 0 }], });
SSendou
Act
- Go to “/”
await navigate({ page, url: "/" });
Notification popover
Assert
- bell dot is visible
await expect(notifications.locators.bellDot).toBeVisible();
Act
- Open
await notifications.open();
Assert
- bell dot is hidden
await expect(notifications.locators.bellDot).toBeHidden();
- unseen dots count is 2
await expect(notifications.locators.unseenDots).toHaveCount(UNSEEN_COUNT);
Act
- Close
await notifications.close();
Assert
- items count is 0
await expect(notifications.locators.items).toHaveCount(0);
Act
- Open
await notifications.open();
Assert
- items count is 2
await expect(notifications.locators.items).toHaveCount(UNSEEN_COUNT);
- unseen dots count is 0
await expect(notifications.locators.unseenDots).toHaveCount(0);
Source
test("opening the popover clears the bell dot but keeps the unseen dots listed", async ({ page, factories, }) => { for (let seasonNth = 1; seasonNth <= UNSEEN_COUNT; seasonNth++) { await factories.NotificationFactory.create({ notification: { type: "SEASON_STARTED", meta: { seasonNth } }, users: [{ userId: ADMIN_ID, seen: 0 }], }); } await impersonate(page); await navigate({ page, url: "/" }); const notifications = new NotificationPopover(page); await expect(notifications.locators.bellDot).toBeVisible(); await notifications.open(); await expect(notifications.locators.bellDot).toBeHidden(); await expect(notifications.locators.unseenDots).toHaveCount(UNSEEN_COUNT); await notifications.close(); await expect(notifications.locators.items).toHaveCount(0); await notifications.open(); await expect(notifications.locators.items).toHaveCount(UNSEEN_COUNT); await expect(notifications.locators.unseenDots).toHaveCount(0); })