Skip to content

Commit 85b596c

Browse files
authored
add testing sponsor lambdatest (#2438)
1 parent 8d278b3 commit 85b596c

File tree

2 files changed

+93
-38
lines changed

2 files changed

+93
-38
lines changed

src/guide/scaling-up/testing.md

Lines changed: 75 additions & 38 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}
629

@@ -40,7 +63,7 @@ Vue アプリケーションのテスト戦略を設計する際には、以下
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 @@ Vue アプリケーションでは、コンポーネントは UI の主要な構
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') // // コンポーネント内に "0 "があることを暗黙のうちに評価します
204+
getByText('0') // // コンポーネント内に "0 "があることを暗黙のうちに評価します
178205

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

181-
// インクリメントボタンにクリックイベントをディスパッチします。
182-
await fireEvent.click(button)
208+
// インクリメントボタンにクリックイベントをディスパッチします。
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>
@@ -265,6 +292,16 @@ Vitest とブラウザーベースのランナーの主な違いは、スピー
265292

266293
- [Cypress](https://www.cypress.io/) は、情報豊富なグラフィカルインターフェース、優れたデバッグ性、組み込みアサーションとスタブ、耐フレーク性(flake-resistance)、スナップショットなどの機能を備えています。また、前述の通り[コンポーネントテスト](https://docs.cypress.io/guides/component-testing/introduction)もサポートしています。Chromium ベースのブラウザー、Firefox、Electron をサポートしています。WebKit のサポートもありますが、実験的機能とされています。Cypress は MIT ライセンスですが、並列化などの一部の機能には 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 は、AI 支援によるテスト生成機能を備え、主要なブラウザと実機を対象に、E2E、アクセシビリティ、Visual Regression Test を実行するためのクラウドプラットフォームです!</div>
301+
</div>
302+
</a>
303+
</div>
304+
268305
### その他の選択肢 {#other-options-2}
269306

270307
- [Nightwatch](https://nightwatchjs.org/) は、[Selenium WebDriver](https://www.npmjs.com/package/selenium-webdriver) をベースとした E2E テストソリューションです。こちらはネイティブモバイルテストを含む、最も広い範囲のブラウザーをサポートしています。Selenium ベースのソリューションは、Playwright や Cypress よりも遅くなります。

0 commit comments

Comments
 (0)