-
Notifications
You must be signed in to change notification settings - Fork 239
k6 Studio, add page for browser recording feature #1934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
6df1656
Add page for browser recording
heitortsergent eb095de
Reorder pages
heitortsergent fe4b415
Add mention of k6 OSS browser docs
heitortsergent a030278
Update studio homepage to mention browser recording
heitortsergent fe8fbf2
Update Recorder to mention browser events
heitortsergent 6bcd8da
Update docs/sources/k6-studio/components/recorder.md
Llandy3d File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
--- | ||
title: 'Record browser events' | ||
description: 'Learn how to use k6 Studio to record browser events, create text assertions, and export browser test scripts.' | ||
weight: 350 | ||
--- | ||
|
||
# Record browser events | ||
|
||
{{< docs/public-preview product="Browser recording" >}} | ||
|
||
When creating k6 test scripts, there are two main types of tests: | ||
|
||
- **Protocol-level tests**: test your application and services by making requests to different protocols such as HTTP, WebSockets, etc. | ||
- **Browser tests**: test your browser-based application by interacting with browser-level APIs. Interact with elements on the page, such as clicking buttons, navigating links, or validating text elements. | ||
|
||
Grafana k6 Studio automatically records both protocol requests and browser events when you start a recording. On this page, you'll learn how to inspect browser events, create assertions, and export a browser script. | ||
|
||
## Start a browser recording | ||
|
||
Browser events are recorded automatically during a recording. To start a recording: | ||
|
||
- Open Grafana k6 Studio. | ||
- Click **Record flow**. | ||
- Type a URL and make sure that the **Capture browser events** checkbox is selected. | ||
- Click **Start recording** | ||
|
||
A browser window opens, and Grafana k6 Studio starts recording the requests and events. In the browser, you can see a set of controls in the top center. The controls are: | ||
|
||
- Inspect elements | ||
- Add assertions | ||
- Toggle event list | ||
|
||
## View browser events | ||
|
||
There are two ways to view browser events: | ||
|
||
- During a recording, click **Toggle event list** at the top of the page. A tab appears on the right side of the browser with a list of all events that Grafana k6 Studio has recorded in the session. | ||
- During or after a recording, go to Grafana k6 Studio and click the **Browser events** tab at the top. This list is automatically updated with any browser events if the recording is still active. After you finish a recording, you can view all the browser events recorded for that session. | ||
|
||
## Create text assertions | ||
|
||
Assertions are a way to validate that the content displayed on the page is what you expect it to be. Grafana k6 Studio supports creating text assertions for content on a page. | ||
|
||
To create a text assertion: | ||
|
||
- Start a recording. | ||
- Click the **Add text assertions** button in the controls at the top of the browser. | ||
- Highlight any text on the page. | ||
- In the **Add text assertion** dialog box: | ||
- The **Element** and **Contains** fields are automatically filled with the text you selected. You can edit this manually or click outside the dialog box to - dismiss it. | ||
- Click **Add** to create the text assertion. | ||
|
||
After you create the assertion, an event is added to the browser events list. | ||
|
||
## Export a browser event test script | ||
|
||
Browser events generate a separate test script from the default protocol-level test created by Grafana k6 Studio, as they test different aspects of an application. | ||
|
||
To export a browser event test script: | ||
|
||
- Open a test recording. | ||
- Click the **Browser events** tab at the top. | ||
- Click **Export script** on the top right. | ||
- In the **Export script** dialog box: | ||
- Type in a name for your script. | ||
- Click **Export**. | ||
|
||
After you save your script, you can view it under the **Scripts** section. Refer to [Using k6 browser](https://grafana.com/docs/k6/latest/using-k6-browser/) for more details on how to customize your browser test script. | ||
|
||
## Disable browser events | ||
|
||
To disable browser events from being recorded: | ||
|
||
- Open Grafana k6 Studio. | ||
- Click **Record flow**. | ||
- On the **Record your user flow** page, clear the **Capture browser events** checkbox. | ||
|
||
When you disable browser events, the browser events control at the top of the page isn't displayed. | ||
|
||
## Supported browser events | ||
|
||
- Navigating via the address bar. | ||
- Reloading a page. | ||
- Clicking an element. | ||
- Typing into a text input. | ||
- Selecting or clearing a checkbox. | ||
- Selecting an option in a radio group. | ||
- Selecting one or more items in a drop-down or list. | ||
- Submitting a form. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are able to disable the entire feature, including related UI elements in k6 Studio, by going in to "Settings -> Recorder". I'm not sure if it's worth mentioning here though, because it's sort of an escape hatch if something goes really bad.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mhm. Is there an intended use case for using the Settings option, other than if something goes really bad?