Files
myeasycms-v2/apps/e2e/tests/team-accounts/team-accounts.spec.ts
giancarlo 7c447c8848 Refactored e2e tests to use Promise.all for parallel execution
In this update, several end-to-end (e2e) tests were refactored to use Promise.all for parallel execution of operations. This was done to improve the efficiency and stability of the tests, as waiting for each operation one by one could cause bottlenecks and potential failures in the test execution. Receives and click actions were grouped together to allow them to be executed concurrently where possible. The changes were applied across different test scenarios.
2024-05-07 17:29:54 +07:00

50 lines
1.4 KiB
TypeScript

import { Page, expect, 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();
const request = teamAccounts.updateName(teamName, slug);
// the slug should be updated to match the new team name
const newUrl = page.waitForURL(`**/home/${slug}/settings`);
await Promise.all([request, newUrl]);
await teamAccounts.openAccountsSelector();
await expect(teamAccounts.getTeamFromSelector(teamName)).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 teamAccounts.openAccountsSelector();
await expect(
teamAccounts.getTeamFromSelector(params.teamName),
).not.toBeVisible();
});
});