Skip to content

Commit 046a913

Browse files
committed
Update e2e
1 parent 76530e9 commit 046a913

File tree

5 files changed

+40
-28
lines changed

5 files changed

+40
-28
lines changed

src/frontend/src/lib/components/ui/Popover.svelte

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import type { HTMLAttributes } from "svelte/elements";
33
import { fade } from "svelte/transition";
44
import Dialog from "$lib/components/ui/Dialog.svelte";
5-
import { nonNullish } from "@dfinity/utils";
5+
import { isNullish, nonNullish } from "@dfinity/utils";
66
77
type Direction = "up" | "right" | "down" | "left";
88
type Align = "start" | "center" | "end";
@@ -81,6 +81,18 @@
8181
tracking = false;
8282
};
8383
});
84+
85+
// Scroll into view if out of view e.g. mobile
86+
$effect(() => {
87+
if (isNullish(popoverRef)) {
88+
return;
89+
}
90+
popoverRef.scrollIntoView({
91+
block: "nearest",
92+
inline: "nearest",
93+
behavior: "smooth",
94+
});
95+
});
8496
</script>
8597

8698
<svelte:window bind:innerWidth={windowWidth} />

src/frontend/src/lib/components/ui/Select.svelte

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -71,29 +71,29 @@
7171
onClose={() => (isOpen = false)}
7272
class={["!w-max !p-1.5 !shadow-lg", className]}
7373
>
74-
<ul class="flex flex-col">
74+
<div class="flex flex-col" role="menu">
7575
{#each options as option, index}
76-
<li class="contents" aria-label={option.label}>
77-
<Button
78-
onclick={() => handleClick(option, index)}
79-
variant="tertiary"
80-
class={[
81-
"justify-start gap-2.5 !px-3 text-start",
82-
option.selected && "[ul:not(:hover)_&]:bg-bg-primary_hover",
83-
]}
84-
>
85-
{#if nonNullish(option.icon)}
86-
{@const Icon = option.icon}
87-
<div
88-
class="text-fg-quaternary dark:text-fg-tertiary [&_svg]:size-4"
89-
>
90-
<Icon />
91-
</div>
92-
{/if}
93-
<span>{option.label}</span>
94-
</Button>
95-
</li>
76+
<Button
77+
onclick={() => handleClick(option, index)}
78+
variant="tertiary"
79+
class={[
80+
"justify-start gap-2.5 !px-3 text-start",
81+
option.selected && "[ul:not(:hover)_&]:bg-bg-primary_hover",
82+
]}
83+
role="menuitem"
84+
aria-label={option.label}
85+
>
86+
{#if nonNullish(option.icon)}
87+
{@const Icon = option.icon}
88+
<div
89+
class="text-fg-quaternary dark:text-fg-tertiary [&_svg]:size-4"
90+
>
91+
<Icon />
92+
</div>
93+
{/if}
94+
<span>{option.label}</span>
95+
</Button>
9696
{/each}
97-
</ul>
97+
</div>
9898
</Popover>
9999
{/if}

src/frontend/tests/e2e-playwright/dashboard/removePasskey.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ test("User can cancel passkey removal", async ({ page }) => {
213213
.filter({ hasText: "Current passkey" })
214214
.getByRole("button", { name: "More options" })
215215
.click();
216-
await page.getByRole("listitem", { name: "Remove" }).click();
216+
await page.getByRole("menuitem", { name: "Remove" }).click();
217217

218218
// Wait for the remove dialog to open
219219
await expect(

src/frontend/tests/e2e-playwright/dashboard/renamePasskeys.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ test("User cannot rename passkey to an empty name nor is it renamed on cancel",
152152
.filter({ hasText: "Chrome" })
153153
.getByRole("button", { name: "More options" })
154154
.click();
155-
await page.getByRole("listitem", { name: "Rename" }).click();
155+
await page.getByRole("menuitem", { name: "Rename" }).click();
156156

157157
// Wait for the rename dialog to open
158158
await expect(

src/frontend/tests/e2e-playwright/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ export const renamePasskey = async (
178178
.filter({ hasText: currentName })
179179
.getByRole("button", { name: "More options" })
180180
.click();
181-
await page.getByRole("listitem", { name: "Rename" }).click();
181+
await page.getByRole("menuitem", { name: "Rename" }).click();
182182

183183
// Wait for the rename dialog to open
184184
await expect(
@@ -189,7 +189,7 @@ export const renamePasskey = async (
189189
await expect(input).toHaveValue(currentName);
190190
await input.clear();
191191
await input.fill(nextName);
192-
await page.getByRole("button", { name: "Save" }).click();
192+
await page.getByRole("button", { name: "Save changes" }).click();
193193

194194
// Wait for the rename dialog to close
195195
await expect(
@@ -208,7 +208,7 @@ export const removePasskey = async (
208208
.filter({ hasText: name })
209209
.getByRole("button", { name: "More options" })
210210
.click();
211-
await page.getByRole("listitem", { name: "Remove" }).click();
211+
await page.getByRole("menuitem", { name: "Remove" }).click();
212212

213213
// Wait for the remove dialog to open with the correct message
214214
await expect(

0 commit comments

Comments
 (0)