Skip to content

Commit f9c82f4

Browse files
committed
add testing sponsor lambdatest
1 parent d0a13f7 commit f9c82f4

File tree

2 files changed

+94
-39
lines changed

2 files changed

+94
-39
lines changed

src/guide/scaling-up/testing.md

Lines changed: 76 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
<script setup>
22
import { VTCodeGroup, VTCodeGroupTab } from '@vue/theme'
33
</script>
4+
<style>
5+
.lambdatest {
6+
background-color: var(--vt-c-bg-soft);
7+
border-radius: 8px;
8+
padding: 12px 16px 12px 12px;
9+
font-size: 13px;
10+
a {
11+
display: flex;
12+
color: var(--vt-c-text-2);
13+
}
14+
img {
15+
background-color: #fff;
16+
padding: 12px 16px;
17+
border-radius: 6px;
18+
margin-right: 24px;
19+
}
20+
.testing-partner {
21+
color: var(--vt-c-text-1);
22+
font-size: 15px;
23+
font-weight: 600;
24+
}
25+
}
26+
</style>
427

528
# Testing {#testing}
629

@@ -40,7 +63,7 @@ Take for example this `increment` function:
4063

4164
```js
4265
// helpers.js
43-
export function increment (current, max = 10) {
66+
export function increment(current, max = 10) {
4467
if (current < max) {
4568
return current + 1
4669
}
@@ -129,62 +152,66 @@ Component tests should focus on the component's public interfaces rather than in
129152
<VTCodeGroup>
130153
<VTCodeGroupTab label="Vue Test Utils">
131154

132-
```js
133-
const valueSelector = '[data-testid=stepper-value]'
134-
const buttonSelector = '[data-testid=increment]'
155+
```js
156+
const valueSelector = '[data-testid=stepper-value]'
157+
const buttonSelector = '[data-testid=increment]'
135158

136-
const wrapper = mount(Stepper, {
137-
props: {
138-
max: 1
139-
}
140-
})
159+
const wrapper = mount(Stepper, {
160+
props: {
161+
max: 1
162+
}
163+
})
141164

142-
expect(wrapper.find(valueSelector).text()).toContain('0')
165+
expect(wrapper.find(valueSelector).text()).toContain('0')
143166

144-
await wrapper.find(buttonSelector).trigger('click')
167+
await wrapper.find(buttonSelector).trigger('click')
145168

146-
expect(wrapper.find(valueSelector).text()).toContain('1')
147-
```
169+
expect(wrapper.find(valueSelector).text()).toContain('1')
170+
```
148171

149172
</VTCodeGroupTab>
150173
<VTCodeGroupTab label="Cypress">
151174

152-
```js
153-
const valueSelector = '[data-testid=stepper-value]'
154-
const buttonSelector = '[data-testid=increment]'
175+
```js
176+
const valueSelector = '[data-testid=stepper-value]'
177+
const buttonSelector = '[data-testid=increment]'
155178

156-
mount(Stepper, {
157-
props: {
158-
max: 1
159-
}
160-
})
179+
mount(Stepper, {
180+
props: {
181+
max: 1
182+
}
183+
})
161184

162-
cy.get(valueSelector).should('be.visible').and('contain.text', '0')
163-
.get(buttonSelector).click()
164-
.get(valueSelector).should('contain.text', '1')
165-
```
185+
cy.get(valueSelector)
186+
.should('be.visible')
187+
.and('contain.text', '0')
188+
.get(buttonSelector)
189+
.click()
190+
.get(valueSelector)
191+
.should('contain.text', '1')
192+
```
166193

167194
</VTCodeGroupTab>
168195
<VTCodeGroupTab label="Testing Library">
169196

170-
```js
171-
const { getByText } = render(Stepper, {
172-
props: {
173-
max: 1
174-
}
175-
})
197+
```js
198+
const { getByText } = render(Stepper, {
199+
props: {
200+
max: 1
201+
}
202+
})
176203

177-
getByText('0') // Implicit assertion that "0" is within the component
204+
getByText('0') // Implicit assertion that "0" is within the component
178205

179-
const button = getByRole('button', { name: /increment/i })
206+
const button = getByRole('button', { name: /increment/i })
180207

181-
// Dispatch a click event to our increment button.
182-
await fireEvent.click(button)
208+
// Dispatch a click event to our increment button.
209+
await fireEvent.click(button)
183210

184-
getByText('1')
211+
getByText('1')
185212

186-
await fireEvent.click(button)
187-
```
213+
await fireEvent.click(button)
214+
```
188215

189216
</VTCodeGroupTab>
190217
</VTCodeGroup>
@@ -221,7 +248,7 @@ We recommend using `@vue/test-utils` for testing components in applications. `@t
221248

222249
- [Nightwatch](https://nightwatchjs.org/) is an E2E test runner with Vue Component Testing support. ([Example Project](https://github.com/nightwatchjs-community/todo-vue))
223250

224-
- [WebdriverIO](https://webdriver.io/docs/component-testing/vue) for cross-browser component testing that relies on native user interaction based on standardized automation. It can also be used with Testing Library.
251+
- [WebdriverIO](https://webdriver.io/docs/component-testing/vue) for cross-browser component testing that relies on native user interaction based on standardized automation. It can also be used with Testing Library.
225252

226253
## E2E Testing {#e2e-testing}
227254

@@ -265,6 +292,16 @@ When end-to-end (E2E) tests are run in continuous integration/deployment pipelin
265292

266293
- [Cypress](https://www.cypress.io/) has an informative graphical interface, excellent debuggability, built-in assertions, stubs, flake-resistance, and snapshots. As mentioned above, it provides stable support for [Component Testing](https://docs.cypress.io/guides/component-testing/introduction). Cypress supports Chromium-based browsers, Firefox, and Electron. WebKit support is available, but marked experimental. Cypress is MIT-licensed, but some features like parallelization require a subscription to Cypress Cloud.
267294

295+
<div class="lambdatest">
296+
<a href="https://lambdatest.com" target="_blank">
297+
<img src="/images/lambdatest.svg">
298+
<div>
299+
<div class="testing-partner">Testing Sponsor</div>
300+
<div>Lambdatest is a cloud platform for running E2E, accessibility, and visual regression tests across all major browsers and real devices, with AI assisted test generation!</div>
301+
</div>
302+
</a>
303+
</div>
304+
268305
### Other Options {#other-options-2}
269306

270307
- [Nightwatch](https://nightwatchjs.org/) is an E2E testing solution based on [Selenium WebDriver](https://www.npmjs.com/package/selenium-webdriver). This gives it the widest browser support range, including native mobile testing. Selenium-based solutions will be slower than Playwright or Cypress.

0 commit comments

Comments
 (0)