@wdio/cli 9.16.2 → 9.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/commands/index.d.ts.map +1 -1
- package/build/commands/repl.d.ts.map +1 -1
- package/build/commands/run.d.ts +1 -1
- package/build/commands/run.d.ts.map +1 -1
- package/build/constants.d.ts +0 -235
- package/build/constants.d.ts.map +1 -1
- package/build/index.js +120 -1737
- package/build/interface.d.ts.map +1 -1
- package/build/types.d.ts +2 -74
- package/build/types.d.ts.map +1 -1
- package/build/utils.d.ts +1 -73
- package/build/utils.d.ts.map +1 -1
- package/build/watcher.d.ts.map +1 -1
- package/package.json +7 -7
- package/build/commands/config.d.ts +0 -74
- package/build/commands/config.d.ts.map +0 -1
- package/build/commands/install.d.ts +0 -12
- package/build/commands/install.d.ts.map +0 -1
- package/build/install.d.ts +0 -4
- package/build/install.d.ts.map +0 -1
- package/build/templates/EjsHelpers.d.ts +0 -18
- package/build/templates/EjsHelpers.d.ts.map +0 -1
- package/build/templates/exampleFiles/browser/Component.css.ejs +0 -121
- package/build/templates/exampleFiles/browser/Component.lit.ejs +0 -154
- package/build/templates/exampleFiles/browser/Component.lit.test.ejs +0 -24
- package/build/templates/exampleFiles/browser/Component.preact.ejs +0 -28
- package/build/templates/exampleFiles/browser/Component.preact.test.ejs +0 -59
- package/build/templates/exampleFiles/browser/Component.react.ejs +0 -29
- package/build/templates/exampleFiles/browser/Component.react.test.ejs +0 -58
- package/build/templates/exampleFiles/browser/Component.solid.ejs +0 -28
- package/build/templates/exampleFiles/browser/Component.solid.test.ejs +0 -58
- package/build/templates/exampleFiles/browser/Component.stencil.ejs +0 -43
- package/build/templates/exampleFiles/browser/Component.stencil.test.ejs +0 -45
- package/build/templates/exampleFiles/browser/Component.svelte.ejs +0 -47
- package/build/templates/exampleFiles/browser/Component.svelte.test.ejs +0 -58
- package/build/templates/exampleFiles/browser/Component.vue.ejs +0 -34
- package/build/templates/exampleFiles/browser/Component.vue.test.ejs +0 -62
- package/build/templates/exampleFiles/browser/standalone.test.ejs +0 -13
- package/build/templates/exampleFiles/cucumber/features/login.feature +0 -12
- package/build/templates/exampleFiles/cucumber/step_definitions/steps.js.ejs +0 -55
- package/build/templates/exampleFiles/mochaJasmine/test.e2e.js.ejs +0 -11
- package/build/templates/exampleFiles/pageobjects/login.page.js.ejs +0 -45
- package/build/templates/exampleFiles/pageobjects/page.js.ejs +0 -17
- package/build/templates/exampleFiles/pageobjects/secure.page.js.ejs +0 -20
- package/build/templates/exampleFiles/serenity-js/common/config/serenity.properties.ejs +0 -1
- package/build/templates/exampleFiles/serenity-js/common/serenity/github-api/GitHubStatus.ts.ejs +0 -41
- package/build/templates/exampleFiles/serenity-js/common/serenity/todo-list-app/TodoList.ts.ejs +0 -100
- package/build/templates/exampleFiles/serenity-js/common/serenity/todo-list-app/TodoListItem.ts.ejs +0 -36
- package/build/templates/exampleFiles/serenity-js/cucumber/step-definitions/steps.ts.ejs +0 -37
- package/build/templates/exampleFiles/serenity-js/cucumber/support/parameter.config.ts.ejs +0 -18
- package/build/templates/exampleFiles/serenity-js/cucumber/todo-list/completing_items.feature.ejs +0 -23
- package/build/templates/exampleFiles/serenity-js/cucumber/todo-list/narrative.md.ejs +0 -17
- package/build/templates/exampleFiles/serenity-js/jasmine/example.spec.ts.ejs +0 -86
- package/build/templates/exampleFiles/serenity-js/mocha/example.spec.ts.ejs +0 -88
- package/build/templates/snippets/afterTest.ejs +0 -20
- package/build/templates/snippets/capabilities.ejs +0 -57
- package/build/templates/snippets/cucumber.ejs +0 -50
- package/build/templates/snippets/electronTest.js.ejs +0 -7
- package/build/templates/snippets/jasmine.ejs +0 -20
- package/build/templates/snippets/macosTest.js.ejs +0 -11
- package/build/templates/snippets/mocha.ejs +0 -14
- package/build/templates/snippets/reporters.ejs +0 -14
- package/build/templates/snippets/serenity.ejs +0 -18
- package/build/templates/snippets/services.ejs +0 -18
- package/build/templates/snippets/testWithPO.js.ejs +0 -22
- package/build/templates/snippets/testWithoutPO.js.ejs +0 -19
- package/build/templates/snippets/vscodeTest.js.ejs +0 -9
- package/build/templates/wdio.conf.tpl.ejs +0 -412
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import { LitElement, css, html } from 'lit'
|
|
2
|
-
<%- answers.isUsingTypeScript ? `import { customElement, property } from 'lit/decorators.js'\n` : ''
|
|
3
|
-
%>
|
|
4
|
-
/**
|
|
5
|
-
* An example element.
|
|
6
|
-
*
|
|
7
|
-
* @slot - This element has a slot
|
|
8
|
-
* @csspart button - The button
|
|
9
|
-
*/
|
|
10
|
-
<%- answers.isUsingTypeScript ? `@customElement('my-element')\n` : ''
|
|
11
|
-
%>export class MyElement extends LitElement {<%
|
|
12
|
-
if (answers.isUsingTypeScript) { %>
|
|
13
|
-
/**
|
|
14
|
-
* Copy for the read the docs hint.
|
|
15
|
-
*/
|
|
16
|
-
@property()
|
|
17
|
-
docsHint = 'Click on the WebdriverIO logo to learn more!'
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* The number of times the button has been clicked.
|
|
21
|
-
*/
|
|
22
|
-
@property({ type: Number })
|
|
23
|
-
count = 0
|
|
24
|
-
<% } else { %>
|
|
25
|
-
static get properties() {
|
|
26
|
-
return {
|
|
27
|
-
/**
|
|
28
|
-
* Copy for the read the docs hint.
|
|
29
|
-
*/
|
|
30
|
-
docsHint: { type: String },
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* The number of times the button has been clicked.
|
|
34
|
-
*/
|
|
35
|
-
count: { type: Number },
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
constructor() {
|
|
40
|
-
super()
|
|
41
|
-
this.docsHint = 'Click on the WebdriverIO logo to learn more!'
|
|
42
|
-
this.count = 0
|
|
43
|
-
}
|
|
44
|
-
<% } %>
|
|
45
|
-
render() {
|
|
46
|
-
return html`
|
|
47
|
-
<div>
|
|
48
|
-
<a href="https://webdriver.io/docs/component-testing" target="_blank">
|
|
49
|
-
<img src="https://webdriver.io/assets/images/robot-3677788dd63849c56aa5cb3f332b12d5.svg" className="logo"
|
|
50
|
-
alt="WebdriverIO logo" />
|
|
51
|
-
</a>
|
|
52
|
-
</div>
|
|
53
|
-
<h1>
|
|
54
|
-
<slot></slot>
|
|
55
|
-
</h1>
|
|
56
|
-
<div class="card">
|
|
57
|
-
<button @click=${this._onClick} part="button">
|
|
58
|
-
count is ${this.count}
|
|
59
|
-
</button>
|
|
60
|
-
<p>
|
|
61
|
-
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `ts` : 'js' %></code> and save to test HMR
|
|
62
|
-
</p>
|
|
63
|
-
</div>
|
|
64
|
-
<p class="read-the-docs">${this.docsHint}</p>
|
|
65
|
-
`
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
<%- answers.isUsingTypeScript ? `private ` : ''%>_onClick() {
|
|
69
|
-
this.count++
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
<% if (answers.isUsingTypeScript) { %>static styles = css`<% } else { %>static get styles() {
|
|
73
|
-
return css`<% } %>
|
|
74
|
-
:host {
|
|
75
|
-
max-width: 1280px;
|
|
76
|
-
margin: 0 auto;
|
|
77
|
-
padding: 2rem;
|
|
78
|
-
text-align: center;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.logo {
|
|
82
|
-
height: 6em;
|
|
83
|
-
padding: 1.5em;
|
|
84
|
-
will-change: filter;
|
|
85
|
-
transition: filter 300ms;
|
|
86
|
-
}
|
|
87
|
-
.logo:hover {
|
|
88
|
-
filter: drop-shadow(0 0 2em #646cffaa);
|
|
89
|
-
}
|
|
90
|
-
.logo.lit:hover {
|
|
91
|
-
filter: drop-shadow(0 0 2em #325cffaa);
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
.card {
|
|
95
|
-
padding: 2em;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.read-the-docs {
|
|
99
|
-
color: #888;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
h1 {
|
|
103
|
-
font-size: 3.2em;
|
|
104
|
-
line-height: 1.1;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
a {
|
|
108
|
-
font-weight: 500;
|
|
109
|
-
color: #646cff;
|
|
110
|
-
text-decoration: inherit;
|
|
111
|
-
}
|
|
112
|
-
a:hover {
|
|
113
|
-
color: #535bf2;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
button {
|
|
117
|
-
border-radius: 8px;
|
|
118
|
-
border: 1px solid transparent;
|
|
119
|
-
padding: 0.6em 1.2em;
|
|
120
|
-
font-size: 1em;
|
|
121
|
-
font-weight: 500;
|
|
122
|
-
font-family: inherit;
|
|
123
|
-
background-color: #1a1a1a;
|
|
124
|
-
cursor: pointer;
|
|
125
|
-
transition: border-color 0.25s;
|
|
126
|
-
}
|
|
127
|
-
button:hover {
|
|
128
|
-
border-color: #646cff;
|
|
129
|
-
}
|
|
130
|
-
button:focus,
|
|
131
|
-
button:focus-visible {
|
|
132
|
-
outline: 4px auto -webkit-focus-ring-color;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
@media (prefers-color-scheme: light) {
|
|
136
|
-
a:hover {
|
|
137
|
-
color: #747bff;
|
|
138
|
-
}
|
|
139
|
-
button {
|
|
140
|
-
background-color: #f9f9f9;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
`
|
|
144
|
-
<% if (!answers.isUsingTypeScript) { %>}<% } %>
|
|
145
|
-
}
|
|
146
|
-
<% if (answers.isUsingTypeScript) { %>
|
|
147
|
-
declare global {
|
|
148
|
-
interface HTMLElementTagNameMap {
|
|
149
|
-
'my-element': MyElement
|
|
150
|
-
}
|
|
151
|
-
}<%
|
|
152
|
-
} else { %>
|
|
153
|
-
window.customElements.define('my-element', MyElement)<%
|
|
154
|
-
} %>
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { html, render } from 'lit'
|
|
2
|
-
import { $, expect } from '@wdio/globals'
|
|
3
|
-
|
|
4
|
-
import './Component.js'
|
|
5
|
-
import './Component.css'
|
|
6
|
-
|
|
7
|
-
describe('Lit component testing', () => {
|
|
8
|
-
it('should increment value on click', async () => {
|
|
9
|
-
render(
|
|
10
|
-
html`<my-element id="root">WebdriverIO Component Testing</my-element>`,
|
|
11
|
-
document.body
|
|
12
|
-
)
|
|
13
|
-
|
|
14
|
-
const button = await $('my-element').$('button')
|
|
15
|
-
await expect(button).toHaveText('count is 0')
|
|
16
|
-
|
|
17
|
-
await button.click()
|
|
18
|
-
await button.click()
|
|
19
|
-
|
|
20
|
-
await expect(button).toHaveText('count is 2')<%-
|
|
21
|
-
answers.includeVisualTesting ? `
|
|
22
|
-
await expect(button).toMatchElementSnapshot('counterButton')` : '' %>
|
|
23
|
-
})
|
|
24
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { useState } from 'preact/hooks'
|
|
2
|
-
import './Component.css'
|
|
3
|
-
|
|
4
|
-
export default function ExampleComponent () {
|
|
5
|
-
const [count, setCount] = useState(0)
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<>
|
|
9
|
-
<div>
|
|
10
|
-
<a href="https://webdriver.io/docs/component-testing" target="_blank">
|
|
11
|
-
<img src="https://webdriver.io/assets/images/robot-3677788dd63849c56aa5cb3f332b12d5.svg" className="logo" alt="WebdriverIO logo" />
|
|
12
|
-
</a>
|
|
13
|
-
</div>
|
|
14
|
-
<h1>WebdriverIO Component Testing</h1>
|
|
15
|
-
<div class="card">
|
|
16
|
-
<button onClick={() => setCount((count) => count + 1)}>
|
|
17
|
-
count is {count}
|
|
18
|
-
</button>
|
|
19
|
-
<p>
|
|
20
|
-
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `tsx` : 'jsx' %></code> and save to test HMR
|
|
21
|
-
</p>
|
|
22
|
-
</div>
|
|
23
|
-
<p class="read-the-docs">
|
|
24
|
-
Click on the Vite and Preact logos to learn more
|
|
25
|
-
</p>
|
|
26
|
-
</>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const harnessImport = answers.installTestingLibrary
|
|
3
|
-
? `import { h } from 'preact'\nimport { render, screen, fireEvent } from '@testing-library/preact'`
|
|
4
|
-
: `import { h, render } from 'preact'\nimport htm from 'https://esm.sh/htm'`
|
|
5
|
-
const renderCommand = answers.installTestingLibrary
|
|
6
|
-
? `render(<ExampleComponent />)`
|
|
7
|
-
: "render(html`<${ExampleComponent} />`, container)"
|
|
8
|
-
%>
|
|
9
|
-
import { expect, $ } from '@wdio/globals'
|
|
10
|
-
<%- harnessImport %>
|
|
11
|
-
<% if (answers.installTestingLibrary) { %>
|
|
12
|
-
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
13
|
-
expect.extend(matchers)
|
|
14
|
-
<% } else { %>
|
|
15
|
-
// Initialize htm with Preact
|
|
16
|
-
const html = htm.bind(h);
|
|
17
|
-
<% } %>
|
|
18
|
-
import ExampleComponent from './Component'
|
|
19
|
-
|
|
20
|
-
describe('Preact Component Tests', () => {
|
|
21
|
-
<% if (answers.installTestingLibrary) { %>
|
|
22
|
-
it('should test component with Testing Library', async () => {
|
|
23
|
-
render(<ExampleComponent />)
|
|
24
|
-
const component = screen.getByText(/count is 0/i)
|
|
25
|
-
expect(component).toBeInTheDocument()
|
|
26
|
-
|
|
27
|
-
await fireEvent.click(component)
|
|
28
|
-
await fireEvent.click(component)
|
|
29
|
-
|
|
30
|
-
expect(screen.getByText(/count is 2/i)).toBeInTheDocument()
|
|
31
|
-
})
|
|
32
|
-
<% } else { %>
|
|
33
|
-
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
34
|
-
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
container = document.createElement('div')
|
|
37
|
-
document.body.appendChild(container)
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
afterEach(() => {
|
|
41
|
-
container?.remove()
|
|
42
|
-
})
|
|
43
|
-
<% } %>
|
|
44
|
-
|
|
45
|
-
it('should test component with WebdriverIO', async () => {
|
|
46
|
-
<%- renderCommand %>
|
|
47
|
-
|
|
48
|
-
const component = await $('button*=count is')
|
|
49
|
-
await expect(component).toBePresent()
|
|
50
|
-
await expect(component).toHaveText('count is 0')
|
|
51
|
-
|
|
52
|
-
await component.click()
|
|
53
|
-
await component.click()
|
|
54
|
-
|
|
55
|
-
await expect(component).toHaveText('count is 2')<%-
|
|
56
|
-
answers.includeVisualTesting ? `
|
|
57
|
-
await expect(component).toMatchElementSnapshot('counterButton')` : '' %>
|
|
58
|
-
})
|
|
59
|
-
})
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { useState } from 'react'
|
|
2
|
-
|
|
3
|
-
import './Component.css'
|
|
4
|
-
|
|
5
|
-
export default function ExampleComponent () {
|
|
6
|
-
const [count, setCount] = useState(0)
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<div id="root">
|
|
10
|
-
<div>
|
|
11
|
-
<a href="https://webdriver.io/docs/component-testing" target="_blank">
|
|
12
|
-
<img src="https://webdriver.io/assets/images/robot-3677788dd63849c56aa5cb3f332b12d5.svg" className="logo" alt="WebdriverIO logo" />
|
|
13
|
-
</a>
|
|
14
|
-
</div>
|
|
15
|
-
<h1>WebdriverIO Component Testing</h1>
|
|
16
|
-
<div className="card">
|
|
17
|
-
<button onClick={() => setCount((count) => count + 1)}>
|
|
18
|
-
count is {count}
|
|
19
|
-
</button>
|
|
20
|
-
<p>
|
|
21
|
-
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `tsx` : 'jsx' %></code> and save to test HMR
|
|
22
|
-
</p>
|
|
23
|
-
</div>
|
|
24
|
-
<p className="read-the-docs">
|
|
25
|
-
Click on the WebdriverIO logo to learn more
|
|
26
|
-
</p>
|
|
27
|
-
</div>
|
|
28
|
-
)
|
|
29
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const harnessImport = answers.installTestingLibrary
|
|
3
|
-
? `import { render, screen, fireEvent } from '@testing-library/react'`
|
|
4
|
-
: `import { createRoot } from 'react-dom/client'`
|
|
5
|
-
const renderCommand = answers.installTestingLibrary
|
|
6
|
-
? `render(<ExampleComponent />)`
|
|
7
|
-
: `const root = createRoot(container)
|
|
8
|
-
root.render(<ExampleComponent />)`
|
|
9
|
-
%>
|
|
10
|
-
import React from 'react'
|
|
11
|
-
import { expect, $ } from '@wdio/globals'
|
|
12
|
-
<%- harnessImport %>
|
|
13
|
-
<% if (answers.installTestingLibrary) { %>
|
|
14
|
-
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
15
|
-
expect.extend(matchers)
|
|
16
|
-
<% } %>
|
|
17
|
-
import ExampleComponent from './Component'
|
|
18
|
-
|
|
19
|
-
describe('React Component Tests', () => {
|
|
20
|
-
<% if (answers.installTestingLibrary) { %>
|
|
21
|
-
it('should test component with Testing Library', async () => {
|
|
22
|
-
render(<ExampleComponent />)
|
|
23
|
-
const component = screen.getByText(/count is 0/i)
|
|
24
|
-
expect(component).toBeInTheDocument()
|
|
25
|
-
|
|
26
|
-
await fireEvent.click(component)
|
|
27
|
-
await fireEvent.click(component)
|
|
28
|
-
|
|
29
|
-
expect(screen.getByText(/count is 2/i)).toBeInTheDocument()
|
|
30
|
-
})
|
|
31
|
-
<% } else { %>
|
|
32
|
-
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
33
|
-
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
container = document.createElement('div')
|
|
36
|
-
document.body.appendChild(container)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
afterEach(() => {
|
|
40
|
-
container?.remove()
|
|
41
|
-
})
|
|
42
|
-
<% } %>
|
|
43
|
-
|
|
44
|
-
it('should test component with WebdriverIO', async () => {
|
|
45
|
-
<%- renderCommand %>
|
|
46
|
-
|
|
47
|
-
const component = await $('button*=count is')
|
|
48
|
-
await expect(component).toBePresent()
|
|
49
|
-
await expect(component).toHaveText('count is 0')
|
|
50
|
-
|
|
51
|
-
await component.click()
|
|
52
|
-
await component.click()
|
|
53
|
-
|
|
54
|
-
await expect(component).toHaveText('count is 2')<%-
|
|
55
|
-
answers.includeVisualTesting ? `
|
|
56
|
-
await expect(component).toMatchElementSnapshot('counterButton')` : '' %>
|
|
57
|
-
})
|
|
58
|
-
})
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createSignal } from 'solid-js'
|
|
2
|
-
import './Component.css'
|
|
3
|
-
|
|
4
|
-
export default function ExampleComponent () {
|
|
5
|
-
const [count, setCount] = createSignal(0)
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<>
|
|
9
|
-
<div>
|
|
10
|
-
<a href="https://webdriver.io/docs/component-testing" target="_blank">
|
|
11
|
-
<img src="https://webdriver.io/assets/images/robot-3677788dd63849c56aa5cb3f332b12d5.svg" className="logo" alt="WebdriverIO logo" />
|
|
12
|
-
</a>
|
|
13
|
-
</div>
|
|
14
|
-
<h1>WebdriverIO Component Testing</h1>
|
|
15
|
-
<div class="card">
|
|
16
|
-
<button onClick={() => setCount((count) => count + 1)}>
|
|
17
|
-
count is {count}
|
|
18
|
-
</button>
|
|
19
|
-
<p>
|
|
20
|
-
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `tsx` : 'jsx' %></code> and save to test HMR
|
|
21
|
-
</p>
|
|
22
|
-
</div>
|
|
23
|
-
<p class="read-the-docs">
|
|
24
|
-
Click on the Vite and Preact logos to learn more
|
|
25
|
-
</p>
|
|
26
|
-
</>
|
|
27
|
-
)
|
|
28
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const harnessImport = answers.installTestingLibrary
|
|
3
|
-
? `import { cleanup, render, screen, fireEvent } from 'solid-testing-library'`
|
|
4
|
-
: `import { render } from 'solid-js/web'`
|
|
5
|
-
const renderCommand = answers.installTestingLibrary
|
|
6
|
-
? `render(() => <ExampleComponent />)`
|
|
7
|
-
: `render(<ExampleComponent />, container)`
|
|
8
|
-
%>
|
|
9
|
-
import { expect, $ } from '@wdio/globals'
|
|
10
|
-
<%- harnessImport %>
|
|
11
|
-
<% if (answers.installTestingLibrary) { %>
|
|
12
|
-
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
13
|
-
expect.extend(matchers)
|
|
14
|
-
<% } %>
|
|
15
|
-
import ExampleComponent from './Component'
|
|
16
|
-
|
|
17
|
-
describe('Preact Component Tests', () => {
|
|
18
|
-
<% if (answers.installTestingLibrary) { %>
|
|
19
|
-
afterEach(cleanup)
|
|
20
|
-
|
|
21
|
-
it('should test component with Testing Library', async () => {
|
|
22
|
-
render(() => <ExampleComponent />)
|
|
23
|
-
const component = screen.getByText(/count is 0/i)
|
|
24
|
-
expect(component).toBeInTheDocument()
|
|
25
|
-
|
|
26
|
-
await fireEvent.click(component)
|
|
27
|
-
await fireEvent.click(component)
|
|
28
|
-
|
|
29
|
-
expect(screen.getByText(/count is 2/i)).toBeInTheDocument()
|
|
30
|
-
})
|
|
31
|
-
<% } else { %>
|
|
32
|
-
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
33
|
-
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
container = document.createElement('div')
|
|
36
|
-
document.body.appendChild(container)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
afterEach(() => {
|
|
40
|
-
container?.remove()
|
|
41
|
-
})
|
|
42
|
-
<% } %>
|
|
43
|
-
|
|
44
|
-
it('should test component with WebdriverIO', async () => {
|
|
45
|
-
<%- renderCommand %>
|
|
46
|
-
|
|
47
|
-
const component = await $('button*=count is')
|
|
48
|
-
await expect(component).toBePresent()
|
|
49
|
-
await expect(component).toHaveText('count is 0')
|
|
50
|
-
|
|
51
|
-
await component.click()
|
|
52
|
-
await component.click()
|
|
53
|
-
|
|
54
|
-
await expect(component).toHaveText('count is 2')<%-
|
|
55
|
-
answers.includeVisualTesting ? `
|
|
56
|
-
await expect(component).toMatchElementSnapshot('counterButton')` : '' %>
|
|
57
|
-
})
|
|
58
|
-
})
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { Component, Prop, h, Fragment } from '@stencil/core'
|
|
2
|
-
|
|
3
|
-
@Component({
|
|
4
|
-
tag: 'my-element',
|
|
5
|
-
shadow: true,
|
|
6
|
-
styleUrl: 'Component.css'
|
|
7
|
-
})
|
|
8
|
-
export class MyElement {
|
|
9
|
-
@Prop() count = 0
|
|
10
|
-
@Prop() docsHint = 'Click on the WebdriverIO logo to learn more!'
|
|
11
|
-
|
|
12
|
-
normalize(name: string): string {
|
|
13
|
-
if (name) {
|
|
14
|
-
return name.slice(0, 1).toUpperCase() + name.slice(1).toLowerCase()
|
|
15
|
-
}
|
|
16
|
-
return ''
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
render() {
|
|
20
|
-
return (
|
|
21
|
-
<>
|
|
22
|
-
<div>
|
|
23
|
-
<a href="https://webdriver.io/docs/component-testing" target="_blank">
|
|
24
|
-
<img src="https://webdriver.io/assets/images/robot-3677788dd63849c56aa5cb3f332b12d5.svg" class="logo"
|
|
25
|
-
alt="WebdriverIO logo" />
|
|
26
|
-
</a>
|
|
27
|
-
</div>
|
|
28
|
-
<h1>
|
|
29
|
-
<slot />
|
|
30
|
-
</h1>
|
|
31
|
-
<div class="card">
|
|
32
|
-
<button onClick={() => { this.count = this.count + 1; }} part="button">
|
|
33
|
-
count is {this.count}
|
|
34
|
-
</button>
|
|
35
|
-
<p>
|
|
36
|
-
Edit <code>src/Component.test.tsx</code> and save to test HMR
|
|
37
|
-
</p>
|
|
38
|
-
</div>
|
|
39
|
-
<p class="read-the-docs">{this.docsHint}</p>
|
|
40
|
-
</>
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { h } from '@stencil/core'
|
|
2
|
-
import { render } from '@wdio/browser-runner/stencil'
|
|
3
|
-
import { $, expect } from '@wdio/globals'
|
|
4
|
-
|
|
5
|
-
import { MyElement } from './Component.js'
|
|
6
|
-
|
|
7
|
-
describe('Stencil component testing', () => {
|
|
8
|
-
it('should increment value on click automatically', async () => {
|
|
9
|
-
await render({
|
|
10
|
-
components: [MyElement],
|
|
11
|
-
autoApplyChanges: true,
|
|
12
|
-
template: () => (
|
|
13
|
-
<my-element count={42}>WebdriverIO Component Testing</my-element>
|
|
14
|
-
)
|
|
15
|
-
})
|
|
16
|
-
|
|
17
|
-
const button = await $('my-element').$('button')
|
|
18
|
-
await expect(button).toHaveText('count is 42')
|
|
19
|
-
|
|
20
|
-
await button.click()
|
|
21
|
-
await button.click()
|
|
22
|
-
|
|
23
|
-
await expect(button).toHaveText('count is 44')
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
it('should increment value on click after flush', async () => {
|
|
27
|
-
const { flushAll } = await render({
|
|
28
|
-
components: [MyElement],
|
|
29
|
-
template: () => (
|
|
30
|
-
<my-element count={42}>WebdriverIO Component Testing</my-element>
|
|
31
|
-
)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
const button = await $('my-element').$('button')
|
|
35
|
-
await expect(button).toHaveText('count is 42')
|
|
36
|
-
|
|
37
|
-
await button.click()
|
|
38
|
-
await button.click()
|
|
39
|
-
flushAll()
|
|
40
|
-
|
|
41
|
-
await expect(button).toHaveText('count is 44')<%-
|
|
42
|
-
answers.includeVisualTesting ? `
|
|
43
|
-
await expect(button).toMatchElementSnapshot('counterButton')` : '' %>
|
|
44
|
-
})
|
|
45
|
-
})
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
<script lang="ts">
|
|
2
|
-
let count = 0
|
|
3
|
-
const increment = () => {
|
|
4
|
-
count += 1
|
|
5
|
-
}
|
|
6
|
-
</script>
|
|
7
|
-
|
|
8
|
-
<main id="root">
|
|
9
|
-
<div>
|
|
10
|
-
<a href="https://webdriver.io/docs/component-testing" target="_blank">
|
|
11
|
-
<img src="https://webdriver.io/assets/images/robot-3677788dd63849c56aa5cb3f332b12d5.svg" className="logo"
|
|
12
|
-
alt="WebdriverIO logo" />
|
|
13
|
-
</a>
|
|
14
|
-
</div>
|
|
15
|
-
<h1>WebdriverIO Component Testing</h1>
|
|
16
|
-
|
|
17
|
-
<div class="card">
|
|
18
|
-
<button on:click={increment}>
|
|
19
|
-
count is {count}
|
|
20
|
-
</button>
|
|
21
|
-
<p>
|
|
22
|
-
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `ts` : 'js' %></code> and save to test HMR
|
|
23
|
-
</p>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<p class="read-the-docs">
|
|
27
|
-
Click on the Vite and Svelte logos to learn more
|
|
28
|
-
</p>
|
|
29
|
-
</main>
|
|
30
|
-
|
|
31
|
-
<style>
|
|
32
|
-
.logo {
|
|
33
|
-
height: 6em;
|
|
34
|
-
padding: 1.5em;
|
|
35
|
-
will-change: filter;
|
|
36
|
-
transition: filter 300ms;
|
|
37
|
-
}
|
|
38
|
-
.logo:hover {
|
|
39
|
-
filter: drop-shadow(0 0 2em #646cffaa);
|
|
40
|
-
}
|
|
41
|
-
.logo.svelte:hover {
|
|
42
|
-
filter: drop-shadow(0 0 2em #ff3e00aa);
|
|
43
|
-
}
|
|
44
|
-
.read-the-docs {
|
|
45
|
-
color: #888;
|
|
46
|
-
}
|
|
47
|
-
</style>
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
<%
|
|
2
|
-
const harnessImport = answers.installTestingLibrary
|
|
3
|
-
? `import { render, fireEvent } from '@testing-library/svelte'`
|
|
4
|
-
: ``
|
|
5
|
-
const renderCommand = answers.installTestingLibrary
|
|
6
|
-
? `render(ExampleComponent)`
|
|
7
|
-
: `new ExampleComponent({ target: container, props: {} })`
|
|
8
|
-
%>
|
|
9
|
-
import { $, expect } from '@wdio/globals'
|
|
10
|
-
<%- harnessImport %>
|
|
11
|
-
<% if (answers.installTestingLibrary) { %>
|
|
12
|
-
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
13
|
-
expect.extend(matchers)
|
|
14
|
-
<% } %>
|
|
15
|
-
import ExampleComponent from './Component.svelte'
|
|
16
|
-
import './Component.css'
|
|
17
|
-
|
|
18
|
-
describe('Svelte Component Testing', () => {
|
|
19
|
-
<% if (answers.installTestingLibrary) { %>
|
|
20
|
-
it('should test component with Testing Library', async () => {
|
|
21
|
-
const { getByText } = render(ExampleComponent)
|
|
22
|
-
|
|
23
|
-
const component = getByText(/count is 0/i)
|
|
24
|
-
expect(component).toBeInTheDocument()
|
|
25
|
-
|
|
26
|
-
await fireEvent.click(component)
|
|
27
|
-
await fireEvent.click(component)
|
|
28
|
-
|
|
29
|
-
expect(getByText(/count is 2/i)).toBeInTheDocument()
|
|
30
|
-
})
|
|
31
|
-
<% } else { %>
|
|
32
|
-
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
33
|
-
|
|
34
|
-
beforeEach(() => {
|
|
35
|
-
container = document.createElement('div')
|
|
36
|
-
document.body.appendChild(container)
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
afterEach(() => {
|
|
40
|
-
container?.remove()
|
|
41
|
-
})
|
|
42
|
-
<% } %>
|
|
43
|
-
|
|
44
|
-
it('should test component with WebdriverIO', async () => {
|
|
45
|
-
<%- renderCommand %>
|
|
46
|
-
|
|
47
|
-
const component = await $('button*=count is')
|
|
48
|
-
await expect(component).toBePresent()
|
|
49
|
-
await expect(component).toHaveText('count is 0')
|
|
50
|
-
|
|
51
|
-
await component.click()
|
|
52
|
-
await component.click()
|
|
53
|
-
|
|
54
|
-
await expect(component).toHaveText('count is 2')<%-
|
|
55
|
-
answers.includeVisualTesting ? `
|
|
56
|
-
await expect(component).toMatchElementSnapshot('counterButton')` : '' %>
|
|
57
|
-
})
|
|
58
|
-
})
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue'
|
|
3
|
-
|
|
4
|
-
defineProps<{ msg: string }>()
|
|
5
|
-
|
|
6
|
-
const count = ref(0)
|
|
7
|
-
</script>
|
|
8
|
-
|
|
9
|
-
<template>
|
|
10
|
-
<div id="root">
|
|
11
|
-
<div>
|
|
12
|
-
<a href="https://webdriver.io/docs/component-testing" target="_blank">
|
|
13
|
-
<img src="https://webdriver.io/assets/images/robot-3677788dd63849c56aa5cb3f332b12d5.svg" className="logo"
|
|
14
|
-
alt="WebdriverIO logo" />
|
|
15
|
-
</a>
|
|
16
|
-
</div>
|
|
17
|
-
<h1>{{ msg }}</h1>
|
|
18
|
-
|
|
19
|
-
<div class="card">
|
|
20
|
-
<button type="button" @click="count++">count is {{ count }}</button>
|
|
21
|
-
<p>
|
|
22
|
-
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `ts` : 'js' %></code> and save to test HMR
|
|
23
|
-
</p>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<p class="read-the-docs">Click on the WebdriverIO logo to learn more</p>
|
|
27
|
-
</div>
|
|
28
|
-
</template>
|
|
29
|
-
|
|
30
|
-
<style scoped>
|
|
31
|
-
.read-the-docs {
|
|
32
|
-
color: #888;
|
|
33
|
-
}
|
|
34
|
-
</style>
|