Skip to content

Commit 53ee5af

Browse files
authored
New action JSON schema references (#92)
* Add JSON schema plugin * Added schema references to guide pages
1 parent 1a68014 commit 53ee5af

20 files changed

+296
-6
lines changed

docs/get-started/actions/checkLink.md renamed to docs/get-started/actions/checkLink.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests,
77
description: Check if a URL returns an acceptable status code from a GET request.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# checkLink
1114

1215
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.
@@ -230,3 +233,7 @@ After applying these changes, the test should pass:
230233
"resultDescription": "Returned 200"
231234
}
232235
```
236+
237+
## Schema reference
238+
239+
<JSONSchemaViewer schema={ schemas.checkLink_v3 } />

docs/get-started/actions/click.md renamed to docs/get-started/actions/click.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests
77
description: Click or tap an element on the page.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# click
1114

1215
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.
@@ -133,3 +136,7 @@ Here are a few ways you might use the `click` action:
133136

134137
- [`find`](/docs/get-started/actions/find): Find an element and optionally interact with it
135138
- [`type`](/docs/get-started/actions/type): Type text or special keys
139+
140+
## Schema reference
141+
142+
<JSONSchemaViewer schema={ schemas.click_v3 } />

docs/get-started/actions/dragAndDrop.mdx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,19 @@ grand_parent: Tests
77
description: Drag an element to a target location.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# dragAndDrop
1114

1215
The `dragAndDrop` action allows you to drag an element and drop it at a target location. This is useful for testing drag-and-drop interfaces, reordering lists, moving items between containers, and other interactive UI elements.
1316

1417
The `dragAndDrop` action requires both a source and target element, which can be specified using element text, CSS/XPath selectors, or detailed objects with additional configuration options.
1518

1619
:::info
20+
1721
Drag-and-drop has many different implementations, and Doc Detective wants to support them all. If you find that your specific use case isn't working, don't give up! Please [open an issue](https://github.com/doc-detective/doc-detective/issues) or [start a thread on our Discord](https://discord.gg/2M7wXEThfF).
22+
1823
:::
1924

2025
## Use Cases
@@ -43,7 +48,6 @@ When using detailed objects for `source` or `target`, you can specify:
4348
- `selector`: (Optional) CSS or XPath selector of the element. If combined with `elementText`, the element must match both the text and the selector.
4449
- `timeout`: (Optional) Maximum duration in milliseconds to wait for this specific element to exist.
4550

46-
4751
> For comprehensive options, see the full [`dragAndDrop`](/docs/references/schemas/draganddrop) reference.
4852
4953
## Examples
@@ -100,4 +104,8 @@ Here are several ways you might use the `dragAndDrop` action:
100104

101105
- [`click`](/docs/get-started/actions/click): Click elements to interact with them
102106
- [`find`](/docs/get-started/actions/find): Locate elements before performing other actions
103-
- [`wait`](/docs/get-started/actions/wait): Add delays for animations to complete
107+
- [`wait`](/docs/get-started/actions/wait): Add delays for animations to complete
108+
109+
## Schema reference
110+
111+
<JSONSchemaViewer schema={ schemas.dragAndDrop_v3 } />

docs/get-started/actions/find.md renamed to docs/get-started/actions/find.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests
77
description: Locate and interact with an element on the page.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# find
1114

1215
The `find` action locates an element in the current interface based on its display text or a CSS/XPath selector. After finding the element, you can optionally interact with it, such as clicking it or typing into it.
@@ -168,3 +171,7 @@ Here are a few ways you might use the `find` action:
168171
]
169172
}
170173
```
174+
175+
## Schema reference
176+
177+
<JSONSchemaViewer schema={ schemas.find_v3 } />

docs/get-started/actions/goTo.md renamed to docs/get-started/actions/goTo.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests
77
description: Navigate to a specified URL.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# goTo
1114

1215
The `goTo` action navigates the browser to a specified URL. This is typically used to start a test at a specific page or navigate between pages during a test.
@@ -98,3 +101,7 @@ Assumes the browser is currently at `https://example.com` or a global `origin` i
98101
]
99102
}
100103
```
104+
105+
## Schema reference
106+
107+
<JSONSchemaViewer schema={ schemas.goTo_v3 } />

docs/get-started/actions/httpRequest.md renamed to docs/get-started/actions/httpRequest.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests
77
description: Perform a generic HTTP request, for example to an API.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# httpRequest
1114

1215
The `httpRequest` action makes arbitrary HTTP calls, allowing you to interact with and validate APIs or other web services directly within your tests.
@@ -277,3 +280,8 @@ Assumes an OpenAPI definition with operation ID `getUserById` is loaded.
277280
}
278281
]
279282
}
283+
```
284+
285+
## Schema reference
286+
287+
<JSONSchemaViewer schema={ schemas.httpRequest_v3 } />

docs/get-started/actions/loadCookie.mdx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests
77
description: Load a cookie from a file or environment variable into the browser.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# loadCookie
1114

1215
The `loadCookie` action loads a cookie from a file or environment variable into the browser. This action is useful for restoring authentication sessions, user preferences, or other stateful information that was previously saved using the [`saveCookie`](/docs/get-started/actions/saveCookie) action.
@@ -192,4 +195,8 @@ Load a cookie with detailed configuration:
192195
## Related actions
193196

194197
- [`saveCookie`](/docs/get-started/actions/saveCookie): Save a browser cookie to a file or environment variable
195-
- [`loadVariables`](/docs/get-started/actions/loadVariables): Load environment variables from .env files
198+
- [`loadVariables`](/docs/get-started/actions/loadVariables): Load environment variables from .env files
199+
200+
## Schema reference
201+
202+
<JSONSchemaViewer schema={ schemas.loadCookie_v3 } />

docs/get-started/actions/loadVariables.md renamed to docs/get-started/actions/loadVariables.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests
77
description: Load environment variables from a .env file.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# loadVariables
1114

1215
The `loadVariables` action loads environment variables from a specified `.env` file. This action is useful for accessing sensitive information, such as API keys or other credentials, without hardcoding them into your tests. Variables loaded this way are available for use in subsequent steps within the same test.
@@ -52,3 +55,7 @@ You can load these variables using the `loadVariables` action:
5255
]
5356
}
5457
```
58+
59+
## Schema reference
60+
61+
<JSONSchemaViewer schema={ schemas.loadVariables_v3 } />

docs/get-started/actions/record.md renamed to docs/get-started/actions/record.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests
77
description: Start capturing a video of test execution.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# record
1114

1215
The `record` action starts recording the browser viewport as a video file (MP4, WebM, or GIF). This is useful for debugging failed tests or creating multimedia documentation. Recording continues until a `stopRecord` step is encountered.
@@ -113,3 +116,8 @@ Records to `test_video.gif` in the `output/gifs` directory, overwriting if it ex
113116
}
114117
]
115118
}
119+
```
120+
121+
## Schema reference
122+
123+
<JSONSchemaViewer schema={ schemas.record_v3 } />

docs/get-started/actions/runCode.md renamed to docs/get-started/actions/runCode.mdx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ grand_parent: Tests
77
description: Assemble and run code snippets in various languages.
88
---
99

10+
import { schemas } from "doc-detective-common";
11+
import JSONSchemaViewer from "@theme/JSONSchemaViewer";
12+
1013
# runCode
1114

1215
The `runCode` action executes a code snippet in a specified language (like JavaScript, Python, Bash, etc.) on the local machine and evaluates the results. This allows embedding executable code directly within your tests.
@@ -136,3 +139,7 @@ The first step runs Python code to print "setup", validates the output using a r
136139
]
137140
}
138141
```
142+
143+
## Schema reference
144+
145+
<JSONSchemaViewer schema={ schemas.runCode_v3 } />

0 commit comments

Comments
 (0)