Skip to content

Commit 1cfe838

Browse files
committed
chore: add more test on rich text
1 parent f0abc79 commit 1cfe838

File tree

3 files changed

+41
-4
lines changed

3 files changed

+41
-4
lines changed

packages/pluggableWidgets/rich-text-web/e2e/RichText.spec.js

Lines changed: 40 additions & 3 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.
@@ -28,13 +28,20 @@ test.describe("RichText", () => {
2828
await expect(page.locator(".mx-name-richText4")).toHaveScreenshot(`toolbarBasicMode.png`, { threshold: 0.4 });
2929
});
3030

31-
test("compares with a screenshot baseline and checks if inline advanced mode are rendered as expected", async ({
31+
test("compares with a screenshot baseline and checks if bottom toolbar advanced mode are rendered as expected", async ({
3232
page
3333
}) => {
3434
await page.goto("/p/advanced");
3535
await page.waitForLoadState("networkidle");
3636
await expect(page.locator(".mx-name-richText1")).toBeVisible();
37-
await expect(page.locator(".mx-name-richText1")).toHaveScreenshot(`inlineAdvancedMode.png`, { threshold: 0.4 });
37+
await expect(page.locator(".mx-name-richText1")).toHaveScreenshot(`bottomToolbarAdvancedMode.png`, {
38+
threshold: 0.4
39+
});
40+
41+
await page.click(".mx-name-richText1 .ql-toolbar button.ql-image");
42+
await expect(page.locator(".widget-rich-text .widget-rich-text-modal-body").first()).toHaveScreenshot(
43+
`insertImageDialog.png`
44+
);
3845
});
3946

4047
test("compares with a screenshot baseline and checks if toolbar advanced mode are rendered as expected", async ({
@@ -90,4 +97,34 @@ test.describe("RichText", () => {
9097
threshold: 0.4
9198
});
9299
});
100+
101+
test("compares with a screenshot baseline and checks for readonly mode basic styling", async ({ page }) => {
102+
await page.goto("/p/read-only");
103+
await page.waitForLoadState("networkidle");
104+
await page.locator(".mx-name-richText3").scrollIntoViewIfNeeded();
105+
await expect(page.locator(".mx-name-richText3")).toBeVisible();
106+
await expect(page.locator(".mx-name-richText3")).toHaveScreenshot(`readOnlyModeBasic.png`, {
107+
threshold: 0.4
108+
});
109+
});
110+
111+
test("compares with a screenshot baseline and checks for readonly mode bordered styling", async ({ page }) => {
112+
await page.goto("/p/read-only");
113+
await page.waitForLoadState("networkidle");
114+
await page.locator(".mx-name-richText2").scrollIntoViewIfNeeded();
115+
await expect(page.locator(".mx-name-richText2")).toBeVisible();
116+
await expect(page.locator(".mx-name-richText2")).toHaveScreenshot(`readOnlyModeBordered.png`, {
117+
threshold: 0.4
118+
});
119+
});
120+
121+
test("compares with a screenshot baseline and checks for readonly mode read panel styling", async ({ page }) => {
122+
await page.goto("/p/read-only");
123+
await page.waitForLoadState("networkidle");
124+
await page.locator(".mx-name-richText6").scrollIntoViewIfNeeded();
125+
await expect(page.locator(".mx-name-richText6")).toBeVisible();
126+
await expect(page.locator(".mx-name-richText6")).toHaveScreenshot(`readOnlyModeReadPanel.png`, {
127+
threshold: 0.4
128+
});
129+
});
93130
});

packages/pluggableWidgets/rich-text-web/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
},
2525
"testProject": {
2626
"githubUrl": "https://github.com/mendix/testProjects",
27-
"branchName": "rich-text-v4-web"
27+
"branchName": "rich-text-v4-2"
2828
},
2929
"scripts": {
3030
"build": "cross-env MPKOUTPUT=RichText.mpk pluggable-widgets-tools build:web",

0 commit comments

Comments
 (0)