test: add delete flow tests

This commit is contained in:
Jakub P.
2024-10-16 23:33:43 +02:00
parent 0234b4ad81
commit d31309a92d
8 changed files with 333 additions and 1 deletions

View File

@@ -0,0 +1,35 @@
const { AuthenticatedPage } = require('./authenticated-page');
const { expect } = require('@playwright/test');
export class FlowsPage extends AuthenticatedPage {
constructor(page) {
super(page);
this.flowRow = this.page.getByTestId('flow-row');
this.flowCard = this.page.getByTestId('card-action-area');
this.deleteFlowMenuItem = this.page.getByRole('menuitem', {
name: 'Delete',
});
}
async clickOnDeleteFlowMenuItem() {
await this.deleteFlowMenuItem.click();
}
async deleteFlow(flowId) {
const desiredFlow = await this.flowRow.filter({
has: this.page.locator(`a[href="/editor/${flowId}"]`),
});
await desiredFlow.locator('button').click();
await this.clickOnDeleteFlowMenuItem();
await expect(
await this.flowRow.filter({
has: this.page.locator(`a[href="/editor/${flowId}"]`),
})
).toHaveCount(0);
const snackbar = await this.getSnackbarData();
await expect(snackbar.variant).toBe('success');
}
}