Files
myeasycms-v2/apps/e2e/tests/team-accounts/team-accounts.spec.ts
giancarlo f7de3ea9c4 Update data-loader-supabase-nextjs version and refactor e2e tests
This commit involves updating the version of @makerkit/data-loader-supabase-nextjs to ^1.0.0 across multiple components. The end-to-end tests for team-accounts have also been refactored to improve their reliability and accuracy. Additionally, a new `.env.test` file has been added for improved testing.
2024-04-12 18:51:06 +08:00

44 lines
1.4 KiB
TypeScript

import { expect, Page, test } from '@playwright/test';
import { TeamAccountsPageObject } from './team-accounts.po';
test.describe('Team Accounts', () => {
let page: Page;
let teamAccounts: TeamAccountsPageObject;
test.beforeAll(async ({ browser }) => {
page = await browser.newPage();
teamAccounts = new TeamAccountsPageObject(page);
await teamAccounts.setup();
});
test('user can update their team name (and slug)', async () => {
const {teamName, slug} = teamAccounts.createTeamName();
await teamAccounts.goToSettings();
await teamAccounts.updateName(teamName);
// the slug should be updated to match the new team name
await page.waitForURL(`http://localhost:3000/home/${slug}/settings`);
await expect(await teamAccounts.getTeamFromSelector(slug)).toBeVisible();
});
});
test.describe('Account Deletion', () => {
test('user can delete their team account', async ({ page }) => {
const teamAccounts = new TeamAccountsPageObject(page);
const params = teamAccounts.createTeamName();
await teamAccounts.setup(params);
await teamAccounts.goToSettings();
await teamAccounts.deleteAccount(params.teamName);
await page.waitForURL('http://localhost:3000/home');
expect(page.url()).toEqual('http://localhost:3000/home');
await expect(await teamAccounts.getTeamFromSelector(params.slug)).not.toBeVisible();
});
});