searches for users and organizations
Renders//org/:slug/u/:identifier/u/:identifier
Setup
Arrange
- Create tournament organization owner Sendou name “Sendou.ink” → org
const org = await factories.TournamentOrganizationFactory.create({ ownerId: ADMIN_ID, name: ORGANIZATION_NAME, });
SSendou
Act
- Go to “/”
await navigate({ page, url: "/" });
Global search dialog
Act
- Open
await search.open();
- Select type “users”
await search.selectType("users");
- Search “sendou”
await search.search("sendou");
- Select option “Sendou”
await search.selectOption("Sendou");
Assert
- the page URL is
userPage({ id: ADMIN_ID })await expect(page).toHaveURL(userPage({ id: ADMIN_ID }));
Act
- Open
await search.open();
- Select type “organizations”
await search.selectType("organizations");
- Search “sendou”
await search.search("sendou");
- Select option “Sendou.ink”
await search.selectOption(ORGANIZATION_NAME);
Assert
- the page URL is
tournamentOrganizationPage({ organizationSlug: org.slug })await expect(page).toHaveURL( tournamentOrganizationPage({ organizationSlug: org.slug }), );
Source
test("searches for users and organizations", async ({ page, factories }) => { const org = await factories.TournamentOrganizationFactory.create({ ownerId: ADMIN_ID, name: ORGANIZATION_NAME, }); await impersonate(page); await navigate({ page, url: "/" }); const search = new GlobalSearchDialog(page); await search.open(); await search.selectType("users"); await search.search("sendou"); await search.selectOption("Sendou"); await expect(page).toHaveURL(userPage({ id: ADMIN_ID })); await search.open(); await search.selectType("organizations"); await search.search("sendou"); await search.selectOption(ORGANIZATION_NAME); await expect(page).toHaveURL( tournamentOrganizationPage({ organizationSlug: org.slug }), ); })