Skip to content

Commit

Permalink
SWED-2339 adjust UI & E2E tests
Browse files Browse the repository at this point in the history
  • Loading branch information
goldenraphti committed May 7, 2024
1 parent 6ceea88 commit edfeebc
Show file tree
Hide file tree
Showing 19 changed files with 23 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const DialogExample = ({
slidesFromBottom={slidesFromBottom}
hasGrayBgColor={hasGrayBgColor}
>
<p>
<p className="mb-0">
You’re about to permanently delete <i>German Swashbuckle (456)?</i>
</p>
</DialogComponent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test("Dialog page exist", async ({ page }) => {
.click();
await expect(page).toHaveTitle(/Dialog/);
await expect(
page.getByRole("heading", { name: "Dialog", exact: true }),
page.getByRole("heading", { name: "Dialog", exact: true, level: 1 }),
).toBeVisible();
});

Expand All @@ -27,11 +27,14 @@ test("visual regresion accordions", async ({ page, browserName }) => {
const brand = (await page.title()).includes("Swedbank")
? "SwedbankPay"
: "PayEx";
const dialogButton = page.getByRole("button", { name: "Open dialog" });
const dialogButton = page
.locator("#overview-dialog")
.getByRole("button", { name: "Open dialog" });

await expect(dialogButton).toBeVisible();
await expect(dialogButton).toHaveScreenshot(`${brand}-dialog-button.png`);
await dialogButton.click();
await expect(page.getByRole("dialog").locator("section")).toHaveScreenshot(
await expect(page.getByRole("dialog")).toHaveScreenshot(
`${brand}-dialog-modal.png`,
);
await expect(page.getByRole("dialog")).toHaveScreenshot(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/less/components/dialog.less
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,10 @@ dialog {
&:not(.dividers) {
// style with gray dividers
--dialog-divider: none;

.dialog-body {
padding-block: 0;
}
}

@media screen and (min-width: 768px) {
Expand Down
16 changes: 12 additions & 4 deletions src/scripts/main/dialog/dialog.e2e.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ test.beforeEach(async ({ page }) => {
test("dialog displays & closes by mouse on close (cross) button ", async ({
page,
}) => {
const dialogOpenButton = page.getByRole("button", { name: "Open dialog" });
const dialogOpenButton = page
.locator("#overview-dialog")
.getByRole("button", { name: "Open dialog" });

await dialogOpenButton.click();
await expect(page.getByRole("dialog")).toBeVisible();
Expand All @@ -20,7 +22,9 @@ test("dialog displays & closes by mouse on close (cross) button ", async ({
});

test("dialog closes by mouse on Cancel button ", async ({ page }) => {
const dialogOpenButton = page.getByRole("button", { name: "Open dialog" });
const dialogOpenButton = page
.locator("#overview-dialog")
.getByRole("button", { name: "Open dialog" });

await dialogOpenButton.click();
await expect(page.getByRole("dialog")).toBeVisible();
Expand All @@ -34,7 +38,9 @@ test("dialog closes by mouse on Cancel button ", async ({ page }) => {
test("dialog does NOT close when click outside the modal or on another buttons than the cancel OR close buttons ", async ({
page,
}) => {
const dialogOpenButton = page.getByRole("button", { name: "Open dialog" });
const dialogOpenButton = page
.locator("#overview-dialog")
.getByRole("button", { name: "Open dialog" });

await dialogOpenButton.click();
await expect(page.getByRole("dialog")).toBeVisible();
Expand All @@ -45,7 +51,9 @@ test("dialog does NOT close when click outside the modal or on another buttons t
});

test("dialog displays & closes by keyboard navigation", async ({ page }) => {
const dialogOpenButton = page.getByRole("button", { name: "Open dialog" });
const dialogOpenButton = page
.locator("#overview-dialog")
.getByRole("button", { name: "Open dialog" });

await dialogOpenButton.press("Enter");
await expect(page.getByRole("dialog")).toBeVisible();
Expand Down

0 comments on commit edfeebc

Please sign in to comment.