1+ const { test, expect } = require ( '@playwright/test' ) ;
2+ const { setupBrowser } = require ( '../lambdatest-mobile-setup' )
3+ const { chromium, _android } = require ( 'playwright' ) ;
4+
5+ // test.describe.configure({ mode: 'parallel' });
6+
7+ test . describe ( 'Group 1' , ( ) => {
8+ let browser ;
9+ let context ;
10+ let page ;
11+ let device ;
12+ let testInfoGlobal ;
13+
14+ test . beforeAll ( async ( ) => {
15+
16+ page = await setupBrowser ( ) ;
17+ } ) ;
18+
19+ test . afterAll ( async ( ) => {
20+
21+ if ( testInfoGlobal ) {
22+ const testStatus = {
23+ action : 'setTestStatus' ,
24+ arguments : {
25+ status : testInfoGlobal . status ,
26+ remark : testInfoGlobal . error ?. stack || testInfoGlobal . error ?. message ,
27+ }
28+ }
29+ await page . evaluate ( ( ) => { } ,
30+ `lambdatest_action: ${ JSON . stringify ( testStatus ) } ` )
31+ }
32+
33+ await page ?. close ( ) ;
34+ await context ?. close ( ) ;
35+ await browser ?. close ( ) ;
36+ await device ?. close ( ) ;
37+ } ) ;
38+
39+
40+ test ( 'test 1 Search LambdaTest on DuckDuckGo' , async ( { } , testInfo ) => {
41+ testInfoGlobal = testInfo ;
42+ await page . goto ( 'https://duckduckgo.com' )
43+ let element = await page . locator ( "[name=\"q\"]" ) ;
44+ await element . click ( ) ;
45+ await element . type ( "LambdaTest" ) ;
46+ await element . press ( "Enter" ) ;
47+ const title = await page . title ( )
48+
49+
50+ console . log ( 'Page title:: ' , title )
51+ // Use the expect API for assertions provided by playwright
52+ expect ( title ) . toEqual ( expect . stringContaining ( 'LambdaTest' ) )
53+ } )
54+
55+ test ( 'test 2 Search LambdaTest on DuckDuckGo' , async ( { } , testInfo ) => {
56+ testInfoGlobal = testInfo ;
57+ await page . goto ( 'https://duckduckgo.com' )
58+ let element = await page . locator ( "[name=\"q\"]" ) ;
59+ await element . click ( ) ;
60+ await element . type ( "LambdaTest" ) ;
61+ await element . press ( "Enter" ) ;
62+ const title = await page . title ( )
63+
64+
65+ console . log ( 'Page title:: ' , title )
66+ // Use the expect API for assertions provided by playwright
67+ expect ( title ) . toEqual ( expect . stringContaining ( 'LambdaTest' ) )
68+ } )
69+ } ) ;
0 commit comments