Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
68 lines
2.4 KiB
TypeScript
68 lines
2.4 KiB
TypeScript
import { BasePage } from './BasePage';
|
|
import { AddResource } from './components/AddResource';
|
|
import { CredentialModal } from './components/CredentialModal';
|
|
import { ResourceCards } from './components/ResourceCards';
|
|
|
|
export class CredentialsPage extends BasePage {
|
|
readonly credentialModal = new CredentialModal(this.page.getByTestId('editCredential-modal'));
|
|
readonly addResource = new AddResource(this.page);
|
|
readonly cards = new ResourceCards(this.page);
|
|
|
|
get emptyListCreateCredentialButton() {
|
|
return this.page.getByRole('button', { name: 'Add first credential' });
|
|
}
|
|
|
|
get createCredentialButton() {
|
|
return this.page.getByTestId('create-credential-button');
|
|
}
|
|
|
|
/**
|
|
* Create a credential from the credentials list, fill fields, save, and close the modal.
|
|
* @param credentialType - The type of credential to create (e.g. 'Notion API')
|
|
* @param fields - Key-value pairs for credential fields to fill
|
|
*/
|
|
async createCredentialFromCredentialPicker(
|
|
credentialType: string,
|
|
fields: Record<string, string>,
|
|
options?: { closeDialog?: boolean; skipSave?: boolean; name?: string },
|
|
): Promise<void> {
|
|
await this.page.getByRole('combobox', { name: 'Search for app...' }).fill(credentialType);
|
|
await this.page
|
|
.getByTestId('new-credential-type-select-option')
|
|
.filter({ hasText: credentialType })
|
|
.click();
|
|
await this.page.getByTestId('new-credential-type-button').click();
|
|
await this.credentialModal.addCredential(fields, {
|
|
name: options?.name,
|
|
closeDialog: options?.closeDialog,
|
|
skipSave: options?.skipSave,
|
|
});
|
|
}
|
|
|
|
async clearSearch() {
|
|
await this.page.getByTestId('resources-list-search').clear();
|
|
}
|
|
|
|
async sortByNameDescending() {
|
|
await this.page.getByTestId('resources-list-sort').click();
|
|
await this.page.getByText('Name (Z-A)').click();
|
|
}
|
|
|
|
async sortByNameAscending() {
|
|
await this.page.getByTestId('resources-list-sort').click();
|
|
await this.page.getByText('Name (A-Z)').click();
|
|
}
|
|
|
|
/**
|
|
* Select credential type without auto-saving (for tests that need to handle save manually)
|
|
*/
|
|
async selectCredentialType(credentialType: string): Promise<void> {
|
|
await this.page.getByRole('combobox', { name: 'Search for app...' }).fill(credentialType);
|
|
await this.page
|
|
.getByTestId('new-credential-type-select-option')
|
|
.filter({ hasText: credentialType })
|
|
.click();
|
|
await this.page.getByTestId('new-credential-type-button').click();
|
|
}
|
|
}
|