11import { expect , test } from "@playwright/test" ;
22
3+ import { loadHome , visitSettings } from "./utils" ;
4+
35const SIGNET_INVITE_CODE =
46 "fed11qgqzc2nhwden5te0vejkg6tdd9h8gepwvejkg6tdd9h8garhduhx6at5d9h8jmn9wshxxmmd9uqqzgxg6s3evnr6m9zdxr6hxkdkukexpcs3mn7mj3g5pc5dfh63l4tj6g9zk4er" ;
57
@@ -8,24 +10,8 @@ test.beforeEach(async ({ page }) => {
810} ) ;
911
1012test ( "fedmint join, receive, send" , async ( { page } ) => {
11- // Expect a title "to contain" a substring.
12- await expect ( page ) . toHaveTitle ( / M u t i n y W a l l e t / ) ;
13-
14- // Wait for an element matching the selector to appear in DOM.
15- await page . waitForSelector ( "text=0 SATS" ) ;
16-
17- console . log ( "Page loaded." ) ;
18-
19- // Wait for a while just to make sure we can load everything
20- await page . waitForTimeout ( 1000 ) ;
21-
22- // Navigate to settings
23- const settingsLink = await page . getByRole ( "link" , { name : "Settings" } ) ;
24-
25- settingsLink . click ( ) ;
26-
27- // Wait for settings to load
28- await page . waitForSelector ( "text=Settings" ) ;
13+ await loadHome ( page ) ;
14+ await visitSettings ( page ) ;
2915
3016 // Click "Manage Federations" link
3117 await page . click ( "text=Manage Federations" ) ;
@@ -45,21 +31,27 @@ test("fedmint join, receive, send", async ({ page }) => {
4531 await page . goBack ( ) ;
4632 await page . goBack ( ) ;
4733
48- // Make sure there's a fedimint icon
49- await expect ( page . getByRole ( "img" , { name : "community" } ) ) . toBeVisible ( ) ;
34+ // Click the top left button (it's the profile button), a child of header
35+ // TODO: better ARIA stuff
36+ await page . locator ( `header button` ) . first ( ) . click ( ) ;
5037
51- // Click the receive button
52- await page . click ( "text=Receive" ) ;
38+ // Make sure there's text that says "fedimint"
39+ await page . locator ( "text=fedimint" ) . first ( ) ;
40+
41+ // Navigate back home
42+ await page . goBack ( ) ;
43+
44+ // Click the fab button
45+ await page . locator ( "#fab" ) . click ( ) ;
46+ // Click the receive button in the fab
47+ await page . locator ( "text=Receive" ) . last ( ) . click ( ) ;
5348
5449 // Expect the url to conain receive
5550 await expect ( page ) . toHaveURL ( / .* r e c e i v e / ) ;
5651
5752 // At least one h1 should show "0 sats"
5853 await expect ( page . locator ( "h1" ) ) . toContainText ( [ "0 SATS" ] ) ;
5954
60- // At least one h2 should show "0 USD"
61- await expect ( page . locator ( "h2" ) ) . toContainText ( [ "$0 USD" ] ) ;
62-
6355 // Type 100 into the input
6456 await page . locator ( "#sats-input" ) . pressSequentially ( "100" ) ;
6557
@@ -114,16 +106,12 @@ test("fedmint join, receive, send", async ({ page }) => {
114106 // Click the "Nice" button
115107 await page . click ( "text=Nice" ) ;
116108
117- // Make sure we have 100 sats in the fedimint balance
118- await expect (
119- page
120- . locator ( "div" )
121- . filter ( { hasText : / ^ 1 0 0 e S A T S $ / } )
122- . nth ( 1 )
123- ) . toBeVisible ( ) ;
109+ // Make sure we have 100 sats in the top balance
110+ await expect ( page . locator ( "text=100 SATS" ) . first ( ) ) . toBeVisible ( ) ;
124111
125112 // Now we send
126- await page . click ( "text=Send" ) ;
113+ await page . locator ( "#fab" ) . click ( ) ;
114+ await page . locator ( "text=Send" ) . last ( ) . click ( ) ;
127115
128116 // type refund@lnurl -staging.mutinywallet.com
129117 const sendInput = await page . locator ( "input" ) ;
0 commit comments