From d675fd6e69cad93e495ded363d06fc3760987409 Mon Sep 17 00:00:00 2001 From: "Jakub P." Date: Thu, 19 Dec 2024 20:19:28 +0100 Subject: [PATCH] test: adapt tests to OAuth client rename --- ...e.js => application-oauth-clients-page.js} | 4 +- packages/e2e-tests/fixtures/admin/index.js | 11 +-- .../tests/admin/applications.spec.js | 82 +++++++++---------- .../e2e-tests/tests/apps/list-apps.spec.js | 2 +- 4 files changed, 50 insertions(+), 49 deletions(-) rename packages/e2e-tests/fixtures/admin/{application-auth-clients-page.js => application-oauth-clients-page.js} (89%) diff --git a/packages/e2e-tests/fixtures/admin/application-auth-clients-page.js b/packages/e2e-tests/fixtures/admin/application-oauth-clients-page.js similarity index 89% rename from packages/e2e-tests/fixtures/admin/application-auth-clients-page.js rename to packages/e2e-tests/fixtures/admin/application-oauth-clients-page.js index c1b852a1..e0258eeb 100644 --- a/packages/e2e-tests/fixtures/admin/application-auth-clients-page.js +++ b/packages/e2e-tests/fixtures/admin/application-oauth-clients-page.js @@ -2,14 +2,14 @@ import { expect } from '@playwright/test'; const { AuthenticatedPage } = require('../authenticated-page'); -export class AdminApplicationAuthClientsPage extends AuthenticatedPage { +export class AdminApplicationOAuthClientsPage extends AuthenticatedPage { /** * @param {import('@playwright/test').Page} page */ constructor(page) { super(page); - this.authClientsTab = this.page.getByTestId('auth-clients-tab'); + this.authClientsTab = this.page.getByTestId('oauth-clients-tab'); this.saveButton = this.page.getByTestId('submitButton'); this.successSnackbar = this.page.getByTestId( 'snackbar-save-admin-apps-settings-success' diff --git a/packages/e2e-tests/fixtures/admin/index.js b/packages/e2e-tests/fixtures/admin/index.js index 746c85dd..db99cf35 100644 --- a/packages/e2e-tests/fixtures/admin/index.js +++ b/packages/e2e-tests/fixtures/admin/index.js @@ -8,7 +8,9 @@ const { AdminEditRolePage } = require('./edit-role-page'); const { AdminApplicationsPage } = require('./applications-page'); const { AdminApplicationSettingsPage } = require('./application-settings-page'); -const { AdminApplicationAuthClientsPage } = require('./application-auth-clients-page'); +const { + AdminApplicationOAuthClientsPage, +} = require('./application-oauth-clients-page'); export const adminFixtures = { adminUsersPage: async ({ page }, use) => { @@ -35,8 +37,7 @@ export const adminFixtures = { adminApplicationSettingsPage: async ({ page }, use) => { await use(new AdminApplicationSettingsPage(page)); }, - adminApplicationAuthClientsPage: async ({ page }, use) => { - await use(new AdminApplicationAuthClientsPage(page)); - } + adminApplicationOAuthClientsPage: async ({ page }, use) => { + await use(new AdminApplicationOAuthClientsPage(page)); + }, }; - diff --git a/packages/e2e-tests/tests/admin/applications.spec.js b/packages/e2e-tests/tests/admin/applications.spec.js index d5bfb4ba..c487ae3f 100644 --- a/packages/e2e-tests/tests/admin/applications.spec.js +++ b/packages/e2e-tests/tests/admin/applications.spec.js @@ -71,7 +71,7 @@ test.describe('Admin Applications', () => { test('should allow only custom connections', async ({ adminApplicationsPage, adminApplicationSettingsPage, - adminApplicationAuthClientsPage, + adminApplicationOAuthClientsPage, flowEditorPage, page, }) => { @@ -95,9 +95,9 @@ test.describe('Admin Applications', () => { adminApplicationSettingsPage.disableConnectionsSwitch ).not.toBeChecked(); - await adminApplicationAuthClientsPage.openAuthClientsTab(); + await adminApplicationOAuthClientsPage.openAuthClientsTab(); await expect( - adminApplicationAuthClientsPage.createFirstAuthClientButton + adminApplicationOAuthClientsPage.createFirstAuthClientButton ).toHaveCount(1); await page.goto('/'); @@ -117,9 +117,9 @@ test.describe('Admin Applications', () => { const newConnectionOption = page .getByRole('option') .filter({ hasText: 'Add new connection' }); - const newSharedConnectionOption = page + const newOAuthConnectionOption = page .getByRole('option') - .filter({ hasText: 'Add new connection with auth client' }); + .filter({ hasText: 'Add connection with OAuth client' }); const existingConnection = page .getByRole('option') .filter({ hasText: 'Unnamed' }); @@ -127,13 +127,13 @@ test.describe('Admin Applications', () => { await expect(await existingConnection.count()).toBeGreaterThan(0); await expect(newConnectionOption).toBeEnabled(); await expect(newConnectionOption).toHaveCount(1); - await expect(newSharedConnectionOption).toHaveCount(0); + await expect(newOAuthConnectionOption).toHaveCount(0); }); test('should allow only predefined connections and existing custom', async ({ adminApplicationsPage, adminApplicationSettingsPage, - adminApplicationAuthClientsPage, + adminApplicationOAuthClientsPage, flowEditorPage, page, }) => { @@ -153,8 +153,8 @@ test.describe('Admin Applications', () => { await adminApplicationSettingsPage.saveSettings(); await adminApplicationSettingsPage.expectSuccessSnackbarToBeVisible(); - await adminApplicationAuthClientsPage.openAuthClientsTab(); - await adminApplicationAuthClientsPage.openFirstAuthClientCreateForm(); + await adminApplicationOAuthClientsPage.openAuthClientsTab(); + await adminApplicationOAuthClientsPage.openFirstAuthClientCreateForm(); const authClientForm = page.getByTestId('auth-client-form'); await authClientForm.locator(page.getByTestId('switch')).check(); await authClientForm @@ -166,8 +166,8 @@ test.describe('Admin Applications', () => { await authClientForm .locator(page.locator('[name="clientSecret"]')) .fill('spotifyClientSecret'); - await adminApplicationAuthClientsPage.submitAuthClientForm(); - await adminApplicationAuthClientsPage.authClientShouldBeVisible( + await adminApplicationOAuthClientsPage.submitAuthClientForm(); + await adminApplicationOAuthClientsPage.authClientShouldBeVisible( 'spotifyAuthClient' ); @@ -187,23 +187,23 @@ test.describe('Admin Applications', () => { const newConnectionOption = page .getByRole('option') .filter({ hasText: 'Add new connection' }); - const newSharedConnectionOption = page + const newOAuthConnectionOption = page .getByRole('option') - .filter({ hasText: 'Add connection with auth client' }); + .filter({ hasText: 'Add connection with OAuth client' }); const existingConnection = page .getByRole('option') .filter({ hasText: 'Unnamed' }); await expect(await existingConnection.count()).toBeGreaterThan(0); await expect(newConnectionOption).toHaveCount(0); - await expect(newSharedConnectionOption).toBeEnabled(); - await expect(newSharedConnectionOption).toHaveCount(1); + await expect(newOAuthConnectionOption).toBeEnabled(); + await expect(newOAuthConnectionOption).toHaveCount(1); }); test('should allow all connections', async ({ adminApplicationsPage, adminApplicationSettingsPage, - adminApplicationAuthClientsPage, + adminApplicationOAuthClientsPage, flowEditorPage, page, }) => { @@ -219,8 +219,8 @@ test.describe('Admin Applications', () => { adminApplicationSettingsPage.disableConnectionsSwitch ).not.toBeChecked(); - await adminApplicationAuthClientsPage.openAuthClientsTab(); - await adminApplicationAuthClientsPage.openFirstAuthClientCreateForm(); + await adminApplicationOAuthClientsPage.openAuthClientsTab(); + await adminApplicationOAuthClientsPage.openFirstAuthClientCreateForm(); const authClientForm = page.getByTestId('auth-client-form'); await authClientForm.locator(page.getByTestId('switch')).check(); await authClientForm @@ -232,8 +232,8 @@ test.describe('Admin Applications', () => { await authClientForm .locator(page.locator('[name="clientSecret"]')) .fill('redditClientSecret'); - await adminApplicationAuthClientsPage.submitAuthClientForm(); - await adminApplicationAuthClientsPage.authClientShouldBeVisible( + await adminApplicationOAuthClientsPage.submitAuthClientForm(); + await adminApplicationOAuthClientsPage.authClientShouldBeVisible( 'redditAuthClient' ); @@ -253,23 +253,23 @@ test.describe('Admin Applications', () => { const newConnectionOption = page .getByRole('option') .filter({ hasText: 'Add new connection' }); - const newSharedConnectionOption = page + const newOAuthConnectionOption = page .getByRole('option') - .filter({ hasText: 'Add connection with auth client' }); + .filter({ hasText: 'Add connection with OAuth client' }); const existingConnection = page .getByRole('option') .filter({ hasText: 'Unnamed' }); await expect(await existingConnection.count()).toBeGreaterThan(0); await expect(newConnectionOption).toHaveCount(1); - await expect(newSharedConnectionOption).toBeEnabled(); - await expect(newSharedConnectionOption).toHaveCount(1); + await expect(newOAuthConnectionOption).toBeEnabled(); + await expect(newOAuthConnectionOption).toHaveCount(1); }); test('should not allow new connections but existing custom', async ({ adminApplicationsPage, adminApplicationSettingsPage, - adminApplicationAuthClientsPage, + adminApplicationOAuthClientsPage, flowEditorPage, page, }) => { @@ -282,8 +282,8 @@ test.describe('Admin Applications', () => { await adminApplicationSettingsPage.saveSettings(); await adminApplicationSettingsPage.expectSuccessSnackbarToBeVisible(); - await adminApplicationAuthClientsPage.openAuthClientsTab(); - await adminApplicationAuthClientsPage.openFirstAuthClientCreateForm(); + await adminApplicationOAuthClientsPage.openAuthClientsTab(); + await adminApplicationOAuthClientsPage.openFirstAuthClientCreateForm(); const authClientForm = page.getByTestId('auth-client-form'); await authClientForm.locator(page.getByTestId('switch')).check(); @@ -296,8 +296,8 @@ test.describe('Admin Applications', () => { await authClientForm .locator(page.locator('[name="clientSecret"]')) .fill('clickupClientSecret'); - await adminApplicationAuthClientsPage.submitAuthClientForm(); - await adminApplicationAuthClientsPage.authClientShouldBeVisible( + await adminApplicationOAuthClientsPage.submitAuthClientForm(); + await adminApplicationOAuthClientsPage.authClientShouldBeVisible( 'clickupAuthClient' ); @@ -317,22 +317,22 @@ test.describe('Admin Applications', () => { const newConnectionOption = page .getByRole('option') .filter({ hasText: 'Add new connection' }); - const newSharedConnectionOption = page + const newOAuthConnectionOption = page .getByRole('option') - .filter({ hasText: 'Add connection with auth client' }); + .filter({ hasText: 'Add connection with OAuth client' }); const existingConnection = page .getByRole('option') .filter({ hasText: 'Unnamed' }); await expect(await existingConnection.count()).toBeGreaterThan(0); await expect(newConnectionOption).toHaveCount(0); - await expect(newSharedConnectionOption).toHaveCount(0); + await expect(newOAuthConnectionOption).toHaveCount(0); }); - test('should not allow new connections but existing custom even if predefined auth clients are enabled', async ({ + test('should not allow new connections but existing custom even if predefined OAuth clients are enabled', async ({ adminApplicationsPage, adminApplicationSettingsPage, - adminApplicationAuthClientsPage, + adminApplicationOAuthClientsPage, flowEditorPage, page, }) => { @@ -348,8 +348,8 @@ test.describe('Admin Applications', () => { await adminApplicationSettingsPage.saveSettings(); await adminApplicationSettingsPage.expectSuccessSnackbarToBeVisible(); - await adminApplicationAuthClientsPage.openAuthClientsTab(); - await adminApplicationAuthClientsPage.openFirstAuthClientCreateForm(); + await adminApplicationOAuthClientsPage.openAuthClientsTab(); + await adminApplicationOAuthClientsPage.openFirstAuthClientCreateForm(); const authClientForm = page.getByTestId('auth-client-form'); await authClientForm.locator(page.getByTestId('switch')).check(); @@ -362,8 +362,8 @@ test.describe('Admin Applications', () => { await authClientForm .locator(page.locator('[name="clientSecret"]')) .fill('mailchimpClientSecret'); - await adminApplicationAuthClientsPage.submitAuthClientForm(); - await adminApplicationAuthClientsPage.authClientShouldBeVisible( + await adminApplicationOAuthClientsPage.submitAuthClientForm(); + await adminApplicationOAuthClientsPage.authClientShouldBeVisible( 'mailchimpAuthClient' ); @@ -387,9 +387,9 @@ test.describe('Admin Applications', () => { const newConnectionOption = page .getByRole('option') .filter({ hasText: 'Add new connection' }); - const newSharedConnectionOption = page + const newOAuthConnectionOption = page .getByRole('option') - .filter({ hasText: 'Add new shared connection' }); + .filter({ hasText: 'Add connection with OAuth client' }); const noConnectionsOption = page .locator('.MuiAutocomplete-noOptions') .filter({ hasText: 'No options' }); @@ -397,6 +397,6 @@ test.describe('Admin Applications', () => { await expect(await existingConnection.count()).toBeGreaterThan(0); await expect(noConnectionsOption).toHaveCount(0); await expect(newConnectionOption).toHaveCount(0); - await expect(newSharedConnectionOption).toHaveCount(0); + await expect(newOAuthConnectionOption).toHaveCount(0); }); }); diff --git a/packages/e2e-tests/tests/apps/list-apps.spec.js b/packages/e2e-tests/tests/apps/list-apps.spec.js index 42e56880..b382782a 100644 --- a/packages/e2e-tests/tests/apps/list-apps.spec.js +++ b/packages/e2e-tests/tests/apps/list-apps.spec.js @@ -55,7 +55,7 @@ test.describe('Apps page', () => { test('goes to app page to create a connection', async ({ applicationsPage, }) => { - // loading app, app config, app auth clients take time + // loading app, app config, app oauth clients take time test.setTimeout(60000); await applicationsPage.page.getByTestId('app-list-item').first().click();