Skip to content

Commit

Permalink
chore(docs): Add docs about coordinartes
Browse files Browse the repository at this point in the history
  • Loading branch information
dmtrKovalenko committed Dec 2, 2021
1 parent fd6ed6d commit a735a59
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Options:

- `Optional` **button**: \"none\" \| \"left\" \| \"right\" \| \"middle\" \| \"back\" \| \"forward\"
- `Optional` **pointer**: \"mouse\" \| \"pen\"
- `Optional` x coordinate to click **x**: number
- `Optional` y coordinate to click **y**: number
- `Optional` **x**: undefined \| number ([more about coordinates](#coordinates))
- `Optional` **y**: undefined \| number ([more about coordinates](#coordinates))
- `Optional` **position**: "topLeft" | "top" | "topRight" | "left" | "center" | "right" | "bottomLeft" | "bottom" | "bottomRight"
- `Optional` **scrollBehavior**: "center" | "top" | "bottom" | "nearest" | false
- `Optional` **clickCount**: number
Expand Down Expand Up @@ -179,8 +179,8 @@ cy.get("body").realTouch({ x: 100, y: 1240 }) // touches the x & y coordinates r

Options:

- `Optional` **x**: undefined \| number **`default`** 30
- `Optional` **y**: undefined \| false \| true **`default`** true
- `Optional` **x**: undefined \| number ([more about coordinates](#coordinates))
- `Optional` **y**: undefined \| number ([more about coordinates](#coordinates))
- `Optional` **position**: "topLeft" | "top" | "topRight" | "left" | "center" | "right" | "bottomLeft" | "bottom" | "bottomRight"
- `Optional` **radius**: undefined \| number **`default`** 1
- `Optional` **radiusX**: undefined \| number **`default`** 1
Expand Down Expand Up @@ -215,8 +215,7 @@ cy.realType(text, options);
Options:

- `Optional` **delay**: undefined \| number **`default`** 30
- `Optional` **log**: undefined \| false \| true
**`default`** true
- `Optional` **log**: undefined \| false \| true **`default`** true
- `Optional` **pressDelay**: undefined \| number **`default`** 10

### cy.realSwipe
Expand Down Expand Up @@ -248,8 +247,8 @@ cy.realSwipe(direction, options);
Options:

- `Optional` **length**: undefined \| number **`default`** 10
- `Optional` x coordinate to touch **x**: number
- `Optional` y coordinate to touch **y**: number
- `Optional` **x**: undefined \| number ([more about coordinates](#coordinates))
- `Optional` **y**: undefined \| number ([more about coordinates](#coordinates))
- `Optional` **touchPosition**: "topLeft" | "top" | "topRight" | "left" | "center" | "right" | "bottomLeft" | "bottom" | "bottomRight"

## cy.realMouseDown
Expand Down Expand Up @@ -294,6 +293,14 @@ Options:
- `Optional` **position**: "topLeft" | "top" | "topRight" | "left" | "center" | "right" | "bottomLeft" | "bottom" | "bottomRight"
- `Optional` **scrollBehavior**: "center" | "top" | "bottom" | "nearest" | false

## Coordinates

Several commands from this plugin accept `{ x: number, y: number }` coordinates. There is an important note that these coordinates are relative to the whole tab in order to pass it right to the CDP. For regular elements we calculate them automatically, but if you need to pass absolute coordinates you will need to provide them yourself.

The easiest way to debug coordinates is to run any real events command and check the logged coordinates by clicking on the command.

![checking coordinates example](./coordinates-log-screenshot.png)

## FAQ

1. Why `.realHover` hovering state does not show in the visual regression services?
Expand Down
Binary file added coordinates-log-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a735a59

Please sign in to comment.