Skip to content

Site-wide · E2E tests

0 modules · 0 exports · 0 repositories · 13 e2e tests · 0 routes

  • NN-ZAP
  • Arrange data setup
  • Act what the user does
  • Assert what is expected

Mobile smoke

moves through common pages via the mobile nav and saves a setting

Renders//builds/calendar/settings/to/:id/to/:id/info/u/:identifier/u/:identifier

Setup
Arrange
  1. Create tournament author Sendou name “Mobile Cup” start times inHours(2) → tournament
    const tournament = await factories.TournamentFactory.create({
    	authorId: ADMIN_ID,
    	name: "Mobile Cup",
    	startTimes: [inHours(2)],
    });
  2. Create tournament team tournament id tournament.id member user ids N-ZAP
    await factories.TournamentTeamFactory.create({
    	tournamentId: tournament.id,
    	memberUserIds: [NZAP_TEST_ID],
    });
  3. Use a MOBILE_VIEWPORT viewport
    await page.setViewportSize(MOBILE_VIEWPORT);
NN-ZAP
Front page
Act
  1. Open the front page
    await front.goto();
Assert
  1. welcome banner is visible
    await expect(front.locators.welcomeBanner).toBeVisible();
Mobile nav
Act
  1. Open panel “tourneys”
    await mobileNav.openPanel("tourneys");
  2. Click event item “Mobile Cup”
    await mobileNav.eventItem("Mobile Cup").click();
Assert
  1. the page URL is new RegExp(`/to/${tournament.id}`)
    await expect(page).toHaveURL(new RegExp(`/to/${tournament.id}`));
  2. no error page
    await expectNoErrorPage(page);
Tournament page
Assert
  1. name heading “Mobile Cup” is visible
    await expect(
    	new TournamentPage(page).nameHeading("Mobile Cup"),
    ).toBeVisible();
Mobile nav
Act
  1. Open panel “menu”
    await mobileNav.openPanel("menu");
  2. Click menu link “Builds”
    await mobileNav.menuLink("Builds").click();
Assert
  1. the page URL is /\/builds/
    await expect(page).toHaveURL(/\/builds/);
  2. no error page
    await expectNoErrorPage(page);
Builds page
Act
  1. on mobile the category is picked before its weapons are shown

    Click category link “Shooters”
    await builds.categoryLink("Shooters").click();
Assert
  1. weapon link 40 is visible
    await expect(builds.weaponLink(SPLATTERSHOT_ID)).toBeVisible();
Mobile nav
Act
  1. Open panel “menu”
    await mobileNav.openPanel("menu");
  2. Click menu link “Calendar”
    await mobileNav.menuLink("Calendar").click();
Assert
  1. the page URL is /\/calendar/
    await expect(page).toHaveURL(/\/calendar/);
  2. no error page
    await expectNoErrorPage(page);
Calendar page
Assert
  1. tournament card “Mobile Cup” is visible
    await expect(
    	new CalendarPage(page).tournamentCard("Mobile Cup"),
    ).toBeVisible();
Mobile nav
Act
  1. Open panel “you”
    await mobileNav.openPanel("you");
  2. Click you panel username
    await mobileNav.locators.youPanelUsername.click();
Assert
  1. the page URL is /\/u\//
    await expect(page).toHaveURL(/\/u\//);
  2. no error page
    await expectNoErrorPage(page);
User page
Assert
  1. edit profile button is visible
    await expect(userPage.locators.editProfileButton).toBeVisible();
Mobile nav
Act
  1. Open panel “you”
    await mobileNav.openPanel("you");
  2. Click you panel settings link
    await mobileNav.locators.youPanelSettingsLink.click();
Assert
  1. the page URL is /\/settings/
    await expect(page).toHaveURL(/\/settings/);
  2. no error page
    await expectNoErrorPage(page);
Settings page
Act
  1. Select tab “Preferences”
    await settings.selectTab("Preferences");
  2. Check disable build ability sorting toggle
    await settings.checkDisableBuildAbilitySortingToggle();
  3. Reload
    await settings.reload();
Assert
  1. build ability sorting toggle is checked
    await expect(settings.locators.buildAbilitySortingToggle).toBeChecked();
Source
test("moves through common pages via the mobile nav and saves a setting", async ({
	page,
	factories,
}) => {
	const tournament = await factories.TournamentFactory.create({
		authorId: ADMIN_ID,
		name: "Mobile Cup",
		startTimes: [inHours(2)],
	});
	await factories.TournamentTeamFactory.create({
		tournamentId: tournament.id,
		memberUserIds: [NZAP_TEST_ID],
	});

	await page.setViewportSize(MOBILE_VIEWPORT);
	await impersonate(page, NZAP_TEST_ID);

	const front = new FrontPage(page);
	await front.goto();
	await expect(front.locators.welcomeBanner).toBeVisible();

	const mobileNav = new MobileNav(page);
	await mobileNav.openPanel("tourneys");
	await mobileNav.eventItem("Mobile Cup").click();
	await expect(page).toHaveURL(new RegExp(`/to/${tournament.id}`));
	await expectNoErrorPage(page);
	await expect(
		new TournamentPage(page).nameHeading("Mobile Cup"),
	).toBeVisible();

	await mobileNav.openPanel("menu");
	await mobileNav.menuLink("Builds").click();
	await expect(page).toHaveURL(/\/builds/);
	await expectNoErrorPage(page);
	const builds = new BuildsPage(page);
	// on mobile the category is picked before its weapons are shown
	await builds.categoryLink("Shooters").click();
	await expect(builds.weaponLink(SPLATTERSHOT_ID)).toBeVisible();

	await mobileNav.openPanel("menu");
	await mobileNav.menuLink("Calendar").click();
	await expect(page).toHaveURL(/\/calendar/);
	await expectNoErrorPage(page);
	await expect(
		new CalendarPage(page).tournamentCard("Mobile Cup"),
	).toBeVisible();

	await mobileNav.openPanel("you");
	await mobileNav.locators.youPanelUsername.click();
	await expect(page).toHaveURL(/\/u\//);
	await expectNoErrorPage(page);

	const userPage = new UserPage(page);
	await expect(userPage.locators.editProfileButton).toBeVisible();

	await mobileNav.openPanel("you");
	await mobileNav.locators.youPanelSettingsLink.click();
	await expect(page).toHaveURL(/\/settings/);
	await expectNoErrorPage(page);

	const settings = new SettingsPage(page);
	await settings.selectTab("Preferences");
	await settings.checkDisableBuildAbilitySortingToggle();

	await settings.reload();
	await expect(settings.locators.buildAbilitySortingToggle).toBeChecked();
})

Renders//analyzer/builds/q

NN-ZAP
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Top nav menus
Act
  1. Open “Play”
    await topNav.open("Play");
Assert
  1. link “SendouQ” is visible
    await expect(topNav.link("SendouQ")).toBeVisible();
  2. link “Scrims” is visible
    await expect(topNav.link("Scrims")).toBeVisible();
Act
  1. Click link “SendouQ”
    await topNav.link("SendouQ").click();
Assert
  1. the page URL is SENDOUQ_PAGE
    await expect(page).toHaveURL(SENDOUQ_PAGE);
  2. link “SendouQ” is not visible
    await expect(topNav.link("SendouQ")).not.toBeVisible();
Act
  1. Open “Tools”
    await topNav.open("Tools");
  2. Click link “Analyzer”
    await topNav.link("Analyzer").click();
Assert
  1. the page URL is /\/analyzer/
    await expect(page).toHaveURL(/\/analyzer/);
Act
  1. Open “Community”
    await topNav.open("Community");
  2. Click link “Builds”
    await topNav.link("Builds").click();
Assert
  1. the page URL is /\/builds/
    await expect(page).toHaveURL(/\/builds/);
Source
test("desktop navigation", async ({ page }) => {
	await impersonate(page, NZAP_TEST_ID);
	await navigate({ page, url: "/" });

	const topNav = new TopNavMenus(page);
	await topNav.open("Play");
	await expect(topNav.link("SendouQ")).toBeVisible();
	await expect(topNav.link("Scrims")).toBeVisible();

	await topNav.link("SendouQ").click();
	await expect(page).toHaveURL(SENDOUQ_PAGE);
	await expect(topNav.link("SendouQ")).not.toBeVisible();

	await topNav.open("Tools");
	await topNav.link("Analyzer").click();
	await expect(page).toHaveURL(/\/analyzer/);

	await topNav.open("Community");
	await topNav.link("Builds").click();
	await expect(page).toHaveURL(/\/builds/);
})

Renders/

Setup
Arrange
  1. Use a TABLET_VIEWPORT viewport
    await page.setViewportSize(TABLET_VIEWPORT);
NN-ZAP
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Top nav menus
Act
  1. Open “Play”
    await topNav.open("Play");
Assert
  1. link “SendouQ” is visible
    await expect(topNav.link("SendouQ")).toBeVisible();
Act
  1. Close
    await topNav.close();
Mobile nav
Assert
  1. tab “menu” is not visible
    await expect(new MobileNav(page).tab("menu")).not.toBeVisible();
Source
test("tablet navigation", async ({ page }) => {
	await page.setViewportSize(TABLET_VIEWPORT);
	await impersonate(page, NZAP_TEST_ID);
	await navigate({ page, url: "/" });

	const topNav = new TopNavMenus(page);
	await topNav.open("Play");
	await expect(topNav.link("SendouQ")).toBeVisible();
	await topNav.close();

	await expect(new MobileNav(page).tab("menu")).not.toBeVisible();
})

Renders//q

Setup
Arrange
  1. Use a MOBILE_VIEWPORT viewport
    await page.setViewportSize(MOBILE_VIEWPORT);
NN-ZAP
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Mobile nav
Assert
  1. tab “menu” is visible
    await expect(mobileNav.tab("menu")).toBeVisible();
  2. tab “friends” is visible
    await expect(mobileNav.tab("friends")).toBeVisible();
  3. tab “tourneys” is visible
    await expect(mobileNav.tab("tourneys")).toBeVisible();
  4. tab “chat” is visible
    await expect(mobileNav.tab("chat")).toBeVisible();
  5. tab “you” is visible
    await expect(mobileNav.tab("you")).toBeVisible();
Act
  1. Open panel “menu”
    await mobileNav.openPanel("menu");
Assert
  1. menu link “Analyzer” is visible
    await expect(mobileNav.menuLink("Analyzer")).toBeVisible();
  2. menu link “Builds” is visible
    await expect(mobileNav.menuLink("Builds")).toBeVisible();
Act
  1. Click menu link “SendouQ”
    await mobileNav.menuLink("SendouQ").click();
Assert
  1. the page URL is SENDOUQ_PAGE
    await expect(page).toHaveURL(SENDOUQ_PAGE);
  2. menu link “SendouQ” is not visible
    await expect(mobileNav.menuLink("SendouQ")).not.toBeVisible();
Source
test("mobile navigation", async ({ page }) => {
	await page.setViewportSize(MOBILE_VIEWPORT);
	await impersonate(page, NZAP_TEST_ID);
	await navigate({ page, url: "/" });

	const mobileNav = new MobileNav(page);
	await expect(mobileNav.tab("menu")).toBeVisible();
	await expect(mobileNav.tab("friends")).toBeVisible();
	await expect(mobileNav.tab("tourneys")).toBeVisible();
	await expect(mobileNav.tab("chat")).toBeVisible();
	await expect(mobileNav.tab("you")).toBeVisible();

	await mobileNav.openPanel("menu");
	await expect(mobileNav.menuLink("Analyzer")).toBeVisible();
	await expect(mobileNav.menuLink("Builds")).toBeVisible();
	await mobileNav.menuLink("SendouQ").click();
	await expect(page).toHaveURL(SENDOUQ_PAGE);
	await expect(mobileNav.menuLink("SendouQ")).not.toBeVisible();
})

Renders//t/:customUrl/t/:customUrl

Setup
Arrange
  1. Create team member user ids N-ZAP → team
    const team = await factories.TeamFactory.create({
    	memberUserIds: [NZAP_TEST_ID],
    });
NN-ZAP
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Side nav
Act
  1. Click footer team link
    await new SideNav(page).locators.footerTeamLink.click();
Assert
  1. the page URL is teamPage(team.customUrl)
    await expect(page).toHaveURL(teamPage(team.customUrl));
Source
test("my team shortcut navigates to the team page on desktop", async ({
	page,
	factories,
}) => {
	const team = await factories.TeamFactory.create({
		memberUserIds: [NZAP_TEST_ID],
	});

	await impersonate(page, NZAP_TEST_ID);
	await navigate({ page, url: "/" });

	await new SideNav(page).locators.footerTeamLink.click();
	await expect(page).toHaveURL(teamPage(team.customUrl));
})

Renders//t/:customUrl/t/:customUrl

Setup
Arrange
  1. Create team member user ids N-ZAP → team
    const team = await factories.TeamFactory.create({
    	memberUserIds: [NZAP_TEST_ID],
    });
  2. Use a MOBILE_VIEWPORT viewport
    await page.setViewportSize(MOBILE_VIEWPORT);
NN-ZAP
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Mobile nav
Act
  1. Open panel “menu”
    await mobileNav.openPanel("menu");
  2. Switch panel “you”
    await mobileNav.switchPanel("you");
Assert
  1. you panel username is visible
    await expect(mobileNav.locators.youPanelUsername).toBeVisible();
Act
  1. Close panel
    await mobileNav.closePanel();
Assert
  1. you panel username is not visible
    await expect(mobileNav.locators.youPanelUsername).not.toBeVisible();
Act
  1. Open panel “you”
    await mobileNav.openPanel("you");
  2. Click you panel team link
    await mobileNav.locators.youPanelTeamLink.click();
Assert
  1. the page URL is teamPage(team.customUrl)
    await expect(page).toHaveURL(teamPage(team.customUrl));
Source
test("mobile you panel shows the user and their team shortcut", async ({
	page,
	factories,
}) => {
	const team = await factories.TeamFactory.create({
		memberUserIds: [NZAP_TEST_ID],
	});

	await page.setViewportSize(MOBILE_VIEWPORT);
	await impersonate(page, NZAP_TEST_ID);
	await navigate({ page, url: "/" });

	const mobileNav = new MobileNav(page);
	await mobileNav.openPanel("menu");
	await mobileNav.switchPanel("you");
	await expect(mobileNav.locators.youPanelUsername).toBeVisible();

	await mobileNav.closePanel();
	await expect(mobileNav.locators.youPanelUsername).not.toBeVisible();

	await mobileNav.openPanel("you");
	await mobileNav.locators.youPanelTeamLink.click();
	await expect(page).toHaveURL(teamPage(team.customUrl));
})

Runs with { javaScriptEnabled: false }

Renders//q

Setup
Arrange
  1. Use a MOBILE_VIEWPORT viewport
    await page.setViewportSize(MOBILE_VIEWPORT);
NN-ZAP
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Mobile nav
Assert
  1. tab “menu” is visible
    await expect(mobileNav.tab("menu")).toBeVisible();
  2. tab “friends” is visible
    await expect(mobileNav.tab("friends")).toBeVisible();
  3. tab “tourneys” is visible
    await expect(mobileNav.tab("tourneys")).toBeVisible();
  4. tab “chat” is visible
    await expect(mobileNav.tab("chat")).toBeVisible();
  5. tab “you” is visible
    await expect(mobileNav.tab("you")).toBeVisible();
Act
  1. Open panel “menu”
    await mobileNav.openPanel("menu");
Assert
  1. menu link “Analyzer” is visible
    await expect(mobileNav.menuLink("Analyzer")).toBeVisible();
  2. menu link “Builds” is visible
    await expect(mobileNav.menuLink("Builds")).toBeVisible();
Act
  1. Click menu link “SendouQ”
    await mobileNav.menuLink("SendouQ").click();
Assert
  1. the page URL is SENDOUQ_PAGE
    await expect(page).toHaveURL(SENDOUQ_PAGE);
  2. menu link “SendouQ” is not visible
    await expect(mobileNav.menuLink("SendouQ")).not.toBeVisible();
Source
test("mobile navigation", async ({ page }) => {
	await page.setViewportSize(MOBILE_VIEWPORT);
	await impersonate(page, NZAP_TEST_ID);
	await navigate({ page, url: "/" });

	const mobileNav = new MobileNav(page);
	await expect(mobileNav.tab("menu")).toBeVisible();
	await expect(mobileNav.tab("friends")).toBeVisible();
	await expect(mobileNav.tab("tourneys")).toBeVisible();
	await expect(mobileNav.tab("chat")).toBeVisible();
	await expect(mobileNav.tab("you")).toBeVisible();

	await mobileNav.openPanel("menu");
	await expect(mobileNav.menuLink("Analyzer")).toBeVisible();
	await expect(mobileNav.menuLink("Builds")).toBeVisible();
	await mobileNav.menuLink("SendouQ").click();
	await expect(page).toHaveURL(SENDOUQ_PAGE);
	await expect(mobileNav.menuLink("SendouQ")).not.toBeVisible();
})

Renders//t/:customUrl/t/:customUrl

Setup
Arrange
  1. Create team member user ids N-ZAP → team
    const team = await factories.TeamFactory.create({
    	memberUserIds: [NZAP_TEST_ID],
    });
NN-ZAP
Act
  1. Go to “/”
    await navigate({ page, url: "/" });
Side nav
Act
  1. Click footer team link
    await new SideNav(page).locators.footerTeamLink.click();
Assert
  1. the page URL is teamPage(team.customUrl)
    await expect(page).toHaveURL(teamPage(team.customUrl));
Source
test("my team shortcut navigates to the team page on desktop", async ({
	page,
	factories,
}) => {
	const team = await factories.TeamFactory.create({
		memberUserIds: [NZAP_TEST_ID],
	});

	await impersonate(page, NZAP_TEST_ID);
	await navigate({ page, url: "/" });

	await new SideNav(page).locators.footerTeamLink.click();
	await expect(page).toHaveURL(teamPage(team.customUrl));
})

Public pages

renders public pages for a logged-out visitor

Renders//builds/builds/:slug/calendar/contributions/faq/links/scanner/support/to/:id/to/:id/info/u/:identifier/u/:identifier

Setup
Arrange
  1. Create user discord id PUBLIC_USER.discordId discord name PUBLIC_USER.discordName → user
    const user = await factories.UserFactory.create({
    	discordId: PUBLIC_USER.discordId,
    	discordName: PUBLIC_USER.discordName,
    });
  2. Create build owner id user.id weapon spl ids 40
    await factories.BuildFactory.create({
    	ownerId: user.id,
    	weaponSplIds: [BUILD_WEAPON_ID],
    });
  3. startTimes = [databaseTimestampNow()]
    const startTimes = [databaseTimestampNow()];
  4. Create calendar event author Sendou name “Ink Clash Open” startTimes
    await factories.CalendarEventFactory.create({
    	authorId: ADMIN_ID,
    	name: EVENT_NAME,
    	startTimes,
    });
  5. Create tournament author Sendou name “Public Pages Cup” startTimes → tournament
    const tournament = await factories.TournamentFactory.create({
    	authorId: ADMIN_ID,
    	name: TOURNAMENT_NAME,
    	startTimes,
    });
LOLogged out
Front page
Act
  1. Open the front page
    await front.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. welcome banner is visible
    await expect(front.locators.welcomeBanner).toBeVisible();
User page
Act
  1. Open the user page user.id
    await userPage.goto(user.id);
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. username heading PUBLIC_USER.discordName is visible
    await expect(
    	userPage.usernameHeading(PUBLIC_USER.discordName),
    ).toBeVisible();
Builds page
Act
  1. Open the builds page
    await builds.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
Act
  1. Click weapon link 40
    await builds.weaponLink(BUILD_WEAPON_ID).click();
Weapon builds page
Assert
  1. build cards count is 1
    await expect(weaponBuilds.locators.buildCards).toHaveCount(1);
Calendar page
Act
  1. Open the calendar page
    await calendar.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. tournament card “Ink Clash Open” is visible
    await expect(calendar.tournamentCard(EVENT_NAME)).toBeVisible();
  3. tournament card “Public Pages Cup” is visible
    await expect(calendar.tournamentCard(TOURNAMENT_NAME)).toBeVisible();
Tournament page
Act
  1. Open the tournament page tournament.id
    await tournamentPage.goto(tournament.id);
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. heading “Public Pages Cup” is visible
    await expect(tournamentPage.heading(TOURNAMENT_NAME)).toBeVisible();
Faq page
Act
  1. Open the faq page
    await faq.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. question “What is the Plus Server?” is visible
    await expect(faq.question("What is the Plus Server?")).toBeVisible();
Support page
Act
  1. Open the support page
    await support.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. patreon link is visible
    await expect(support.locators.patreonLink).toBeVisible();
  3. perk “Ad-free browsing” is visible
    await expect(support.perk("Ad-free browsing")).toBeVisible();
Contributions page
Act
  1. Open the contributions page
    await contributions.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. contributor “hfcRed” is visible
    await expect(contributions.contributor("hfcRed")).toBeVisible();
Links page
Act
  1. Open the links page
    await links.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. resource link “Inkipedia” is visible
    await expect(links.resourceLink("Inkipedia")).toBeVisible();
Scanner page
Act
  1. Open the scanner page
    await scanner.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
  2. the page URL is /\/scanner$/
    await expect(page).toHaveURL(/\/scanner$/);
  3. start capture button is visible
    await expect(scanner.locators.startCaptureButton).toBeVisible();
Source
test("renders public pages for a logged-out visitor", async ({
	page,
	factories,
}) => {
	const user = await factories.UserFactory.create({
		discordId: PUBLIC_USER.discordId,
		discordName: PUBLIC_USER.discordName,
	});
	await factories.BuildFactory.create({
		ownerId: user.id,
		weaponSplIds: [BUILD_WEAPON_ID],
	});
	const startTimes = [databaseTimestampNow()];
	await factories.CalendarEventFactory.create({
		authorId: ADMIN_ID,
		name: EVENT_NAME,
		startTimes,
	});
	const tournament = await factories.TournamentFactory.create({
		authorId: ADMIN_ID,
		name: TOURNAMENT_NAME,
		startTimes,
	});

	const front = new FrontPage(page);
	await front.goto();
	await expectNoErrorPage(page);
	await expect(front.locators.welcomeBanner).toBeVisible();

	const userPage = new UserPage(page);
	await userPage.goto(user.id);
	await expectNoErrorPage(page);
	await expect(
		userPage.usernameHeading(PUBLIC_USER.discordName),
	).toBeVisible();

	const builds = new BuildsPage(page);
	await builds.goto();
	await expectNoErrorPage(page);
	await builds.weaponLink(BUILD_WEAPON_ID).click();
	const weaponBuilds = new WeaponBuildsPage(page);
	await expect(weaponBuilds.locators.buildCards).toHaveCount(1);

	const calendar = new CalendarPage(page);
	await calendar.goto();
	await expectNoErrorPage(page);
	await expect(calendar.tournamentCard(EVENT_NAME)).toBeVisible();
	await expect(calendar.tournamentCard(TOURNAMENT_NAME)).toBeVisible();

	const tournamentPage = new TournamentPage(page);
	await tournamentPage.goto(tournament.id);
	await expectNoErrorPage(page);
	await expect(tournamentPage.heading(TOURNAMENT_NAME)).toBeVisible();

	const faq = new FaqPage(page);
	await faq.goto();
	await expectNoErrorPage(page);
	await expect(faq.question("What is the Plus Server?")).toBeVisible();

	const support = new SupportPage(page);
	await support.goto();
	await expectNoErrorPage(page);
	await expect(support.locators.patreonLink).toBeVisible();
	await expect(support.perk("Ad-free browsing")).toBeVisible();

	const contributions = new ContributionsPage(page);
	await contributions.goto();
	await expectNoErrorPage(page);
	await expect(contributions.contributor("hfcRed")).toBeVisible();

	const links = new LinksPage(page);
	await links.goto();
	await expectNoErrorPage(page);
	await expect(links.resourceLink("Inkipedia")).toBeVisible();

	// anyone can capture and scan; only uploading needs a login
	const scanner = new ScannerPage(page);
	await scanner.goto();
	await expectNoErrorPage(page);
	await expect(page).toHaveURL(/\/scanner$/);
	await expect(scanner.locators.startCaptureButton).toBeVisible();
})
LOLogged out
Weapon builds page
Act
  1. Open the weapon builds page “splattershot”
    await weaponBuilds.goto(BUILD_WEAPON_SLUG);
Top right buttons
Act
  1. Click search button
    await new TopRightButtons(page).locators.searchButton.click();
Log in popover
Assert
  1. log in button is visible
    await expect(logInPopover.locators.logInButton).toBeVisible();
Source
test("prompts a logged out visitor to log in when using search", async ({
	page,
}) => {
	const weaponBuilds = new WeaponBuildsPage(page);
	await weaponBuilds.goto(BUILD_WEAPON_SLUG);

	const logInPopover = new LogInPopover(page);

	await new TopRightButtons(page).locators.searchButton.click();
	await expect(logInPopover.locators.logInButton).toBeVisible();
})

lists articles and renders one by slug

Renders/a/a/:slug

LOLogged out
Articles page
Act
  1. Open the articles page
    await articles.goto();
Assert
  1. no error page
    await expectNoErrorPage(page);
Act
  1. Open article ARTICLE.title → article
    const article = await articles.openArticle(ARTICLE.title);
Article page
Assert
  1. heading ARTICLE.title is visible
    await expect(article.heading(ARTICLE.title)).toBeVisible();
  2. author link ARTICLE.author is visible
    await expect(article.authorLink(ARTICLE.author)).toBeVisible();
Act
  1. Open the article page ARTICLE.slug
    await article.goto(ARTICLE.slug);
Assert
  1. heading ARTICLE.title is visible
    await expect(article.heading(ARTICLE.title)).toBeVisible();
  2. text “largest North American Splatoon LAN in history” is visible
    await expect(
    	article.text("largest North American Splatoon LAN in history"),
    ).toBeVisible();
Source
test("lists articles and renders one by slug", async ({ page }) => {
	const articles = new ArticlesPage(page);
	await articles.goto();
	await expectNoErrorPage(page);

	const article = await articles.openArticle(ARTICLE.title);
	await expect(article.heading(ARTICLE.title)).toBeVisible();
	await expect(article.authorLink(ARTICLE.author)).toBeVisible();

	await article.goto(ARTICLE.slug);
	await expect(article.heading(ARTICLE.title)).toBeVisible();
	await expect(
		article.text("largest North American Splatoon LAN in history"),
	).toBeVisible();
})

redirects moved URLs, renders 404 for unknown ones and serves the calendar feed

Renders//*

Setup
Arrange
  1. Create calendar event author Sendou name “ICS Feed Cup” start times databaseTimestampNow()
    await factories.CalendarEventFactory.create({
    	authorId: ADMIN_ID,
    	name: ICS_EVENT_NAME,
    	startTimes: [databaseTimestampNow()],
    });
LOLogged out
Error page
Act
  1. Open the error page “/u”
    await errorPage.goto("/u");
Assert
  1. the page URL is “/?search=open&type=users”
    await expect(page).toHaveURL("/?search=open&type=users");
  2. root count is 0
    await expect(errorPage.locators.root).toHaveCount(0);
Act
  1. Open the error page “/this-page-does-not-exist”
    await errorPage.goto("/this-page-does-not-exist");
Assert
  1. root is visible
    await expect(errorPage.locators.root).toBeVisible();
  2. not found heading is visible
    await expect(errorPage.locators.notFoundHeading).toBeVisible();
  3. response status “/this-page-does-not-exist” is 404
    expect(await errorPage.responseStatus("/this-page-does-not-exist")).toBe(
    	404,
    );
Calendar page
Act
  1. Fetch I cal feed → feed
    const feed = await calendar.fetchICalFeed();
Assert
  1. feed.status is 200
    expect(feed.status).toBe(200);
  2. feed.body contains “BEGIN:VCALENDAR”
    expect(feed.body).toContain("BEGIN:VCALENDAR");
  3. feed.body contains “ICS Feed Cup”
    expect(feed.body).toContain(ICS_EVENT_NAME);
Source
test("redirects moved URLs, renders 404 for unknown ones and serves the calendar feed", async ({
	page,
	factories,
}) => {
	await factories.CalendarEventFactory.create({
		authorId: ADMIN_ID,
		name: ICS_EVENT_NAME,
		startTimes: [databaseTimestampNow()],
	});

	const errorPage = new ErrorPage(page);
	await errorPage.goto("/u");
	await expect(page).toHaveURL("/?search=open&type=users");
	await expect(errorPage.locators.root).toHaveCount(0);

	await errorPage.goto("/this-page-does-not-exist");
	await expect(errorPage.locators.root).toBeVisible();
	await expect(errorPage.locators.notFoundHeading).toBeVisible();
	expect(await errorPage.responseStatus("/this-page-does-not-exist")).toBe(
		404,
	);

	const calendar = new CalendarPage(page);
	const feed = await calendar.fetchICalFeed();
	expect(feed.status).toBe(200);
	expect(feed.body).toContain("BEGIN:VCALENDAR");
	expect(feed.body).toContain(ICS_EVENT_NAME);
})

Welcome

navigates to the welcome page via the front page banner when not logged in

Renders//welcome

LOLogged out
Front page
Act
  1. Open the front page
    await front.goto();
  2. Open welcome banner → welcome
    const welcome = await front.openWelcomeBanner();
Welcome page
Assert
  1. heading is visible
    await expect(welcome.locators.heading).toBeVisible();
Source
test("navigates to the welcome page via the front page banner when not logged in", async ({
	page,
}) => {
	const front = new FrontPage(page);
	await front.goto();

	const welcome = await front.openWelcomeBanner();

	await expect(welcome.locators.heading).toBeVisible();
})