Skip to content

Commit

Permalink
fix: migrate cypress to playwright
Browse files Browse the repository at this point in the history
Add notes to tests that don't work as expected
  • Loading branch information
denis-kralj-novu authored and tatarco committed May 19, 2024
1 parent 7db8a24 commit 3cb6086
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
4 changes: 0 additions & 4 deletions apps/web/tests/page-models/nodeDigestEditorPageModal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ export class NodeDigestEditorPageModal extends WorkflowBaseSidePanelPage {
return this.page.getByTestId('digest-send-options');
}

getDeleteButton() {
return this.page.getByTestId('editor-sidebar-delete');
}

async openAddConditionsSidebar() {
await this.page.getByTestId('editor-sidebar-add-conditions').click();
return new ConditionsPage(this.page);
Expand Down
23 changes: 14 additions & 9 deletions apps/web/tests/variants.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ test('shold show step actions with a variant', async ({ page }) => {
await expect(workflowEditorPage.getDeleteStepActionLocator()).toBeVisible();
});

// TODO: this test breaks the page somehow
test('should show only edit step in production', async ({ page }) => {
const smsBody = 'this is a test paragraph';

Expand All @@ -279,6 +280,7 @@ test('should show only edit step in production', async ({ page }) => {
expect(workflowEditorPage.getNode(ChannelType.SMS, 0).getByTestId('step-actions-menu')).toHaveCount(0);
});

// TODO: this test breaks the page somehow
test('should show edit step and conditions for variants in production', async ({ page }) => {
const smsBody = 'this is a test paragraph';

Expand Down Expand Up @@ -337,7 +339,8 @@ test('ensure the variant step editor has expected actions', async ({ page }) =>
await assertHasExpectedVariantEditorButtons(page);
});

test('ensure production only shows close action', async ({ page }) => {
// TODO: this test breaks the page somehow
test('ensure production only shows close button for simple node', async ({ page }) => {
const smsBody = 'this is a test paragraph';

const workflowEditorPage = await WorkflowEditorPage.goToNewWorkflow(page);
Expand All @@ -356,7 +359,7 @@ test('ensure production only shows close action', async ({ page }) => {
const workflowsTable = workflowsPage.getWorkflowsTable();
await workflowsTable.locator('tbody tr').first().click();

await workflowEditorPage.editAction().hover();
await workflowEditorPage.getNode(ChannelType.SMS, 0).hover({ force: true });
await workflowEditorPage.editAction().click({ force: true });

const nodeSmsEditingModalPageModel = new NodeSmsEditingModalPageModel(page);
Expand All @@ -366,13 +369,16 @@ test('ensure production only shows close action', async ({ page }) => {
expect(nodeSmsEditingModalPageModel.getDeleteButton()).toHaveCount(0);
});

test('ensure production shows close and edit conditions action', async ({ page }) => {
// TODO: this test breaks the page somehow
test('ensure production shows close and edit conditions button for conditioned node', async ({ page }) => {
const smsBody = 'this is a test paragraph';

const workflowEditorPage = await WorkflowEditorPage.goToNewWorkflow(page);
await workflowEditorPage.setWorkflowNameInput('Test Add Variant Flow for SMS');
const nodeSmsEditingPageModel = await workflowEditorPage.addAndEditInSmsNode();
await nodeSmsEditingPageModel.fillSmsBody(smsBody);
await nodeSmsEditingPageModel.getAddConditionsButton().click();
await setConditions(page);
await nodeSmsEditingPageModel.nodeSettingsUpdateButton().click();
await nodeSmsEditingPageModel.closeSidePanel();

Expand All @@ -385,14 +391,13 @@ test('ensure production shows close and edit conditions action', async ({ page }
const workflowsTable = workflowsPage.getWorkflowsTable();
await workflowsTable.locator('tbody tr').first().click();

await workflowEditorPage.editAction().hover();
await workflowEditorPage.getNode(ChannelType.SMS, 0).hover({ force: true });
await workflowEditorPage.editAction().click({ force: true });

const nodeSmsEditingModalPageModel = new NodeSmsEditingModalPageModel(page);
expect(nodeSmsEditingModalPageModel.getEditorAddVariantButton()).toHaveCount(0);
expect(nodeSmsEditingModalPageModel.getAddConditionsButton()).toHaveCount(0);
expect(nodeSmsEditingModalPageModel.getEditConditionsButton()).toHaveCount(0);
expect(nodeSmsEditingModalPageModel.getDeleteButton()).toHaveCount(0);
expect(nodeSmsEditingPageModel.getEditorAddVariantButton()).toHaveCount(0);
expect(nodeSmsEditingPageModel.getAddConditionsButton()).toHaveCount(0);
expect(nodeSmsEditingPageModel.getEditConditionsButton()).toHaveCount(1);
expect(nodeSmsEditingPageModel.getDeleteButton()).toHaveCount(0);
});

async function addVariantAndSetCondition(workflowEditorPage: WorkflowEditorPage, page) {
Expand Down

0 comments on commit 3cb6086

Please sign in to comment.