File tree Expand file tree Collapse file tree 9 files changed +38
-11
lines changed Expand file tree Collapse file tree 9 files changed +38
-11
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,9 @@ export default async function() {
39
39
await check ( colorScheme , {
40
40
'isDarkColorScheme' : cs => cs . isDarkColorScheme
41
41
} ) ;
42
+ } catch ( e ) {
43
+ console . log ( 'Error during execution:' , e ) ;
44
+ throw e ;
42
45
} finally {
43
46
await page . close ( ) ;
44
47
}
Original file line number Diff line number Diff line change @@ -30,6 +30,9 @@ export default async function () {
30
30
await check ( page . locator ( 'h3' ) , {
31
31
header : async ( locator ) => ( await locator . textContent ( ) ) === 'Contact us' ,
32
32
} ) ;
33
+ } catch ( e ) {
34
+ console . log ( 'Error during execution:' , e ) ;
35
+ throw e ;
33
36
} finally {
34
37
await page . close ( ) ;
35
38
}
Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ export default async function () {
42
42
await check ( result , {
43
43
'result should be 25' : ( result ) => result == 25 ,
44
44
} ) ;
45
+ } catch ( e ) {
46
+ console . log ( 'Error during execution:' , e ) ;
47
+ throw e ;
45
48
} finally {
46
49
await page . close ( ) ;
47
50
}
Original file line number Diff line number Diff line change @@ -48,6 +48,9 @@ export default async function () {
48
48
return cookies . find ( ( c ) => c . name == 'sid' ) !== undefined ;
49
49
} ,
50
50
} ) ;
51
+ } catch ( e ) {
52
+ console . log ( 'Error during execution:' , e ) ;
53
+ throw e ;
51
54
} finally {
52
55
await page . close ( ) ;
53
56
}
Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ export default async function () {
29
29
await check ( page . locator ( '#dark-mode-toggle-3' ) , {
30
30
"GetAttribute('mode')" : async ( locator ) => ( await locator . getAttribute ( 'mode' ) ) === 'light' ,
31
31
} ) ;
32
+ } catch ( e ) {
33
+ console . log ( 'Error during execution:' , e ) ;
34
+ throw e ;
32
35
} finally {
33
36
await page . close ( ) ;
34
37
}
Original file line number Diff line number Diff line change @@ -33,6 +33,9 @@ export default async function () {
33
33
await check ( page . locator ( `//header//h1[@class="title"]` ) , {
34
34
'Title with XPath selector' : async ( locator ) => ( await locator . textContent ( ) ) === title ,
35
35
} ) ;
36
+ } catch ( e ) {
37
+ console . log ( 'Error during execution:' , e ) ;
38
+ throw e ;
36
39
} finally {
37
40
await page . close ( ) ;
38
41
}
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ export default async function () {
35
35
timeout : 2000 ,
36
36
} ) ;
37
37
await check ( ok , { 'waitForFunction successfully resolved' : ok . innerHTML ( ) == 'Hello' } ) ;
38
+ } catch ( e ) {
39
+ console . log ( 'Error during execution:' , e ) ;
40
+ throw e ;
38
41
} finally {
39
42
await page . close ( ) ;
40
43
}
Original file line number Diff line number Diff line change 1
- import { browser } from 'k6/experimental/browser'
2
- import { check } from 'k6'
1
+ import { browser } from 'k6/experimental/browser' ;
2
+ import { check } from 'k6' ;
3
3
4
4
export const options = {
5
5
scenarios : {
@@ -17,25 +17,28 @@ export const options = {
17
17
thresholds : {
18
18
checks : [ 'rate==1.0' ] ,
19
19
} ,
20
- }
20
+ } ;
21
21
22
22
export default async function ( ) {
23
- const page = browser . newPage ( )
23
+ const page = browser . newPage ( ) ;
24
24
25
25
try {
26
- await page . goto ( 'https://test.k6.io/my_messages.php' )
26
+ await page . goto ( 'https://test.k6.io/my_messages.php' ) ;
27
27
28
- page . locator ( 'input[name="login"]' ) . type ( 'admin' )
29
- page . locator ( 'input[name="password"]' ) . type ( '123' )
28
+ page . locator ( 'input[name="login"]' ) . type ( 'admin' ) ;
29
+ page . locator ( 'input[name="password"]' ) . type ( '123' ) ;
30
30
31
- const submitButton = page . locator ( 'input[type="submit"]' )
31
+ const submitButton = page . locator ( 'input[type="submit"]' ) ;
32
32
33
- await Promise . all ( [ page . waitForNavigation ( ) , submitButton . click ( ) ] )
33
+ await Promise . all ( [ page . waitForNavigation ( ) , submitButton . click ( ) ] ) ;
34
34
35
35
check ( page , {
36
36
header : ( p ) => p . locator ( 'h2' ) . textContent ( ) === 'Welcome, admin!' ,
37
- } )
37
+ } ) ;
38
+ } catch ( e ) {
39
+ console . log ( 'Error during execution:' , e ) ;
40
+ throw e ;
38
41
} finally {
39
- page . close ( )
42
+ page . close ( ) ;
40
43
}
41
44
}
Original file line number Diff line number Diff line change @@ -206,6 +206,9 @@ export default async function () {
206
206
await check(page.locator("h2"), {
207
207
header: async (locator) => (await locator.textContent()) == "Welcome, admin!",
208
208
});
209
+ } catch (e) {
210
+ console.log('Error during execution:', e);
211
+ throw e;
209
212
} finally {
210
213
await page.close();
211
214
}
You can’t perform that action at this time.
0 commit comments