test: adapt tests to OAuth client rename

This commit is contained in:
Jakub P.
2024-12-19 20:19:28 +01:00
parent 8d5287d51e
commit d675fd6e69
4 changed files with 50 additions and 49 deletions

View File

@@ -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);
});
});