Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/nv-3650-migrate-the-rest-cypress…
Browse files Browse the repository at this point in the history
…-tests-to-the-playwright' into nv-3650-migrate-the-rest-cypress-tests-to-the-playwright
  • Loading branch information
tatarco committed May 22, 2024
2 parents f3ede52 + 498cd4b commit ecaa0c2
Show file tree
Hide file tree
Showing 7 changed files with 58 additions and 25 deletions.
13 changes: 10 additions & 3 deletions apps/web/tests/changes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,18 @@ import { WorkflowsPage } from './page-models/workflowsPage';

import { initializeSession } from './utils.ts/browser';
import { SessionData } from './utils.ts/plugins';
import { FeatureFlagsMock } from './utils.ts/featureFlagsMock';

let session: SessionData;
let featureFlagsMock: FeatureFlagsMock, session: SessionData;
test.beforeEach(async ({ page }) => {
let featureFlagsMock;
({ session, featureFlagsMock } = await initializeSession(page));
({ featureFlagsMock, session } = await initializeSession(page));
featureFlagsMock.setFlagsToMock({
IS_IMPROVED_ONBOARDING_ENABLED: false,
IS_INFORMATION_ARCHITECTURE_ENABLED: false,
IS_BILLING_REVERSE_TRIAL_ENABLED: false,
IS_BILLING_ENABLED: false,
IS_TEMPLATE_STORE_ENABLED: false,
});
});

test('should display changes to promote', async ({ page }) => {
Expand Down
14 changes: 12 additions & 2 deletions apps/web/tests/explore.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,18 @@
import { test } from './utils.ts/baseTest';
import { initializeSession } from './utils.ts/browser';

test('auth user navigating to root gets directed to workflows', async ({ page, context }) => {
await initializeSession(page);
test.beforeEach(async ({ page }) => {
const { featureFlagsMock } = await initializeSession(page);
featureFlagsMock.setFlagsToMock({
IS_IMPROVED_ONBOARDING_ENABLED: false,
IS_INFORMATION_ARCHITECTURE_ENABLED: false,
IS_BILLING_REVERSE_TRIAL_ENABLED: false,
IS_BILLING_ENABLED: false,
IS_TEMPLATE_STORE_ENABLED: false,
});
});

test('auth user navigating to root gets directed to workflows', async ({ page }) => {
await page.goto('/');
await page.waitForURL('/workflows**');
});
13 changes: 8 additions & 5 deletions apps/web/tests/integrations-list-modal.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,30 @@ import {
import { expect } from '@playwright/test';
import { test } from './utils.ts/baseTest';

import { initializeSessionNew, isDarkTheme } from './utils.ts/browser';
import { initializeSession, isDarkTheme } from './utils.ts/browser';
import { FeatureFlagsMock } from './utils.ts/featureFlagsMock';
import {
checkTableLoading,
checkTableRow,
clickOnListRow,
interceptIntegrationsRequest,
navigateToGetStarted,
} from './utils.ts/integrations';
import { deleteProvider } from './utils.ts/plugins';
import { deleteProvider, SessionData } from './utils.ts/plugins';

test.beforeEach(async ({ context, page }) => {
const { featureFlagsMock, session } = await initializeSessionNew(page);
let featureFlagsMock: FeatureFlagsMock, session: SessionData;
test.beforeEach(async ({ page }) => {
({ featureFlagsMock, session } = await initializeSession(page));
featureFlagsMock.setFlagsToMock({
IS_IMPROVED_ONBOARDING_ENABLED: false,
IS_INFORMATION_ARCHITECTURE_ENABLED: false,
IS_BILLING_REVERSE_TRIAL_ENABLED: false,
IS_BILLING_ENABLED: false,
IS_TEMPLATE_STORE_ENABLED: false,
});
});

test('should show the table loading skeleton and empty state', async ({ page }) => {
// await waitForFeatureFlags(page);
const integrationsPromise = interceptIntegrationsRequest({
page,
modifyBody: () => ({ data: [] }),
Expand Down
19 changes: 13 additions & 6 deletions apps/web/tests/integrations-list-page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,25 @@ import { expect } from '@playwright/test';
import { test } from './utils.ts/baseTest';

import { initializeSession, isDarkTheme } from './utils.ts/browser';
import { FeatureFlagsMock } from './utils.ts/featureFlagsMock';
import {
checkTableLoading,
checkTableRow,
clickOnListRow,
interceptIntegrationsRequest,
} from './utils.ts/integrations';
import { deleteProvider } from './utils.ts/plugins';

let session;
import { deleteProvider, SessionData } from './utils.ts/plugins';

let featureFlagsMock: FeatureFlagsMock, session: SessionData;
test.beforeEach(async ({ page }) => {
const { session } = await initializeSession(page);
({ featureFlagsMock, session } = await initializeSession(page));
featureFlagsMock.setFlagsToMock({
IS_IMPROVED_ONBOARDING_ENABLED: false,
IS_INFORMATION_ARCHITECTURE_ENABLED: false,
IS_BILLING_REVERSE_TRIAL_ENABLED: false,
IS_BILLING_ENABLED: false,
IS_TEMPLATE_STORE_ENABLED: false,
});
});

test('should show the table loading skeleton and empty state', async ({ page }) => {
Expand Down Expand Up @@ -129,8 +136,8 @@ test('should show the select provider sidebar', async ({ page }) => {
await deleteProvider({
providerId: InAppProviderIdEnum.Novu,
channel: ChannelTypeEnum.IN_APP,
environmentId: session.environment.id,
organizationId: session.organization.id,
environmentId: session.environment._id,
organizationId: session.organization._id,
});

await page.goto('/integrations');
Expand Down
15 changes: 12 additions & 3 deletions apps/web/tests/main-functionality.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,22 @@ import { WorkflowEditorPage } from './page-models/workflowEditorPage';
import { WorkflowsPage } from './page-models/workflowsPage';
import { initializeSession, waitForNetworkIdle } from './utils.ts/browser';
import { ChannelType } from './utils.ts/ChannelType';
import { FeatureFlagsMock } from './utils.ts/featureFlagsMock';
import { SessionData } from './utils.ts/plugins';

let session;
const isMac = os.platform() === 'darwin';
const modifier = isMac ? 'Meta' : 'Control';

let featureFlagsMock: FeatureFlagsMock, session: SessionData;
test.beforeEach(async ({ page }) => {
({ session } = await initializeSession(page));
({ featureFlagsMock, session } = await initializeSession(page));
featureFlagsMock.setFlagsToMock({
IS_IMPROVED_ONBOARDING_ENABLED: false,
IS_INFORMATION_ARCHITECTURE_ENABLED: false,
IS_BILLING_REVERSE_TRIAL_ENABLED: false,
IS_BILLING_ENABLED: false,
IS_TEMPLATE_STORE_ENABLED: false,
});
});

test('should not reset data when switching channel types', async ({ page }) => {
Expand Down Expand Up @@ -264,7 +273,7 @@ test('should allow uploading a logo from email editor', async ({ page }) => {

await page.getByRole('button', { name: 'Yes' }).click();
await waitForNetworkIdle(page);
expect(page.url()).toContain('/settings/brand');
expect(page.url()).toContain('/brand');
});

test('should show the brand logo on main page', async ({ page }) => {
Expand Down
6 changes: 2 additions & 4 deletions apps/web/tests/page-models/teamMembersPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ export class TeamMembersPage {
}

async assertNumberOfUsersInTeamMembersList(count: number) {
const memberRows = this.page.locator('/^member-row-.*$/');
await memberRows.count().then((rowCount) => {
expect(rowCount).toBe(count);
});
const memberRows = this.page.getByTestId(/^member-row-.*$/);
await expect(memberRows).toHaveCount(count);
}
}
3 changes: 1 addition & 2 deletions apps/web/tests/team-members.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ test.beforeEach(async ({ page }) => {

test('invite user by email', async ({ page }) => {
const teamMembersPage = await TeamMembersPage.goTo(page);
await waitForNetworkIdle(page);
await teamMembersPage.assertNumberOfUsersInTeamMembersList(1);
await teamMembersPage.inviteUserByEmail('[email protected]');
await teamMembersPage.assertNumberOfUsersInTeamMembersList(2);
});

test('remove user from team', async ({ page }) => {
const teamMembersPage = await TeamMembersPage.goTo(page);
await waitForNetworkIdle(page);
await teamMembersPage.inviteUserByEmail('[email protected]');

await teamMembersPage.assertNumberOfUsersInTeamMembersList(2);
await teamMembersPage.removeUserFromTeam();
await page.waitForTimeout(300);
Expand Down

0 comments on commit ecaa0c2

Please sign in to comment.