first commit
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
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
This commit is contained in:
@@ -0,0 +1,73 @@
|
||||
import type { Locator, Page } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* ResourceCards component for handling folder, workflow, credential, and data store cards.
|
||||
* All cards are contained within a resources-list-wrapper.
|
||||
*/
|
||||
export class ResourceCards {
|
||||
constructor(private page: Page) {}
|
||||
|
||||
getFolders(): Locator {
|
||||
return this.page.getByTestId('folder-card');
|
||||
}
|
||||
|
||||
getWorkflows(): Locator {
|
||||
return this.page.getByTestId('resources-list-item-workflow');
|
||||
}
|
||||
|
||||
getCredentials(): Locator {
|
||||
return this.page.getByTestId('resources-list-item');
|
||||
}
|
||||
|
||||
getFolder(name: string): Locator {
|
||||
return this.page.locator(`[data-test-id="folder-card"][data-resourcename="${name}"]`);
|
||||
}
|
||||
|
||||
getWorkflow(name: string): Locator {
|
||||
return this.getWorkflows().filter({ hasText: name });
|
||||
}
|
||||
|
||||
getCredential(name: string): Locator {
|
||||
return this.getCredentials().filter({
|
||||
has: this.page.getByTestId('card-content').locator('h2').filter({ hasText: name }),
|
||||
});
|
||||
}
|
||||
|
||||
getCardActionToggle(card: Locator): Locator {
|
||||
return card
|
||||
.getByTestId('card-append')
|
||||
.locator('[class*="action-toggle"]')
|
||||
.filter({ visible: true });
|
||||
}
|
||||
|
||||
getCardAction(actionName: string): Locator {
|
||||
return this.page.getByTestId(`action-${actionName}`).filter({ visible: true });
|
||||
}
|
||||
|
||||
async openCardActions(card: Locator): Promise<void> {
|
||||
await this.getCardActionToggle(card).click();
|
||||
}
|
||||
|
||||
async clickCardAction(card: Locator, actionName: string): Promise<void> {
|
||||
await this.openCardActions(card);
|
||||
await this.getCardAction(actionName).click();
|
||||
}
|
||||
|
||||
async openFolder(folderName: string): Promise<void> {
|
||||
const folderCard = this.getFolder(folderName);
|
||||
await this.clickCardAction(folderCard, 'open');
|
||||
}
|
||||
|
||||
async deleteFolder(folderName: string): Promise<void> {
|
||||
const folderCard = this.getFolder(folderName);
|
||||
await this.clickCardAction(folderCard, 'delete');
|
||||
}
|
||||
|
||||
async clickWorkflowCard(workflowName: string): Promise<void> {
|
||||
await this.getWorkflow(workflowName).getByTestId('card-content').click();
|
||||
}
|
||||
|
||||
async clickCredentialCard(credentialName: string): Promise<void> {
|
||||
await this.getCredential(credentialName).getByTestId('card-content').click();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user