Skip to content

Notifications · E2E tests

0 modules · 0 exports · 1 repository · 1 e2e test · 4 routes

  • SSendou
  • Arrange data setup
  • Act what the user does
  • Assert what is expected

Notifications

opening the popover clears the bell dot but keeps the unseen dots listed

Renders/

Setup
Arrange
  1. 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 }],
    	});
    }
    1. Create notification notification type “SEASON_STARTED” meta seasonNth users user Sendou seen 0
      await factories.NotificationFactory.create({
      	notification: { type: "SEASON_STARTED", meta: { seasonNth } },
      	users: [{ userId: ADMIN_ID, seen: 0 }],
      });
SSendou
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Notification popover
Assert
  1. bell dot is visible
    await expect(notifications.locators.bellDot).toBeVisible();
Act
  1. Open
    await notifications.open();
Assert
  1. bell dot is hidden
    await expect(notifications.locators.bellDot).toBeHidden();
  2. unseen dots count is 2
    await expect(notifications.locators.unseenDots).toHaveCount(UNSEEN_COUNT);
Act
  1. Close
    await notifications.close();
Assert
  1. items count is 0
    await expect(notifications.locators.items).toHaveCount(0);
Act
  1. Open
    await notifications.open();
Assert
  1. items count is 2
    await expect(notifications.locators.items).toHaveCount(UNSEEN_COUNT);
  2. 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);
})