File tree 1 file changed +21
-4
lines changed
1 file changed +21
-4
lines changed Original file line number Diff line number Diff line change
1
+ import { check } from 'k6'
1
2
import { browser } from 'k6/browser'
2
3
3
4
export const options = {
@@ -11,15 +12,31 @@ export const options = {
11
12
} ,
12
13
} ,
13
14
} ,
15
+ thresholds : {
16
+ checks : [ 'rate==1.0' ] ,
17
+ } ,
14
18
}
15
19
16
20
export default async function ( ) {
17
- const page = browser . newPage ( )
21
+ const page = await browser . newPage ( )
18
22
19
23
try {
20
- await page . goto ( 'https://test.k6.io/' )
21
- page . screenshot ( { path : 'screenshots/screenshot.png' } )
24
+ await page . goto ( 'https://quickpizza.grafana.com/admin' )
25
+
26
+ await page . locator ( 'input[name="username"]' ) . fill ( 'admin' )
27
+ await page . locator ( 'input[name="password"]' ) . fill ( 'admin' )
28
+
29
+ await page . waitForLoadState ( 'networkidle' ) // waits until the `networkidle` event
30
+
31
+ await page . locator ( 'button[type="submit"]' ) . click ( )
32
+
33
+ const label = await page . locator ( 'h2' )
34
+ const textContent = ( await label . textContent ( ) ) . trim ( )
35
+
36
+ check ( textContent , {
37
+ header : ( t ) => t === 'Latest pizza recommendations' ,
38
+ } )
22
39
} finally {
23
- page . close ( )
40
+ await page . close ( )
24
41
}
25
42
}
You can’t perform that action at this time.
0 commit comments