File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ test-results/
66playwright-report /
77results.xml
88
9+ # Authentication state
10+ .auth /
11+
912# Temporary files
1013* .log
1114.DS_Store
Original file line number Diff line number Diff line change 6161├── fixtures/ # Test fixtures and helpers
6262│ ├── participants.ts # Multi-browser participant management
6363│ └── test-users.ts # Test user credentials
64+ ├── helpers/ # API helpers and utilities
65+ │ ├── auth.ts # Authentication (API login)
66+ │ ├── index.ts
6467├── page-objects/ # Page Object Model classes
6568│ ├── LoginPage.ts
6669│ ├── HomePage.ts
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import {
1313 ChatPanel ,
1414 PeoplePanel ,
1515} from "../page-objects" ;
16+ import { loginViaAPI } from "../helpers" ;
1617import { TEST_USERS , type TestUserKey } from "./test-users" ;
1718
1819export class Participant {
@@ -43,8 +44,9 @@ export class Participant {
4344
4445 async loginAs ( userKey : TestUserKey ) {
4546 const user = TEST_USERS [ userKey ] ;
46- await this . login . goto ( ) ;
47- await this . login . loginAndWait ( user . email , user . password ) ;
47+ await loginViaAPI ( this . page . request , user . email , user . password ) ;
48+ await this . page . goto ( "/meet/" ) ;
49+ await this . page . waitForLoadState ( "load" ) ;
4850 this . _isLoggedIn = true ;
4951 }
5052
Original file line number Diff line number Diff line change 1+ import type { APIRequestContext } from "@playwright/test" ;
2+
3+ /**
4+ * Login via Frappe API.
5+ * Sets cookies on the request context for subsequent API calls.
6+ */
7+ export async function loginViaAPI (
8+ request : APIRequestContext ,
9+ email = "Administrator" ,
10+ password = "admin" ,
11+ ) : Promise < void > {
12+ const response = await request . post ( "/api/method/login" , {
13+ form : {
14+ usr : email ,
15+ pwd : password ,
16+ } ,
17+ } ) ;
18+
19+ if ( ! response . ok ( ) ) {
20+ throw new Error (
21+ `Login failed: ${ response . status ( ) } ${ await response . text ( ) } ` ,
22+ ) ;
23+ }
24+ }
25+
26+ /**
27+ * Check if user is logged in by verifying session.
28+ */
29+ export async function isLoggedIn ( request : APIRequestContext ) : Promise < boolean > {
30+ try {
31+ const response = await request . get (
32+ "/api/method/frappe.auth.get_logged_user" ,
33+ ) ;
34+ if ( ! response . ok ( ) ) return false ;
35+
36+ const data = await response . json ( ) ;
37+ return data . message && data . message !== "Guest" ;
38+ } catch {
39+ return false ;
40+ }
41+ }
Original file line number Diff line number Diff line change 1+ export * from "./auth" ;
Original file line number Diff line number Diff line change @@ -9,7 +9,9 @@ export class HomePage {
99
1010 constructor ( page : Page ) {
1111 this . page = page ;
12- this . meetingCodeInput = page . getByRole ( "textbox" , { name : "Meeting Code" } ) ;
12+ this . meetingCodeInput = page . getByRole ( "textbox" , {
13+ name : "abcd-efgh-ijkl" ,
14+ } ) ;
1315 this . joinButton = page . getByRole ( "button" , { name : "Join" } ) ;
1416 this . startMeetingButton = page . getByRole ( "button" , {
1517 name : "Start new meeting" ,
@@ -21,6 +23,7 @@ export class HomePage {
2123
2224 async goto ( ) {
2325 await this . page . goto ( "/meet/" ) ;
26+ await this . page . waitForLoadState ( "load" ) ;
2427 }
2528
2629 async createMeeting ( type : "open" | "restricted" = "open" ) : Promise < string > {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { test, expect } from "../../fixtures";
33test . describe ( "Join Meeting" , ( ) => {
44 test ( "should join meeting from preview screen" , async ( { participant } ) => {
55 const meetingId = await participant . loginAndCreateMeeting ( "user1" ) ;
6+ await participant . joinFromPreview ( ) ;
67 await participant . toolbar . dismissBlockingToasts ( ) ;
78 const isInMeeting = await participant . toBeInMeeting ( meetingId ) ;
89 expect ( isInMeeting ) . toBe ( true ) ;
@@ -31,7 +32,6 @@ test.describe("Join Meeting", () => {
3132 // User 2 joins via meeting code
3233 const p2 = await createParticipant ( ) ;
3334 await p2 . loginAs ( "user2" ) ;
34- await p2 . home . goto ( ) ;
3535 await p2 . home . joinMeeting ( meetingId ) ;
3636 await p2 . joinFromPreview ( ) ;
3737
You can’t perform that action at this time.
0 commit comments