Skip to content

Commit 3dfeded

Browse files
committed
feat(hf): en documentation
1 parent 25af095 commit 3dfeded

14 files changed

Lines changed: 970 additions & 2 deletions

File tree

docs/.vitepress/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,11 +315,11 @@ export default defineConfig({
315315
items: [
316316
{
317317
text: "GitHub Actions",
318-
link: "/fr/v0/guide/ci/githubActions",
318+
link: "/en/v0/guide/ci/githubActions",
319319
},
320320
{
321321
text: "GitLab CI",
322-
link: "/fr/v0/guide/ci/gitlabCI",
322+
link: "/en/v0/guide/ci/gitlabCI",
323323
},
324324
],
325325
},

docs/en/index.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
layout: home
3+
title: "@duplojs/playwright"
4+
5+
hero:
6+
name: "@duplojs/playwright"
7+
text: "Test a website, not locators"
8+
tagline: "A layer to write Playwright tests that are more readable, more stable, and closer to the business domain."
9+
image: "/images/logo.png"
10+
actions:
11+
- theme: brand
12+
text: Get Started
13+
link: "/en/v0/guide/"
14+
- theme: alt
15+
text: API Reference
16+
link: "/en/v0/api/"
17+
- theme: alt
18+
text: View on GitHub
19+
link: "https://github.com/duplojs/playwright"
20+
21+
features:
22+
- icon: "🧠"
23+
title: "Intention-oriented tests"
24+
details: "The goal is no longer to manipulate locators everywhere, but to express what the test is actually doing."
25+
- icon: "🗂️"
26+
title: "A clear structure"
27+
details: "The Website, Page, and Component model helps organize the test suite around the website rather than around isolated pieces of code."
28+
- icon: "♻️"
29+
title: "Less duplication"
30+
details: "Selectors, helpers, and shared behaviors are defined once and then reused wherever they make sense."
31+
- icon: "🔎"
32+
title: "A better reading level"
33+
details: "Tests remain understandable even as the suite grows, because they talk more about the user journey than about the Playwright implementation."
34+
- icon: "🧪"
35+
title: "Designed for integration"
36+
details: "The lib helps test the website in conditions close to reality, with a light abstraction above Playwright rather than an opaque framework."
37+
- icon: "🧱"
38+
title: DuploJS standards
39+
details: Always strongly typed, always robust, always opinionated, always saving time on unnecessary technical aspects.
40+
---

docs/en/v0/api/actions.md

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
---
2+
outline: [2, 3]
3+
prev:
4+
text: "Page"
5+
link: "/en/v0/api/page"
6+
next:
7+
text: "Assertions"
8+
link: "/en/v0/api/assertions"
9+
description: "Overview of the ready-to-use actions provided by Actions in @duplojs/playwright."
10+
---
11+
12+
# Actions
13+
14+
`Actions` groups the ready-to-use interactions applied to a component and one of its element keys.
15+
16+
In practice, this namespace avoids writing low-level Playwright calls everywhere in the tests and gives the suite a more consistent vocabulary.
17+
18+
## Simple example
19+
20+
```ts twoslash
21+
// @version: 0
22+
<!--@include: @/examples/v0/api/actions/main.ts-->
23+
```
24+
::: tip What is happening here
25+
- the component exposes named elements
26+
- `Actions.fill(...)` and `Actions.click(...)` rely on these element keys
27+
- the test stays focused on intention rather than raw Playwright calls
28+
:::
29+
30+
## What is it for?
31+
32+
`Actions` is mainly used to:
33+
34+
- share frequent interactions
35+
- keep a consistent writing style
36+
- reuse the same behaviors across several components
37+
- avoid scattering locator calls in tests
38+
39+
## click
40+
41+
```ts
42+
Actions.click(component, elementKey)
43+
```
44+
45+
Clicks a declared element of the component.
46+
47+
## forceClick
48+
49+
```ts
50+
Actions.forceClick(component, elementKey)
51+
```
52+
53+
Forces a click with `click({ force: true })`.
54+
55+
## hover
56+
57+
```ts
58+
Actions.hover(component, elementKey)
59+
```
60+
61+
Hovers over a declared element of the component.
62+
63+
## focus
64+
65+
```ts
66+
Actions.focus(component, elementKey)
67+
```
68+
69+
Focuses a declared element of the component.
70+
71+
## fill
72+
73+
```ts
74+
Actions.fill(component, elementKey, content)
75+
```
76+
77+
Fills an element with a text value.
78+
79+
## type
80+
81+
```ts
82+
Actions.type(component, elementKey, text, options?)
83+
```
84+
85+
Types text sequentially into an element.
86+
87+
## clear
88+
89+
```ts
90+
Actions.clear(component, elementKey)
91+
```
92+
93+
Clears the current value of an element.
94+
95+
## press
96+
97+
```ts
98+
Actions.press(component, elementKey, key)
99+
```
100+
101+
Sends a keyboard key to an element.
102+
103+
## check
104+
105+
```ts
106+
Actions.check(component, elementKey)
107+
```
108+
109+
Checks a compatible element.
110+
111+
## uncheck
112+
113+
```ts
114+
Actions.uncheck(component, elementKey)
115+
```
116+
117+
Unchecks a compatible element.
118+
119+
## selectOption
120+
121+
```ts
122+
Actions.selectOption(component, elementKey, values)
123+
```
124+
125+
Selects one or more options on an element.
126+
127+
## dragTo
128+
129+
```ts
130+
Actions.dragTo(component, elementKey, target, options?)
131+
```
132+
133+
Moves an element to a target locator.
134+
135+
## extractContent
136+
137+
```ts
138+
Actions.extractContent(component, elementKey)
139+
```
140+
141+
Returns the text content of an element.
142+
143+
## withStep
144+
145+
```ts
146+
Actions.withStep(label).action(component, elementKey, ...args)
147+
```
148+
149+
Returns the same actions, but grouped under a custom `test.step(...)`.
150+
The useful call is then chained on the returned wrapper.
151+
152+
## See also
153+
154+
- [`Assertions`](/en/v0/api/assertions) - for ready-to-use checks on components.
155+
- [`Component`](/en/v0/api/component) - to define the elements the actions apply to.
156+
- [`Component Interaction`](/en/v0/api/componentInteraction) - to create custom interactions if the provided actions are not enough.

docs/en/v0/api/assertions.md

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
---
2+
outline: [2, 3]
3+
prev:
4+
text: "Actions"
5+
link: "/en/v0/api/actions"
6+
next:
7+
text: "API Reference"
8+
link: "/en/v0/api/"
9+
description: "Overview of the ready-to-use assertions provided by Assertions in @duplojs/playwright."
10+
---
11+
12+
# Assertions
13+
14+
`Assertions` groups the ready-to-use checks applied to a component and one of its element keys.
15+
16+
In practice, this namespace makes it possible to write expectations that are more readable and more consistent than a sequence of Playwright calls scattered across the tests.
17+
18+
## Simple example
19+
20+
```ts twoslash
21+
// @version: 0
22+
<!--@include: @/examples/v0/api/assertions/main.ts-->
23+
```
24+
::: tip What is happening here
25+
- the component exposes named elements
26+
- `Assertions.toHaveValue(...)` and `Assertions.toBeVisible(...)` target these elements directly
27+
- the test stays focused on business verification rather than technical details
28+
:::
29+
30+
## What is it for?
31+
32+
`Assertions` is mainly used to:
33+
34+
- share frequent expectations
35+
- keep a consistent vocabulary in tests
36+
- avoid repeating the same assertion sequences
37+
- centralize enriched checks such as prior visibility
38+
39+
## toBeVisible
40+
41+
```ts
42+
Assertions.toBeVisible(component, elementKey)
43+
```
44+
45+
Checks that an element is visible.
46+
47+
## toHaveText
48+
49+
```ts
50+
Assertions.toHaveText(component, elementKey, text)
51+
```
52+
53+
Checks that an element has exactly the expected text.
54+
55+
## toContainText
56+
57+
```ts
58+
Assertions.toContainText(component, elementKey, text)
59+
```
60+
61+
Checks that an element contains the expected text.
62+
63+
## toHaveNoText
64+
65+
```ts
66+
Assertions.toHaveNoText(component, elementKey)
67+
```
68+
69+
Checks that an element has no text.
70+
71+
## toBeHidden
72+
73+
```ts
74+
Assertions.toBeHidden(component, elementKey)
75+
```
76+
77+
Checks that an element is hidden.
78+
79+
## toHaveQuantity
80+
81+
```ts
82+
Assertions.toHaveQuantity(component, elementKey, {
83+
quantity,
84+
operator?,
85+
})
86+
```
87+
88+
Checks the number of elements matching a locator.
89+
90+
## toBeEnabled
91+
92+
```ts
93+
Assertions.toBeEnabled(component, elementKey)
94+
```
95+
96+
Checks that an element is enabled.
97+
98+
## toBeChecked
99+
100+
```ts
101+
Assertions.toBeChecked(component, elementKey)
102+
```
103+
104+
Checks that an element is checked.
105+
106+
## toBeDisabled
107+
108+
```ts
109+
Assertions.toBeDisabled(component, elementKey)
110+
```
111+
112+
Checks that an element is disabled.
113+
114+
## toHaveAttribute
115+
116+
```ts
117+
Assertions.toHaveAttribute(component, elementKey, name, value?)
118+
```
119+
120+
Checks that an element has an expected attribute.
121+
122+
## toHaveClass
123+
124+
```ts
125+
Assertions.toHaveClass(component, elementKey, value)
126+
```
127+
128+
Checks that an element has the expected class.
129+
130+
## toHaveValue
131+
132+
```ts
133+
Assertions.toHaveValue(component, elementKey, value)
134+
```
135+
136+
Checks that an element has the expected value.
137+
138+
## toBeBusy
139+
140+
```ts
141+
Assertions.toBeBusy(component, elementKey)
142+
```
143+
144+
Checks that an element has `aria-busy="true"`.
145+
146+
## toBeNotBusy
147+
148+
```ts
149+
Assertions.toBeNotBusy(component, elementKey)
150+
```
151+
152+
Checks that an element has `aria-busy="false"`.
153+
154+
## withStep
155+
156+
```ts
157+
Assertions.withStep(label).assertion(component, elementKey, ...args)
158+
```
159+
160+
Returns the same assertions, but grouped under a custom `test.step(...)`.
161+
The useful call is then chained on the returned wrapper.
162+
163+
## See also
164+
165+
- [`Actions`](/en/v0/api/actions) - for ready-to-use interactions on components.
166+
- [`Component`](/en/v0/api/component) - to define the elements the assertions apply to.
167+
- [`Component Interaction`](/en/v0/api/componentInteraction) - to create custom checks if the provided assertions are not enough.

0 commit comments

Comments
 (0)