Removed an invalidate onDelete + updated test (#5521)

pull/5519/head^2
Alex van Andel 2022-11-14 19:34:47 +00:00 committed by GitHub
parent 7beb17c007
commit 1edc9c50d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -9,15 +9,12 @@ test.describe("Teams", () => {
await users.deleteAll();
});
test("Can create teams via Wizard", async ({ page, users, prisma }) => {
test("Can create teams via Wizard", async ({ page, users }) => {
const user = await users.create();
const inviteeEmail = `${user.username}+invitee@example.com`;
await user.login();
await page.goto("/teams");
// Expect teams to be empty
await expect(page.locator('[data-testid="empty-screen"]')).toBeVisible();
await test.step("Can create team", async () => {
// Click text=Create Team
await page.locator("text=Create Team").click();
@ -58,7 +55,9 @@ test.describe("Teams", () => {
await page.locator("text=Delete Team").click();
await page.locator("text=Yes, disband team").click();
await page.waitForURL("/teams");
await expect(page.locator('[data-testid="empty-screen"]')).toBeVisible();
await expect(await page.locator(`text=${user.username}'s Team`).count()).toEqual(0);
// FLAKY: If other tests are running async this may mean there are >0 teams, empty screen will not be shown.
// await expect(page.locator('[data-testid="empty-screen"]')).toBeVisible();
});
});
});

View File

@ -71,7 +71,6 @@ const ProfileView = () => {
const deleteTeamMutation = trpc.viewer.teams.delete.useMutation({
async onSuccess() {
await utils.viewer.teams.get.invalidate();
await utils.viewer.teams.list.invalidate();
showToast(t("your_team_disbanded_successfully"), "success");
router.push(`${WEBAPP_URL}/teams`);