Skip to content

Commit ce63c93

Browse files
authored
Merge pull request #61 from doc-detective/v3
v3 overhaul
2 parents e702dcc + 5833d3a commit ce63c93

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+3491
-1982
lines changed

.scripts/buildSchemaReferences.js

Lines changed: 390 additions & 85 deletions
Large diffs are not rendered by default.

docs/get-started/actions/checkLink.md

Lines changed: 85 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,19 @@ description: Check if a URL returns an acceptable status code from a GET request
1111

1212
The `checkLink` action checks if a URL returns an acceptable status code from a GET request. This action is useful for verifying that a hyperlink or image URL is valid.
1313

14-
You can also specify
14+
You can specify the target URL directly as a string, or use an object for more options:
1515

16-
- an `origin` to navigate to a URL relative to a specific path.
17-
- `statusCodes` to set acceptable HTTP status codes.
16+
- `url`: (Required in object format) The URL to check. Can be a full URL or a path. If a path is provided, an `origin` must be specified either in the step or in the configuration file.
17+
- `origin`: (Optional) Protocol and domain prepended to `url` when `url` is a path. If omitted and `url` is a path, the global `origin` from the configuration file is used.
18+
- `statusCodes`: (Optional) A single integer or an array of integers representing acceptable HTTP status codes. If omitted, defaults to `[200, 301, 302, 307, 308]`.
1819

1920
> For comprehensive options, see the [`checkLink`](/docs/references/schemas/checkLink) reference.
2021
2122
## Examples
2223

2324
Here are a few ways you might use the `checkLink` action:
2425

25-
### Check if a link is valid
26+
### Check if a link is valid (string shorthand)
2627

2728
```json
2829
{
@@ -31,8 +32,46 @@ Here are a few ways you might use the `checkLink` action:
3132
"steps": [
3233
{
3334
"description": "Check if Google is up.",
34-
"action": "checkLink",
35-
"url": "https://www.google.com"
35+
"checkLink": "https://www.google.com"
36+
}
37+
]
38+
}
39+
]
40+
}
41+
```
42+
43+
### Check if a link is valid (object format)
44+
45+
```json
46+
{
47+
"tests": [
48+
{
49+
"steps": [
50+
{
51+
"description": "Check if Google is up.",
52+
"checkLink": {
53+
"url": "https://www.google.com"
54+
}
55+
}
56+
]
57+
}
58+
]
59+
}
60+
```
61+
62+
### Check for a specific status code response
63+
64+
```json
65+
{
66+
"tests": [
67+
{
68+
"steps": [
69+
{
70+
"description": "Check if Google is up, expecting only 200.",
71+
"checkLink": {
72+
"url": "https://www.google.com",
73+
"statusCodes": 200
74+
}
3675
}
3776
]
3877
}
@@ -49,9 +88,10 @@ Here are a few ways you might use the `checkLink` action:
4988
"steps": [
5089
{
5190
"description": "Check if Google is up with extra status codes.",
52-
"action": "checkLink",
53-
"url": "https://www.google.com",
54-
"statusCodes": [200, 201, 202]
91+
"checkLink": {
92+
"url": "https://www.google.com",
93+
"statusCodes": [200, 201, 202]
94+
}
5595
}
5696
]
5797
}
@@ -67,10 +107,32 @@ Here are a few ways you might use the `checkLink` action:
67107
{
68108
"steps": [
69109
{
70-
"description": "Check if Google is up with an origin.",
71-
"action": "checkLink",
72-
"url": "/search",
73-
"origin": "https://www.google.com"
110+
"description": "Check if Google search path is valid using a specific origin.",
111+
"checkLink": {
112+
"url": "/search",
113+
"origin": "https://www.google.com"
114+
}
115+
}
116+
]
117+
}
118+
]
119+
}
120+
```
121+
122+
### Check a relative link using global origin
123+
124+
Assuming a global `origin` of `https://www.google.com` is set in the configuration:
125+
126+
```json
127+
{
128+
"tests": [
129+
{
130+
"steps": [
131+
{
132+
"description": "Check if Google search path is valid using global origin.",
133+
"checkLink": {
134+
"url": "/search"
135+
}
74136
}
75137
]
76138
}
@@ -97,9 +159,10 @@ Consider the following test configuration, which checks the validity of `https:/
97159
"steps": [
98160
{
99161
"description": "Check site with a self-signed certificate",
100-
"action": "checkLink",
101-
"url": "https://self-signed.badssl.com/",
102-
"statusCodes": [200, 201, 202, 301]
162+
"checkLink": {
163+
"url": "https://self-signed.badssl.com/",
164+
"statusCodes": [200, 201, 202, 301]
165+
}
103166
}
104167
]
105168
}
@@ -134,22 +197,22 @@ To fix this issue, follow these steps:
134197
NODE_TLS_REJECT_UNAUTHORIZED=0
135198
```
136199

137-
2. Modify your test configuration to include a `setVariables` action:
200+
2. Modify your test configuration to include a `loadVariables` step (Note: `setVariables` is deprecated, use `loadVariables`):
138201

139202
```json title="bad-certificate.json" {5-8}
140203
{
141204
"tests": [
142205
{
143206
"steps": [
144207
{
145-
"action": "setVariables",
146-
"path": "ignore-certificate-problems.env"
208+
"loadVariables": "ignore-certificate-problems.env"
147209
},
148210
{
149211
"description": "Check self-signed.badssl.com",
150-
"action": "checkLink",
151-
"url": "https://self-signed.badssl.com/",
152-
"statusCodes": [200, 201, 202, 301]
212+
"checkLink": {
213+
"url": "https://self-signed.badssl.com/",
214+
"statusCodes": [200, 201, 202, 301]
215+
}
153216
}
154217
]
155218
}

docs/get-started/actions/click.md

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
---
2+
title: click
3+
layout: default
4+
nav_order: 2
5+
parent: Actions
6+
grand_parent: Tests
7+
description: Click or tap an element on the page.
8+
---
9+
10+
# click
11+
12+
The `click` action allows you to click or tap an element on the page. You can specify which mouse button to use and target elements using text or selectors.
13+
14+
The `click` action works in several ways:
15+
16+
- **String Shorthand:** The display text or selector of the element to find and click.
17+
- **Object Format:** Use an object with detailed properties for more control over the click action.
18+
19+
If you need to find an element before clicking it, consider using the [`find`](/docs/get-started/actions/find) action, which lets you locate elements and optionally click them in a single step.
20+
21+
**Note:** If you use the `click` action without specifying a target (using element text or selector), it will click the active element or the element at the current cursor position.
22+
23+
## Properties
24+
25+
When using the object format, you can specify:
26+
27+
- `button`: (Optional) Kind of click to perform. Can be `"left"`, `"right"`, or `"middle"`. Default is `"left"`.
28+
- `selector`: (Optional) CSS or XPath selector of the element to click. If combined with `elementText`, the element must match both the text and the selector.
29+
- `elementText`: (Optional) Display text of the element to click. If combined with `selector`, the element must match both the text and the selector.
30+
31+
> For comprehensive options, see the full [`click`](/docs/references/schemas/click) reference.
32+
33+
## Examples
34+
35+
Here are a few ways you might use the `click` action:
36+
37+
### Click by element text (string shorthand)
38+
39+
```json
40+
{
41+
"tests": [
42+
{
43+
"steps": [
44+
{
45+
"description": "Click on an element with text 'Submit'",
46+
"click": "Submit"
47+
}
48+
]
49+
}
50+
]
51+
}
52+
```
53+
54+
### Click by selector (string shorthand)
55+
56+
```json
57+
{
58+
"tests": [
59+
{
60+
"steps": [
61+
{
62+
"description": "Click on an element matching the CSS selector",
63+
"click": "#submit-button"
64+
}
65+
]
66+
}
67+
]
68+
}
69+
```
70+
71+
### Click an element by text (object format)
72+
73+
```json
74+
{
75+
"tests": [
76+
{
77+
"steps": [
78+
{
79+
"description": "Left-click on a button with specific text",
80+
"click": {
81+
"elementText": "Submit",
82+
"button": "left"
83+
}
84+
}
85+
]
86+
}
87+
]
88+
}
89+
```
90+
91+
### Click an element by selector (object format)
92+
93+
```json
94+
{
95+
"tests": [
96+
{
97+
"steps": [
98+
{
99+
"description": "Middle-click on an element with a specific selector",
100+
"click": {
101+
"selector": "#open-in-new-tab",
102+
"button": "middle"
103+
}
104+
}
105+
]
106+
}
107+
]
108+
}
109+
```
110+
111+
### Click an element by both selector and text
112+
113+
```json
114+
{
115+
"tests": [
116+
{
117+
"steps": [
118+
{
119+
"description": "Click on a specific element matching both selector and text",
120+
"click": {
121+
"selector": ".btn",
122+
"elementText": "Download",
123+
"button": "left"
124+
}
125+
}
126+
]
127+
}
128+
]
129+
}
130+
```
131+
132+
## Related Actions
133+
134+
- [`find`](/docs/get-started/actions/find): Find an element and optionally interact with it
135+
- [`type`](/docs/get-started/actions/type): Type text or special keys

0 commit comments

Comments
 (0)