Skip to content

Commit c92a823

Browse files
committed
chore: make e2e use helpers, less duplication
1 parent bba3762 commit c92a823

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

packages/pluggableWidgets/combobox-web/e2e/Combobox.spec.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { test, expect } from "@playwright/test";
1+
import { expect, test } from "@playwright/test";
22

33
test.afterEach("Cleanup session", async ({ page }) => {
44
// Because the test isolation that will open a new session for every test executed, and that exceeds Mendix's license limit of 5 sessions, so we need to force logout after each test.
@@ -18,7 +18,7 @@ test.describe("combobox-web", () => {
1818
const comboBox = page.locator(".mx-name-comboBox1");
1919
await expect(comboBox).toBeVisible({ timeout: 10000 });
2020
await expect(comboBox).toHaveScreenshot(`comboBoxAssociation.png`);
21-
await page.click(".mx-name-comboBox1");
21+
await comboBox.click();
2222
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
2323
`comboBoxAssociationOpen.png`
2424
);
@@ -29,7 +29,7 @@ test.describe("combobox-web", () => {
2929
const comboBox = page.locator(".mx-name-comboBox4");
3030
await expect(comboBox).toBeVisible({ timeout: 10000 });
3131
await expect(comboBox).toHaveScreenshot(`comboBoxAssociationRowClick.png`);
32-
await page.click(".mx-name-comboBox4");
32+
await comboBox.click();
3333
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
3434
`comboBoxAssociationRowClickOpen.png`
3535
);
@@ -39,7 +39,7 @@ test.describe("combobox-web", () => {
3939
const comboBox = page.locator(".mx-name-comboBox2");
4040
await expect(comboBox).toBeVisible({ timeout: 10000 });
4141
await expect(comboBox).toHaveScreenshot(`comboBoxEnum.png`);
42-
await page.click(".mx-name-comboBox2");
42+
await comboBox.click();
4343
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
4444
`comboBoxEnumOpen.png`
4545
);
@@ -49,7 +49,7 @@ test.describe("combobox-web", () => {
4949
await page.click(".mx-name-tabPage2");
5050
const comboBox = page.locator(".mx-name-comboBox5");
5151
await expect(comboBox).toBeVisible({ timeout: 10000 });
52-
await page.click(".mx-name-comboBox5");
52+
await comboBox.click();
5353
await expect(page.locator(".mx-name-comboBox5 .widget-combobox-menu").first()).toHaveScreenshot(
5454
`comboBoxEnumFooter.png`
5555
);
@@ -59,15 +59,15 @@ test.describe("combobox-web", () => {
5959
await page.click(".mx-name-tabPage2");
6060
const comboBox = page.locator(".mx-name-comboBox6");
6161
await expect(comboBox).toBeVisible({ timeout: 10000 });
62-
await page.click(".mx-name-comboBox6");
62+
await comboBox.click();
6363
await expect(comboBox).toHaveScreenshot(`comboBoxReadOnly.png`);
6464
});
6565

6666
test("renders combobox using boolean", async ({ page }) => {
6767
const comboBox = page.locator(".mx-name-comboBox3");
6868
await expect(comboBox).toBeVisible({ timeout: 10000 });
6969
await expect(comboBox).toHaveScreenshot(`comboBoxBoolean.png`);
70-
await page.click(".mx-name-comboBox3");
70+
await comboBox.click();
7171
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
7272
`comboBoxBooleanOpen.png`
7373
);
@@ -78,7 +78,7 @@ test.describe("combobox-web", () => {
7878
const comboBox = page.locator(".mx-name-comboBox7");
7979
await expect(comboBox).toBeVisible({ timeout: 10000 });
8080
await expect(comboBox).toHaveScreenshot(`comboBoxStatic.png`);
81-
await page.click(".mx-name-comboBox7");
81+
await comboBox.click();
8282
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
8383
`comboBoxStaticOpen.png`
8484
);
@@ -89,7 +89,7 @@ test.describe("combobox-web", () => {
8989
const comboBox = page.locator(".mx-name-comboBox8");
9090
await expect(comboBox).toBeVisible({ timeout: 10000 });
9191
await expect(comboBox).toHaveScreenshot(`comboBoxDatabase.png`);
92-
await page.click(".mx-name-comboBox8");
92+
await comboBox.click();
9393
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
9494
`comboBoxDatabaseOpen.png`
9595
);
@@ -98,8 +98,8 @@ test.describe("combobox-web", () => {
9898
test("renders a filter result", async ({ page }) => {
9999
const comboBox = page.locator(".mx-name-comboBox2");
100100
await expect(comboBox).toBeVisible({ timeout: 10000 });
101-
await page.click(".mx-name-comboBox2");
102-
await page.locator(".mx-name-comboBox2 .widget-combobox-input").fill("A");
101+
await comboBox.click();
102+
await getFilterInput(comboBox).fill("A");
103103
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
104104
`comboBoxFiltering.png`
105105
);
@@ -109,7 +109,7 @@ test.describe("combobox-web", () => {
109109
await page.click(".mx-name-tabPage2");
110110
const comboBox = page.locator(".mx-name-comboBox4");
111111
await expect(comboBox).toBeVisible({ timeout: 10000 });
112-
await page.locator(".mx-name-comboBox4 .widget-combobox-icon-container").first().click();
112+
await comboBox.locator(".widget-combobox-icon-container").first().click();
113113
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
114114
`comboBoxRemoveSelection.png`
115115
);
@@ -119,7 +119,7 @@ test.describe("combobox-web", () => {
119119
await page.click(".mx-name-tabPage2");
120120
const comboBox = page.locator(".mx-name-comboBox4");
121121
await expect(comboBox).toBeVisible({ timeout: 10000 });
122-
await page.locator(".mx-name-comboBox4 .widget-combobox-clear-button").nth(3).click();
122+
await comboBox.locator(".widget-combobox-clear-button").nth(3).click();
123123
await expect(page.locator(".modal-body .mx-name-layoutGrid1").first()).toHaveScreenshot(
124124
`comboBoxRemoveAllSelection.png`
125125
);

0 commit comments

Comments
 (0)