Files
myeasycms-v2/apps/e2e/tests/team-accounts/team-accounts.spec.ts
giancarlo 21fba33462 Add account deletion process and improve tests
The commit introduces a message to indicate the account deletion process. It also enhances the tests by reducing code redundancy in the e2e tests, creating a more random name for team accounts, and improving the navigation process after account deletions. The commit also includes code cleanup tasks, such as the removal of unused imports.
2024-04-12 21:30:13 +08:00

40 lines
1.2 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);
});
test('user can update their team name (and slug)', async () => {
await teamAccounts.setup();
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 expect(await teamAccounts.getTeamFromSelector(params.slug)).not.toBeVisible();
});
});