-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 Handle invalid team or appId URLs using
notFound
utility (#523)
- Loading branch information
Showing
7 changed files
with
157 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { expect, test } from "@playwright/test" | ||
import { createTeam, createUser } from "./utils/privateApi" | ||
import { | ||
randomAppName, | ||
randomEmail, | ||
randomTeamName, | ||
slugify, | ||
} from "./utils/random" | ||
import { createApp, logInUser } from "./utils/userUtils" | ||
|
||
test.describe("404 Not Found when invalid URL", () => { | ||
test.use({ storageState: { cookies: [], origins: [] } }) | ||
const password = "password" | ||
let email: string | ||
let user: any | ||
|
||
test.beforeEach(async ({ page }) => { | ||
email = randomEmail() | ||
user = await createUser({ email, password }) | ||
await logInUser(page, email, password) | ||
}) | ||
|
||
test("Display 404 for invalid team URL", async ({ page }) => { | ||
const teamName = randomTeamName() | ||
const team = await createTeam({ name: teamName, ownerId: user.id }) | ||
|
||
await page.goto(`/teams/${team.slug}-not-found`) | ||
await expect(page.getByTestId("not-found")).toBeVisible() | ||
}) | ||
|
||
test("Display 404 for invalid app URL", async ({ page }) => { | ||
const teamName = randomTeamName() | ||
const appName = randomAppName() | ||
const appSlug = slugify(appName) | ||
|
||
const team = await createTeam({ | ||
name: teamName, | ||
ownerId: user.id, | ||
isPersonalTeam: true, | ||
}) | ||
await createApp(page, team.slug, appName) | ||
|
||
await page.goto(`/${team.slug}/apps/${appSlug}-not-found`) | ||
await expect(page.getByTestId("not-found")).toBeVisible() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters