-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves the example from page to the touchscreen.tap to prevent redundancy and improve maintainability of the docs
- Loading branch information
1 parent
b03eb4d
commit 1b81abc
Showing
5 changed files
with
66 additions
and
49 deletions.
There are no files selected for viewing
This file contains 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 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
15 changes: 0 additions & 15 deletions
15
docs/sources/next/javascript-api/k6-experimental/browser/touchscreen.md
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
docs/sources/next/javascript-api/k6-experimental/browser/touchscreen/_index.md
This file contains 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,13 @@ | ||
--- | ||
title: 'Touchscreen' | ||
description: 'Browser module: Touchscreen Class' | ||
weight: 13 | ||
--- | ||
|
||
# Touchscreen | ||
|
||
The `Touchscreen` class allows to interact with a virtual touchscreen. A `Touchscreen` instance can be obtained by calling the [`page.touchscreen`](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/page/touchscreen/) method. | ||
|
||
| Method | Description | | ||
| -------------------------------------------------------------------------------------------------------------------------------------- | ---------------- | | ||
| [Touchscreen.tap()](https://grafana.com/docs/k6/<K6_VERSION>/javascript-api/k6-experimental/browser/touchscreen/tap) <BWIPT id="436"/> | Simulates a tap. | |
49 changes: 49 additions & 0 deletions
49
docs/sources/next/javascript-api/k6-experimental/browser/touchscreen/tap.md
This file contains 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,49 @@ | ||
--- | ||
title: 'tap()' | ||
description: 'Browser module: Touchscreen.tap method' | ||
--- | ||
|
||
# tap() | ||
|
||
Simulates a tap (dispatches a `touchstart` and `touchend` events) at the specified coordinates. The `x` and `y` arguments are the coordinates of the tap relative to the top-left corner of the main frame. | ||
|
||
<TableWithNestedRows> | ||
|
||
| Parameter | Type | Default | Description | | ||
| --------- | ------ | ------- | ----------------- | | ||
| x | number | `0` | The x coordinate. | | ||
| y | number | `0` | The y coordinate. | | ||
|
||
</TableWithNestedRows> | ||
|
||
### Example | ||
|
||
{{< code >}} | ||
|
||
```javascript | ||
import { browser } from 'k6/experimental/browser'; | ||
|
||
export const options = { | ||
scenarios: { | ||
browser: { | ||
executor: 'shared-iterations', | ||
options: { | ||
browser: { | ||
type: 'chromium', | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
export default async function () { | ||
const page = browser.newPage({ | ||
hasTouch: true, | ||
}); | ||
|
||
const touchscreen = page.touchscreen; | ||
await touchscreen.tap(50, 50); | ||
} | ||
``` | ||
|
||
{{< /code >}} |