You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/sources/k6/next/javascript-api/jslib/testing/_index.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,21 +1,21 @@
1
1
---
2
2
title: 'testing'
3
3
head_title: 'testing'
4
-
description: 'k6 testing library for advanced assertions and Playwright-compatible testing'
4
+
description: 'k6 testing library for advanced assertions with testing inspired by Playwright patterns'
5
5
weight: 00
6
6
---
7
7
8
8
# testing
9
9
10
-
The k6 testing library provides assertion capabilities for both protocol and browser testing, and aims for compatibility with Playwright's test API. The entire library is centered around the [`expect()`]({{< relref "./expect" >}}) function, which can be configured for convenience.
10
+
The k6 testing library provides assertion capabilities for both protocol and browser testing, and draws inspiration from Playwright's test API design. The entire library is centered around the [`expect()`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) function, which can be configured for convenience.
11
11
12
12
{{< admonition type="note" >}}
13
13
The k6 testing library source code can be found on [GitHub](https://github.com/grafana/k6-jslib-testing).
14
14
{{< /admonition >}}
15
15
16
16
## Features
17
17
18
-
-**Playwright-compatible assertions**: API designed for familiarity with Playwright's testing patterns
18
+
-**Playwright-inspired assertions**: API designed with patterns inspired by Playwright's testing approach
19
19
-**[Protocol and browser testing](#demo)**: Works with both HTTP/API testing and browser automation
20
20
-**[Auto-retrying assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect#retrying-assertions)**: Automatically retry assertions until they pass or timeout
21
21
-**[Soft assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect#soft-assertions)**: Continue test execution even after assertion failures
Copy file name to clipboardExpand all lines: docs/sources/k6/next/using-k6/assertions.md
+8-7Lines changed: 8 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,11 @@ weight: 04
8
8
9
9
# Assertions
10
10
11
-
k6 provides test assertions in the form of the `expect` function. Assertions validate that your application behaves as expected during testing.
11
+
k6 provides test assertions in the form of the [`expect`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) function. Assertions validate that your application behaves as expected during testing.
12
12
13
-
Define assertions by passing a value to `expect()` and chaining it with a matcher that defines your expected outcome. The library provides expressive matchers that work with both protocol testing (HTTP/API) and browser testing scenarios.
13
+
Define assertions by passing a value to [`expect()`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/k6-testing/expect) and chaining it with a matcher that defines your expected outcome. The library provides expressive matchers that work with both protocol testing [HTTP/API](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/protocols) and [browser](https://grafana.com/docs/k6/<K6_VERSION>/using-k6-browser) testing scenarios.
14
14
15
-
The assertions API is compatible with Playwright's assertion syntax, providing a fluent interface that improves test readability and reliability.
15
+
The assertions API is inspired by Playwright's assertion syntax, providing a fluent interface that improves test readability and reliability.
16
16
17
17
## Getting started
18
18
@@ -38,7 +38,6 @@ export async function browserTest() {
[Auto-retrying assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/retrying-assertions) automatically retry until conditions become true or a timeout is reached. They're designed for browser testing scenarios where elements may take time to load, update, or become interactable.
111
+
[Auto-retrying assertions](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/jslib/testing/retrying-assertions) automatically retry until conditions become true or a timeout is reached. They're designed for [browser testing](https://grafana.com/docs/k6/<K6_VERSION>/using-k6-browser) scenarios where elements may take time to load, update, or become interactable.
Soft assertions continue test execution even when they fail, marking the test as failed but allowing subsequent assertions to run:
229
+
Soft assertions continue test execution even when they fail, marking the test as failed but allowing subsequent assertions to run. Unlike [checks](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/checks), soft assertions do not measure failures or emit dedicated metrics. If you need failure-related metrics, consider using [checks](https://grafana.com/docs/k6/<K6_VERSION>/using-k6/checks) instead:
0 commit comments