@wdio/cli 8.13.4 → 8.13.10
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/constants.d.ts +25 -13
- package/build/constants.d.ts.map +1 -1
- package/build/constants.js +32 -11
- package/build/templates/exampleFiles/browser/Component.css.ejs +2 -1
- package/build/templates/exampleFiles/browser/Component.lit.ejs +35 -9
- package/build/templates/exampleFiles/browser/Component.lit.test.ejs +1 -1
- package/build/templates/exampleFiles/browser/Component.preact.ejs +1 -1
- package/build/templates/exampleFiles/browser/Component.preact.test.ejs +5 -5
- package/build/templates/exampleFiles/browser/Component.react.ejs +1 -1
- package/build/templates/exampleFiles/browser/Component.react.test.ejs +5 -5
- package/build/templates/exampleFiles/browser/Component.solid.ejs +1 -1
- package/build/templates/exampleFiles/browser/Component.solid.test.ejs +5 -5
- package/build/templates/exampleFiles/browser/Component.svelte.ejs +1 -1
- package/build/templates/exampleFiles/browser/Component.svelte.test.ejs +5 -5
- package/build/templates/exampleFiles/browser/Component.vue.ejs +1 -1
- package/build/templates/exampleFiles/browser/Component.vue.test.ejs +5 -5
- package/build/utils.d.ts.map +1 -1
- package/build/utils.js +65 -14
- package/package.json +4 -4
package/build/constants.d.ts
CHANGED
|
@@ -126,12 +126,12 @@ export declare const SUPPORTED_PACKAGES: {
|
|
|
126
126
|
}, {
|
|
127
127
|
readonly name: "geckodriver";
|
|
128
128
|
readonly value: "wdio-geckodriver-service$--$geckodriver";
|
|
129
|
-
}, {
|
|
130
|
-
readonly name: "edgedriver";
|
|
131
|
-
readonly value: "wdio-edgedriver-service$--$edgedriver";
|
|
132
129
|
}, {
|
|
133
130
|
readonly name: "safaridriver";
|
|
134
131
|
readonly value: "wdio-safaridriver-service$--$safaridriver";
|
|
132
|
+
}, {
|
|
133
|
+
readonly name: "edgedriver";
|
|
134
|
+
readonly value: "wdio-edgedriver-service$--$edgedriver";
|
|
135
135
|
}, {
|
|
136
136
|
readonly name: "firefox-profile";
|
|
137
137
|
readonly value: "@wdio/firefox-profile-service$--$firefox-profile";
|
|
@@ -141,6 +141,9 @@ export declare const SUPPORTED_PACKAGES: {
|
|
|
141
141
|
}, {
|
|
142
142
|
readonly name: "vite";
|
|
143
143
|
readonly value: "wdio-vite-service$--$vite";
|
|
144
|
+
}, {
|
|
145
|
+
readonly name: "nuxt";
|
|
146
|
+
readonly value: "wdio-nuxt-service$--$nuxt";
|
|
144
147
|
}, {
|
|
145
148
|
readonly name: "devtools";
|
|
146
149
|
readonly value: "@wdio/devtools-service$--$devtools";
|
|
@@ -525,18 +528,18 @@ export declare const QUESTIONNAIRE: ({
|
|
|
525
528
|
type: string;
|
|
526
529
|
name: string;
|
|
527
530
|
message: string;
|
|
528
|
-
choices: (answers: Questionnair) => readonly [{
|
|
531
|
+
choices: (answers: Questionnair) => Promise<readonly [{
|
|
529
532
|
readonly name: "chromedriver";
|
|
530
533
|
readonly value: "wdio-chromedriver-service$--$chromedriver";
|
|
531
534
|
}, {
|
|
532
535
|
readonly name: "geckodriver";
|
|
533
536
|
readonly value: "wdio-geckodriver-service$--$geckodriver";
|
|
534
|
-
}, {
|
|
535
|
-
readonly name: "edgedriver";
|
|
536
|
-
readonly value: "wdio-edgedriver-service$--$edgedriver";
|
|
537
537
|
}, {
|
|
538
538
|
readonly name: "safaridriver";
|
|
539
539
|
readonly value: "wdio-safaridriver-service$--$safaridriver";
|
|
540
|
+
}, {
|
|
541
|
+
readonly name: "edgedriver";
|
|
542
|
+
readonly value: "wdio-edgedriver-service$--$edgedriver";
|
|
540
543
|
}, {
|
|
541
544
|
readonly name: "firefox-profile";
|
|
542
545
|
readonly value: "@wdio/firefox-profile-service$--$firefox-profile";
|
|
@@ -546,6 +549,9 @@ export declare const QUESTIONNAIRE: ({
|
|
|
546
549
|
}, {
|
|
547
550
|
readonly name: "vite";
|
|
548
551
|
readonly value: "wdio-vite-service$--$vite";
|
|
552
|
+
}, {
|
|
553
|
+
readonly name: "nuxt";
|
|
554
|
+
readonly value: "wdio-nuxt-service$--$nuxt";
|
|
549
555
|
}, {
|
|
550
556
|
readonly name: "devtools";
|
|
551
557
|
readonly value: "@wdio/devtools-service$--$devtools";
|
|
@@ -657,18 +663,21 @@ export declare const QUESTIONNAIRE: ({
|
|
|
657
663
|
}, {
|
|
658
664
|
readonly name: "robonut";
|
|
659
665
|
readonly value: "wdio-robonut-service$--$robonut";
|
|
660
|
-
}] |
|
|
666
|
+
}] | {
|
|
667
|
+
name: string;
|
|
668
|
+
value: string;
|
|
669
|
+
}[] | ({
|
|
661
670
|
readonly name: "chromedriver";
|
|
662
671
|
readonly value: "wdio-chromedriver-service$--$chromedriver";
|
|
663
672
|
} | {
|
|
664
673
|
readonly name: "geckodriver";
|
|
665
674
|
readonly value: "wdio-geckodriver-service$--$geckodriver";
|
|
666
|
-
} | {
|
|
667
|
-
readonly name: "edgedriver";
|
|
668
|
-
readonly value: "wdio-edgedriver-service$--$edgedriver";
|
|
669
675
|
} | {
|
|
670
676
|
readonly name: "safaridriver";
|
|
671
677
|
readonly value: "wdio-safaridriver-service$--$safaridriver";
|
|
678
|
+
} | {
|
|
679
|
+
readonly name: "edgedriver";
|
|
680
|
+
readonly value: "wdio-edgedriver-service$--$edgedriver";
|
|
672
681
|
} | {
|
|
673
682
|
readonly name: "firefox-profile";
|
|
674
683
|
readonly value: "@wdio/firefox-profile-service$--$firefox-profile";
|
|
@@ -678,6 +687,9 @@ export declare const QUESTIONNAIRE: ({
|
|
|
678
687
|
} | {
|
|
679
688
|
readonly name: "vite";
|
|
680
689
|
readonly value: "wdio-vite-service$--$vite";
|
|
690
|
+
} | {
|
|
691
|
+
readonly name: "nuxt";
|
|
692
|
+
readonly value: "wdio-nuxt-service$--$nuxt";
|
|
681
693
|
} | {
|
|
682
694
|
readonly name: "devtools";
|
|
683
695
|
readonly value: "@wdio/devtools-service$--$devtools";
|
|
@@ -789,8 +801,8 @@ export declare const QUESTIONNAIRE: ({
|
|
|
789
801
|
} | {
|
|
790
802
|
readonly name: "robonut";
|
|
791
803
|
readonly value: "wdio-robonut-service$--$robonut";
|
|
792
|
-
} | undefined)[]
|
|
793
|
-
default: (answers: Questionnair) => ("wdio-chromedriver-service$--$chromedriver" | "wdio-geckodriver-service$--$geckodriver" | "wdio-
|
|
804
|
+
} | undefined)[]>;
|
|
805
|
+
default: (answers: Questionnair) => Promise<("wdio-chromedriver-service$--$chromedriver" | "wdio-geckodriver-service$--$geckodriver" | "wdio-safaridriver-service$--$safaridriver" | "wdio-edgedriver-service$--$edgedriver" | "@wdio/firefox-profile-service$--$firefox-profile" | "@wdio/gmail-service$--$gmail" | "wdio-vite-service$--$vite" | "wdio-nuxt-service$--$nuxt" | "@wdio/devtools-service$--$devtools" | "@wdio/sauce-service$--$sauce" | "@wdio/testingbot-service$--$testingbot" | "@wdio/crossbrowsertesting-service$--$crossbrowsertesting" | "@wdio/browserstack-service$--$browserstack" | "wdio-vscode-service$--$vscode" | "wdio-electron-service$--$electron" | "@wdio/appium-service$--$appium" | "@wdio/selenium-standalone-service$--$selenium-standalone" | "wdio-eslinter-service$--$eslinter" | "wdio-lambdatest-service$--$lambdatest" | "wdio-zafira-listener-service$--$zafira-listener" | "wdio-reportportal-service$--$reportportal" | "wdio-docker-service$--$docker" | "wdio-ui5-service$--$ui5" | "wdio-wiremock-service$--$wiremock" | "wdio-ng-apimock-service$--ng-apimock" | "wdio-slack-service$--$slack" | "wdio-cucumber-viewport-logger-service$--$cucumber-viewport-logger" | "wdio-intercept-service$--$intercept" | "wdio-image-comparison-service$--$image-comparison" | "wdio-novus-visual-regression-service$--$novus-visual-regression" | "wdio-rerun-service$--$rerun" | "wdio-winappdriver-service$--$winappdriver" | "wdio-ywinappdriver-service$--$ywinappdriver" | "wdio-performancetotal-service$--$performancetotal" | "wdio-cleanuptotal-service$--$cleanuptotal" | "wdio-aws-device-farm-service$--$aws-device-farm" | "wdio-ocr-service$--$ocr-native-apps" | "wdio-ms-teams-service$--$ms-teams" | "wdio-tesults-service$--$tesults" | "@gmangiapelo/wdio-azure-devops-service$--$azure-devops" | "wdio-google-chat-service$--$google-chat" | "@sap_oss/wdio-qmate-service$--$qmate-service" | "wdio-vitaqai-service$--$vitaqai" | "wdio-robonut-service$--$robonut" | undefined)[]>;
|
|
794
806
|
validate: (answers: string[]) => string | Boolean;
|
|
795
807
|
when?: undefined;
|
|
796
808
|
} | {
|
package/build/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAA;AAG9C,eAAO,MAAM,GAAG,KAA6B,CAAA;AAE7C,eAAO,MAAM,YAAY,QAAqE,CAAA;AAE9F,eAAO,MAAM,kBAAkB;;;;;CAK9B,CAAA;AAED,eAAO,MAAM,mBAAmB,8HAI/B,CAAA;AAED,eAAO,MAAM,6BAA6B,ucAYzC,CAAA;AAED,eAAO,MAAM,iCAAiC,8CAG7C,CAAA;AAED,eAAO,MAAM,WAAW,KAAK,CAAA;AAE7B,eAAO,MAAM,cAAc;;;;CAI1B,CAAA;AAED,eAAO,MAAM,UAAU;;;;CAItB,CAAA;AAED,eAAO,MAAM,uBAAuB,iGAI1B,CAAA;AAEV,eAAO,MAAM,gBAAgB;;;;CAInB,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAy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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBA0SjE,YAAY;wBAkBU,MAAM,EAAE;;;;;;;;;;IAsCzD,CAAA"}
|
package/build/constants.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
1
3
|
import { createRequire } from 'node:module';
|
|
2
4
|
import { validateServiceAnswers, detectCompiler, getDefaultFiles, convertPackageHashToObject } from './utils.js';
|
|
3
5
|
const require = createRequire(import.meta.url);
|
|
@@ -99,12 +101,13 @@ export const SUPPORTED_PACKAGES = {
|
|
|
99
101
|
// put chromedriver first as it is the default option
|
|
100
102
|
{ name: 'chromedriver', value: 'wdio-chromedriver-service$--$chromedriver' },
|
|
101
103
|
{ name: 'geckodriver', value: 'wdio-geckodriver-service$--$geckodriver' },
|
|
102
|
-
{ name: 'edgedriver', value: 'wdio-edgedriver-service$--$edgedriver' },
|
|
103
104
|
{ name: 'safaridriver', value: 'wdio-safaridriver-service$--$safaridriver' },
|
|
105
|
+
{ name: 'edgedriver', value: 'wdio-edgedriver-service$--$edgedriver' },
|
|
104
106
|
// internal
|
|
105
107
|
{ name: 'firefox-profile', value: '@wdio/firefox-profile-service$--$firefox-profile' },
|
|
106
108
|
{ name: 'gmail', value: '@wdio/gmail-service$--$gmail' },
|
|
107
109
|
{ name: 'vite', value: 'wdio-vite-service$--$vite' },
|
|
110
|
+
{ name: 'nuxt', value: 'wdio-nuxt-service$--$nuxt' },
|
|
108
111
|
{ name: 'devtools', value: '@wdio/devtools-service$--$devtools' },
|
|
109
112
|
{ name: 'sauce', value: '@wdio/sauce-service$--$sauce' },
|
|
110
113
|
{ name: 'testingbot', value: '@wdio/testingbot-service$--$testingbot' },
|
|
@@ -198,19 +201,33 @@ function isBrowserRunner(answers) {
|
|
|
198
201
|
function getTestingPurpose(answers) {
|
|
199
202
|
return convertPackageHashToObject(answers.runner).purpose;
|
|
200
203
|
}
|
|
204
|
+
async function isNuxtProject() {
|
|
205
|
+
const pathOptions = [
|
|
206
|
+
path.join(process.cwd(), 'nuxt.config.js'),
|
|
207
|
+
path.join(process.cwd(), 'nuxt.config.ts'),
|
|
208
|
+
path.join(process.cwd(), 'nuxt.config.mjs'),
|
|
209
|
+
path.join(process.cwd(), 'nuxt.config.mts')
|
|
210
|
+
];
|
|
211
|
+
return (await Promise.all(pathOptions.map((o) => fs.access(o).then(() => true, () => false))).then((res) => res.filter(Boolean))).length > 0;
|
|
212
|
+
}
|
|
201
213
|
function getBrowserDriver(browserName) {
|
|
202
214
|
const driverName = BROWSER_ENVIRONMENTS.find((browser) => browser.value === browserName)?.driver;
|
|
203
215
|
return SUPPORTED_PACKAGES.service.find((svc) => svc.name === driverName)?.value;
|
|
204
216
|
}
|
|
205
|
-
function selectDefaultService(
|
|
217
|
+
function selectDefaultService(serviceNames) {
|
|
218
|
+
serviceNames = Array.isArray(serviceNames) ? serviceNames : [serviceNames];
|
|
206
219
|
return [SUPPORTED_PACKAGES.service.find(
|
|
207
220
|
/* istanbul ignore next */
|
|
208
|
-
({ name }) => name
|
|
221
|
+
({ name }) => serviceNames.includes(name))?.value];
|
|
209
222
|
}
|
|
210
|
-
function prioServiceOrderFor(
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
223
|
+
function prioServiceOrderFor(serviceNamesParam) {
|
|
224
|
+
const serviceNames = Array.isArray(serviceNamesParam) ? serviceNamesParam : [serviceNamesParam];
|
|
225
|
+
let services = Object.create(SUPPORTED_PACKAGES.service);
|
|
226
|
+
for (const serviceName of serviceNames) {
|
|
227
|
+
const index = services.findIndex(({ name }) => name === serviceName);
|
|
228
|
+
services = [services[index], ...services.slice(0, index), ...services.slice(index + 1)];
|
|
229
|
+
}
|
|
230
|
+
return services;
|
|
214
231
|
}
|
|
215
232
|
export const QUESTIONNAIRE = [{
|
|
216
233
|
type: 'list',
|
|
@@ -467,7 +484,7 @@ export const QUESTIONNAIRE = [{
|
|
|
467
484
|
type: 'checkbox',
|
|
468
485
|
name: 'services',
|
|
469
486
|
message: 'Do you want to add a service to your test setup?',
|
|
470
|
-
choices: (answers) => {
|
|
487
|
+
choices: async (answers) => {
|
|
471
488
|
if (answers.backend === BACKEND_CHOICES[3]) {
|
|
472
489
|
return prioServiceOrderFor('browserstack');
|
|
473
490
|
}
|
|
@@ -486,10 +503,12 @@ export const QUESTIONNAIRE = [{
|
|
|
486
503
|
else if (getTestingPurpose(answers) === 'macos') {
|
|
487
504
|
return [SUPPORTED_PACKAGES.service.find(({ name }) => name === 'appium')];
|
|
488
505
|
}
|
|
506
|
+
else if (getTestingPurpose(answers) === 'e2e' && await isNuxtProject()) {
|
|
507
|
+
return prioServiceOrderFor('nuxt');
|
|
508
|
+
}
|
|
489
509
|
return SUPPORTED_PACKAGES.service;
|
|
490
510
|
},
|
|
491
|
-
|
|
492
|
-
default: (answers) => {
|
|
511
|
+
default: async (answers) => {
|
|
493
512
|
if (answers.backend === BACKEND_CHOICES[3]) {
|
|
494
513
|
return selectDefaultService('browserstack');
|
|
495
514
|
}
|
|
@@ -497,7 +516,9 @@ export const QUESTIONNAIRE = [{
|
|
|
497
516
|
return selectDefaultService('sauce');
|
|
498
517
|
}
|
|
499
518
|
else if (answers.browserEnvironment && answers.browserEnvironment.length) {
|
|
500
|
-
|
|
519
|
+
const defaultServices = answers.browserEnvironment.map((browserName) => getBrowserDriver(browserName));
|
|
520
|
+
defaultServices.push(selectDefaultService('nuxt')[0]);
|
|
521
|
+
return defaultServices;
|
|
501
522
|
}
|
|
502
523
|
else if (answers.e2eEnvironment === 'mobile' || getTestingPurpose(answers) === 'macos') {
|
|
503
524
|
return selectDefaultService('appium');
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { LitElement, css, html } from 'lit'
|
|
2
|
-
import { customElement, property } from 'lit/decorators.js'
|
|
3
|
-
|
|
2
|
+
<%- answers.isUsingTypeScript ? `import { customElement, property } from 'lit/decorators.js'\n` : ''
|
|
3
|
+
%>
|
|
4
4
|
/**
|
|
5
5
|
* An example element.
|
|
6
6
|
*
|
|
7
7
|
* @slot - This element has a slot
|
|
8
8
|
* @csspart button - The button
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
export class MyElement extends LitElement {
|
|
10
|
+
<%- answers.isUsingTypeScript ? `@customElement('my-element')\n` : ''
|
|
11
|
+
%>export class MyElement extends LitElement {<%
|
|
12
|
+
if (answers.isUsingTypeScript) { %>
|
|
12
13
|
/**
|
|
13
14
|
* Copy for the read the docs hint.
|
|
14
15
|
*/
|
|
@@ -20,7 +21,27 @@ export class MyElement extends LitElement {
|
|
|
20
21
|
*/
|
|
21
22
|
@property({ type: Number })
|
|
22
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
|
+
}
|
|
23
38
|
|
|
39
|
+
constructor() {
|
|
40
|
+
super()
|
|
41
|
+
this.docsHint = 'Click on the Vite and Lit logos to learn more'
|
|
42
|
+
this.count = 0
|
|
43
|
+
}
|
|
44
|
+
<% } %>
|
|
24
45
|
render() {
|
|
25
46
|
return html`
|
|
26
47
|
<div>
|
|
@@ -37,18 +58,19 @@ export class MyElement extends LitElement {
|
|
|
37
58
|
count is ${this.count}
|
|
38
59
|
</button>
|
|
39
60
|
<p>
|
|
40
|
-
Edit <code>src/Component.test.
|
|
61
|
+
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `ts` : 'js' %></code> and save to test HMR
|
|
41
62
|
</p>
|
|
42
63
|
</div>
|
|
43
64
|
<p class="read-the-docs">${this.docsHint}</p>
|
|
44
65
|
`
|
|
45
66
|
}
|
|
46
67
|
|
|
47
|
-
private _onClick() {
|
|
68
|
+
<%- answers.isUsingTypeScript ? `private ` : ''%>_onClick() {
|
|
48
69
|
this.count++
|
|
49
70
|
}
|
|
50
71
|
|
|
51
|
-
static styles = css
|
|
72
|
+
<% if (answers.isUsingTypeScript) { %>static styles = css`<% } else { %>static get styles() {
|
|
73
|
+
return css`<% } %>
|
|
52
74
|
:host {
|
|
53
75
|
max-width: 1280px;
|
|
54
76
|
margin: 0 auto;
|
|
@@ -119,10 +141,14 @@ export class MyElement extends LitElement {
|
|
|
119
141
|
}
|
|
120
142
|
}
|
|
121
143
|
`
|
|
144
|
+
<% if (!answers.isUsingTypeScript) { %>}<% } %>
|
|
122
145
|
}
|
|
123
|
-
|
|
146
|
+
<% if (answers.isUsingTypeScript) { %>
|
|
124
147
|
declare global {
|
|
125
148
|
interface HTMLElementTagNameMap {
|
|
126
149
|
'my-element': MyElement
|
|
127
150
|
}
|
|
128
|
-
}
|
|
151
|
+
}<%
|
|
152
|
+
} else { %>
|
|
153
|
+
window.customElements.define('my-element', MyElement)<%
|
|
154
|
+
} %>
|
|
@@ -17,7 +17,7 @@ export default function ExampleComponent () {
|
|
|
17
17
|
count is {count}
|
|
18
18
|
</button>
|
|
19
19
|
<p>
|
|
20
|
-
Edit <code>src/Component.test.tsx
|
|
20
|
+
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `tsx` : 'jsx' %></code> and save to test HMR
|
|
21
21
|
</p>
|
|
22
22
|
</div>
|
|
23
23
|
<p class="read-the-docs">
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const harnessImport = installTestingLibrary
|
|
2
|
+
const harnessImport = answers.installTestingLibrary
|
|
3
3
|
? `import { h } from 'preact'\nimport { render, screen, fireEvent } from '@testing-library/preact'`
|
|
4
4
|
: `import { h, render } from 'preact'\nimport htm from 'https://esm.sh/htm'`
|
|
5
|
-
const renderCommand = installTestingLibrary
|
|
5
|
+
const renderCommand = answers.installTestingLibrary
|
|
6
6
|
? `render(<ExampleComponent />)`
|
|
7
7
|
: "render(html`<${ExampleComponent} />`, container)"
|
|
8
8
|
%>
|
|
9
9
|
import { expect, $ } from '@wdio/globals'
|
|
10
10
|
<%- harnessImport %>
|
|
11
|
-
<% if (installTestingLibrary) { %>
|
|
11
|
+
<% if (answers.installTestingLibrary) { %>
|
|
12
12
|
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
13
13
|
expect.extend(matchers)
|
|
14
14
|
<% } else { %>
|
|
@@ -18,7 +18,7 @@ const html = htm.bind(h);
|
|
|
18
18
|
import ExampleComponent from './Component'
|
|
19
19
|
|
|
20
20
|
describe('Preact Component Tests', () => {
|
|
21
|
-
<% if (installTestingLibrary) { %>
|
|
21
|
+
<% if (answers.installTestingLibrary) { %>
|
|
22
22
|
it('should test component with Testing Library', async () => {
|
|
23
23
|
render(<ExampleComponent />)
|
|
24
24
|
const component = screen.getByText(/count is 0/i)
|
|
@@ -30,7 +30,7 @@ describe('Preact Component Tests', () => {
|
|
|
30
30
|
expect(screen.getByText(/count is 2/i)).toBeInTheDocument()
|
|
31
31
|
})
|
|
32
32
|
<% } else { %>
|
|
33
|
-
let container<%- isUsingTypeScript ? `: Element` : '' %>
|
|
33
|
+
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
34
34
|
|
|
35
35
|
beforeEach(() => {
|
|
36
36
|
container = document.createElement('div')
|
|
@@ -18,7 +18,7 @@ export default function ExampleComponent () {
|
|
|
18
18
|
count is {count}
|
|
19
19
|
</button>
|
|
20
20
|
<p>
|
|
21
|
-
Edit <code>src/Component.test.tsx
|
|
21
|
+
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `tsx` : 'jsx' %></code> and save to test HMR
|
|
22
22
|
</p>
|
|
23
23
|
</div>
|
|
24
24
|
<p className="read-the-docs">
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const harnessImport = installTestingLibrary
|
|
2
|
+
const harnessImport = answers.installTestingLibrary
|
|
3
3
|
? `import { render, screen, fireEvent } from '@testing-library/react'`
|
|
4
4
|
: `import { createRoot } from 'react-dom/client'`
|
|
5
|
-
const renderCommand = installTestingLibrary
|
|
5
|
+
const renderCommand = answers.installTestingLibrary
|
|
6
6
|
? `render(<ExampleComponent />)`
|
|
7
7
|
: `const root = createRoot(container)
|
|
8
8
|
root.render(<ExampleComponent />)`
|
|
@@ -10,14 +10,14 @@ const renderCommand = installTestingLibrary
|
|
|
10
10
|
import React from 'react'
|
|
11
11
|
import { expect, $ } from '@wdio/globals'
|
|
12
12
|
<%- harnessImport %>
|
|
13
|
-
<% if (installTestingLibrary) { %>
|
|
13
|
+
<% if (answers.installTestingLibrary) { %>
|
|
14
14
|
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
15
15
|
expect.extend(matchers)
|
|
16
16
|
<% } %>
|
|
17
17
|
import ExampleComponent from './Component'
|
|
18
18
|
|
|
19
19
|
describe('React Component Tests', () => {
|
|
20
|
-
<% if (installTestingLibrary) { %>
|
|
20
|
+
<% if (answers.installTestingLibrary) { %>
|
|
21
21
|
it('should test component with Testing Library', async () => {
|
|
22
22
|
render(<ExampleComponent />)
|
|
23
23
|
const component = screen.getByText(/count is 0/i)
|
|
@@ -29,7 +29,7 @@ describe('React Component Tests', () => {
|
|
|
29
29
|
expect(screen.getByText(/count is 2/i)).toBeInTheDocument()
|
|
30
30
|
})
|
|
31
31
|
<% } else { %>
|
|
32
|
-
let container<%- isUsingTypeScript ? `: Element` : '' %>
|
|
32
|
+
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
33
33
|
|
|
34
34
|
beforeEach(() => {
|
|
35
35
|
container = document.createElement('div')
|
|
@@ -17,7 +17,7 @@ export default function ExampleComponent () {
|
|
|
17
17
|
count is {count}
|
|
18
18
|
</button>
|
|
19
19
|
<p>
|
|
20
|
-
Edit <code>src/Component.test.tsx
|
|
20
|
+
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `tsx` : 'jsx' %></code> and save to test HMR
|
|
21
21
|
</p>
|
|
22
22
|
</div>
|
|
23
23
|
<p class="read-the-docs">
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const harnessImport = installTestingLibrary
|
|
2
|
+
const harnessImport = answers.installTestingLibrary
|
|
3
3
|
? `import { cleanup, render, screen, fireEvent } from 'solid-testing-library'`
|
|
4
4
|
: `import { render } from 'solid-js/web'`
|
|
5
|
-
const renderCommand = installTestingLibrary
|
|
5
|
+
const renderCommand = answers.installTestingLibrary
|
|
6
6
|
? `render(() => <ExampleComponent />)`
|
|
7
7
|
: `render(<ExampleComponent />, container)`
|
|
8
8
|
%>
|
|
9
9
|
import { expect, $ } from '@wdio/globals'
|
|
10
10
|
<%- harnessImport %>
|
|
11
|
-
<% if (installTestingLibrary) { %>
|
|
11
|
+
<% if (answers.installTestingLibrary) { %>
|
|
12
12
|
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
13
13
|
expect.extend(matchers)
|
|
14
14
|
<% } %>
|
|
15
15
|
import ExampleComponent from './Component'
|
|
16
16
|
|
|
17
17
|
describe('Preact Component Tests', () => {
|
|
18
|
-
<% if (installTestingLibrary) { %>
|
|
18
|
+
<% if (answers.installTestingLibrary) { %>
|
|
19
19
|
afterEach(cleanup)
|
|
20
20
|
|
|
21
21
|
it('should test component with Testing Library', async () => {
|
|
@@ -29,7 +29,7 @@ describe('Preact Component Tests', () => {
|
|
|
29
29
|
expect(screen.getByText(/count is 2/i)).toBeInTheDocument()
|
|
30
30
|
})
|
|
31
31
|
<% } else { %>
|
|
32
|
-
let container<%- isUsingTypeScript ? `: Element` : '' %>
|
|
32
|
+
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
33
33
|
|
|
34
34
|
beforeEach(() => {
|
|
35
35
|
container = document.createElement('div')
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const harnessImport = installTestingLibrary
|
|
2
|
+
const harnessImport = answers.installTestingLibrary
|
|
3
3
|
? `import { render, fireEvent } from '@testing-library/svelte'`
|
|
4
4
|
: ``
|
|
5
|
-
const renderCommand = installTestingLibrary
|
|
5
|
+
const renderCommand = answers.installTestingLibrary
|
|
6
6
|
? `render(ExampleComponent)`
|
|
7
7
|
: `new ExampleComponent({ target: container, props: {} })`
|
|
8
8
|
%>
|
|
9
9
|
import { $, expect } from '@wdio/globals'
|
|
10
10
|
<%- harnessImport %>
|
|
11
|
-
<% if (installTestingLibrary) { %>
|
|
11
|
+
<% if (answers.installTestingLibrary) { %>
|
|
12
12
|
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
13
13
|
expect.extend(matchers)
|
|
14
14
|
<% } %>
|
|
@@ -16,7 +16,7 @@ import ExampleComponent from './Component.svelte'
|
|
|
16
16
|
import './Component.css'
|
|
17
17
|
|
|
18
18
|
describe('Svelte Component Testing', () => {
|
|
19
|
-
<% if (installTestingLibrary) { %>
|
|
19
|
+
<% if (answers.installTestingLibrary) { %>
|
|
20
20
|
it('should test component with Testing Library', async () => {
|
|
21
21
|
const { getByText } = render(ExampleComponent)
|
|
22
22
|
|
|
@@ -29,7 +29,7 @@ describe('Svelte Component Testing', () => {
|
|
|
29
29
|
expect(getByText(/count is 2/i)).toBeInTheDocument()
|
|
30
30
|
})
|
|
31
31
|
<% } else { %>
|
|
32
|
-
let container<%- isUsingTypeScript ? `: Element` : '' %>
|
|
32
|
+
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
33
33
|
|
|
34
34
|
beforeEach(() => {
|
|
35
35
|
container = document.createElement('div')
|
|
@@ -19,7 +19,7 @@ const count = ref(0)
|
|
|
19
19
|
<div class="card">
|
|
20
20
|
<button type="button" @click="count++">count is {{ count }}</button>
|
|
21
21
|
<p>
|
|
22
|
-
Edit <code>src/Component.test.
|
|
22
|
+
Edit <code>src/Component.test.<%- answers.isUsingTypeScript ? `ts` : 'js' %></code> and save to test HMR
|
|
23
23
|
</p>
|
|
24
24
|
</div>
|
|
25
25
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<%
|
|
2
|
-
const harnessImport = installTestingLibrary
|
|
2
|
+
const harnessImport = answers.installTestingLibrary
|
|
3
3
|
? `import { render, fireEvent } from '@testing-library/vue'`
|
|
4
4
|
: `import { createApp } from 'vue'`
|
|
5
|
-
const renderCommand = installTestingLibrary
|
|
5
|
+
const renderCommand = answers.installTestingLibrary
|
|
6
6
|
? `render(ExampleComponent, { props: { msg: 'WebdriverIO Component Testing' } })`
|
|
7
7
|
: `createApp(ExampleComponent, { msg: 'WebdriverIO Component Testing' }).mount(container)`
|
|
8
8
|
%>
|
|
9
9
|
import { $, expect } from '@wdio/globals'
|
|
10
10
|
<%- harnessImport %>
|
|
11
|
-
<% if (installTestingLibrary) { %>
|
|
11
|
+
<% if (answers.installTestingLibrary) { %>
|
|
12
12
|
import * as matchers from '@testing-library/jest-dom/matchers'
|
|
13
13
|
expect.extend(matchers)
|
|
14
14
|
<% } %>
|
|
@@ -16,7 +16,7 @@ import ExampleComponent from './Component.vue'
|
|
|
16
16
|
import './Component.css'
|
|
17
17
|
|
|
18
18
|
describe('Vue Component Testing', () => {
|
|
19
|
-
<% if (installTestingLibrary) { %>
|
|
19
|
+
<% if (answers.installTestingLibrary) { %>
|
|
20
20
|
it('should test component with Testing Library', async () => {
|
|
21
21
|
// The render method returns a collection of utilities to query your component.
|
|
22
22
|
const { getByText } = render(ExampleComponent, {
|
|
@@ -32,7 +32,7 @@ describe('Vue Component Testing', () => {
|
|
|
32
32
|
expect(getByText(/count is 2/i)).toBeInTheDocument()
|
|
33
33
|
})
|
|
34
34
|
<% } else { %>
|
|
35
|
-
let container<%- isUsingTypeScript ? `: Element` : '' %>
|
|
35
|
+
let container<%- answers.isUsingTypeScript ? `: Element` : '' %>
|
|
36
36
|
|
|
37
37
|
beforeEach(() => {
|
|
38
38
|
container = document.createElement('div')
|
package/build/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{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AAE,aAAa,8BAgCnE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAmFxF;AAED;;GAEG;AACH,wBAAsB,eAAe,CAAC,aAAa,EAAE,aAAa,iBAoFjE;AAOD;;GAEG;AACH,wBAAsB,UAAU,CAAC,aAAa,EAAE,aAAa,iBA4C5D;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,iBAgBlE;AAED,wBAAsB,gBAAgB,CAAC,aAAa,EAAE,aAAa,oBAkBlE;AAED,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,aAAa,4DAoBpE"}
|
package/build/utils.js
CHANGED
|
@@ -326,16 +326,14 @@ export async function generateTestFiles(answers) {
|
|
|
326
326
|
const TSX_BASED_FRAMEWORKS = ['react', 'preact', 'solid'];
|
|
327
327
|
export async function generateBrowserRunnerTestFiles(answers) {
|
|
328
328
|
const isUsingFramework = typeof answers.preset === 'string';
|
|
329
|
-
const preset =
|
|
330
|
-
? answers.preset || 'lit'
|
|
331
|
-
: '';
|
|
329
|
+
const preset = getPreset(answers);
|
|
332
330
|
const tplRootDir = path.join(TEMPLATE_ROOT_DIR, 'browser');
|
|
333
331
|
await fs.mkdir(answers.destSpecRootPath, { recursive: true });
|
|
334
332
|
/**
|
|
335
333
|
* render css file
|
|
336
334
|
*/
|
|
337
335
|
if (isUsingFramework) {
|
|
338
|
-
const renderedCss = await renderFile(path.join(tplRootDir, 'Component.css.ejs'), answers);
|
|
336
|
+
const renderedCss = await renderFile(path.join(tplRootDir, 'Component.css.ejs'), { answers });
|
|
339
337
|
await fs.writeFile(path.join(answers.destSpecRootPath, 'Component.css'), renderedCss);
|
|
340
338
|
}
|
|
341
339
|
/**
|
|
@@ -347,14 +345,14 @@ export async function generateBrowserRunnerTestFiles(answers) {
|
|
|
347
345
|
: testExt;
|
|
348
346
|
if (preset) {
|
|
349
347
|
const componentOutFileName = `Component.${fileExt}`;
|
|
350
|
-
const renderedComponent = await renderFile(path.join(tplRootDir, `Component.${preset}.ejs`), answers);
|
|
348
|
+
const renderedComponent = await renderFile(path.join(tplRootDir, `Component.${preset}.ejs`), { answers });
|
|
351
349
|
await fs.writeFile(path.join(answers.destSpecRootPath, componentOutFileName), renderedComponent);
|
|
352
350
|
}
|
|
353
351
|
/**
|
|
354
352
|
* render test file
|
|
355
353
|
*/
|
|
356
354
|
const componentFileName = preset ? `Component.${preset}.test.ejs` : 'standalone.test.ejs';
|
|
357
|
-
const renderedTest = await renderFile(path.join(tplRootDir, componentFileName), answers);
|
|
355
|
+
const renderedTest = await renderFile(path.join(tplRootDir, componentFileName), { answers });
|
|
358
356
|
await fs.writeFile(path.join(answers.destSpecRootPath, `Component.test.${testExt}`), renderedTest);
|
|
359
357
|
}
|
|
360
358
|
async function generateLocalRunnerTestFiles(answers) {
|
|
@@ -382,19 +380,22 @@ export async function getAnswers(yes) {
|
|
|
382
380
|
if (yes) {
|
|
383
381
|
const ignoredQuestions = ['e2eEnvironment'];
|
|
384
382
|
const filterdQuestionaire = QUESTIONNAIRE.filter((question) => !ignoredQuestions.includes(question.name));
|
|
385
|
-
const answers =
|
|
383
|
+
const answers = {};
|
|
384
|
+
for (const question of filterdQuestionaire) {
|
|
386
385
|
/**
|
|
387
386
|
* set nothing if question doesn't apply
|
|
388
387
|
*/
|
|
389
|
-
|
|
390
|
-
|
|
388
|
+
if (question.when && !question.when(answers)) {
|
|
389
|
+
continue;
|
|
390
|
+
}
|
|
391
|
+
Object.assign(answers, {
|
|
391
392
|
[question.name]: typeof question.default !== 'undefined'
|
|
392
393
|
/**
|
|
393
394
|
* set default value if existing
|
|
394
395
|
*/
|
|
395
396
|
? typeof question.default === 'function'
|
|
396
|
-
? question.default(answers)
|
|
397
|
-
: question.default
|
|
397
|
+
? await question.default(answers)
|
|
398
|
+
: await question.default
|
|
398
399
|
: question.choices && question.choices.length
|
|
399
400
|
/**
|
|
400
401
|
* pick first choice, select value if it exists
|
|
@@ -407,7 +408,8 @@ export async function getAnswers(yes) {
|
|
|
407
408
|
? question.choices[0].value
|
|
408
409
|
: question.choices[0]
|
|
409
410
|
: {}
|
|
410
|
-
})
|
|
411
|
+
});
|
|
412
|
+
}
|
|
411
413
|
/**
|
|
412
414
|
* some questions have async defaults
|
|
413
415
|
*/
|
|
@@ -589,6 +591,13 @@ export function npmInstall(parsedAnswers, useYarn, npmTag) {
|
|
|
589
591
|
if (presetPackage.short === 'solid') {
|
|
590
592
|
parsedAnswers.packagesToInstall.push('solid-js');
|
|
591
593
|
}
|
|
594
|
+
/**
|
|
595
|
+
* add dependency for Lit testing
|
|
596
|
+
*/
|
|
597
|
+
const preset = getPreset(parsedAnswers);
|
|
598
|
+
if (preset === 'lit') {
|
|
599
|
+
parsedAnswers.packagesToInstall.push('lit');
|
|
600
|
+
}
|
|
592
601
|
/**
|
|
593
602
|
* add helper for React rendering when not using Testing Library
|
|
594
603
|
*/
|
|
@@ -666,19 +675,61 @@ export async function setupTypeScript(parsedAnswers) {
|
|
|
666
675
|
.filter(service => service.startsWith('@wdio'))
|
|
667
676
|
];
|
|
668
677
|
if (!parsedAnswers.hasRootTSConfig) {
|
|
678
|
+
const preset = getPreset(parsedAnswers);
|
|
669
679
|
const config = {
|
|
670
680
|
compilerOptions: {
|
|
681
|
+
// compiler
|
|
671
682
|
moduleResolution: 'node',
|
|
672
683
|
module: !parsedAnswers.esmSupport ? 'commonjs' : 'ESNext',
|
|
673
|
-
types,
|
|
674
684
|
target: 'es2022',
|
|
675
|
-
|
|
685
|
+
types,
|
|
686
|
+
skipLibCheck: true,
|
|
687
|
+
// bundler
|
|
688
|
+
noEmit: true,
|
|
689
|
+
allowImportingTsExtensions: true,
|
|
690
|
+
resolveJsonModule: true,
|
|
691
|
+
isolatedModules: true,
|
|
692
|
+
// linting
|
|
693
|
+
strict: true,
|
|
694
|
+
noUnusedLocals: true,
|
|
695
|
+
noUnusedParameters: true,
|
|
696
|
+
noFallthroughCasesInSwitch: true,
|
|
697
|
+
...Object.assign(preset === 'lit'
|
|
698
|
+
? {
|
|
699
|
+
experimentalDecorators: true,
|
|
700
|
+
useDefineForClassFields: false
|
|
701
|
+
}
|
|
702
|
+
: {}, preset === 'react'
|
|
703
|
+
? {
|
|
704
|
+
jsx: 'react-jsx'
|
|
705
|
+
}
|
|
706
|
+
: {}, preset === 'preact'
|
|
707
|
+
? {
|
|
708
|
+
jsx: 'react-jsx',
|
|
709
|
+
jsxImportSource: 'preact'
|
|
710
|
+
}
|
|
711
|
+
: {}, preset === 'solid'
|
|
712
|
+
? {
|
|
713
|
+
jsx: 'preserve',
|
|
714
|
+
jsxImportSource: 'solid-js'
|
|
715
|
+
}
|
|
716
|
+
: {})
|
|
717
|
+
},
|
|
718
|
+
include: preset === 'svelte'
|
|
719
|
+
? ['src/**/*.d.ts', 'src/**/*.ts', 'src/**/*.js', 'src/**/*.svelte']
|
|
720
|
+
: preset === 'vue'
|
|
721
|
+
? ['src/**/*.ts', 'src/**/*.d.ts', 'src/**/*.tsx', 'src/**/*.vue']
|
|
722
|
+
: ['src']
|
|
676
723
|
};
|
|
677
724
|
await fs.mkdir(path.dirname(parsedAnswers.tsConfigFilePath), { recursive: true });
|
|
678
725
|
await fs.writeFile(parsedAnswers.tsConfigFilePath, JSON.stringify(config, null, 4));
|
|
679
726
|
}
|
|
680
727
|
console.log(chalk.green.bold('✔ Success!\n'));
|
|
681
728
|
}
|
|
729
|
+
function getPreset(parsedAnswers) {
|
|
730
|
+
const isUsingFramework = typeof parsedAnswers.preset === 'string';
|
|
731
|
+
return isUsingFramework ? (parsedAnswers.preset || 'lit') : '';
|
|
732
|
+
}
|
|
682
733
|
/**
|
|
683
734
|
* add @babel/register package if not installed
|
|
684
735
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wdio/cli",
|
|
3
|
-
"version": "8.13.
|
|
3
|
+
"version": "8.13.10",
|
|
4
4
|
"description": "WebdriverIO testrunner command line interface",
|
|
5
5
|
"author": "Christian Bromann <mail@bromann.dev>",
|
|
6
6
|
"homepage": "https://github.com/webdriverio/webdriverio/tree/main/packages/wdio-cli",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@types/node": "^20.1.1",
|
|
49
49
|
"@wdio/config": "8.12.1",
|
|
50
|
-
"@wdio/globals": "8.13.
|
|
50
|
+
"@wdio/globals": "8.13.10",
|
|
51
51
|
"@wdio/logger": "8.11.0",
|
|
52
52
|
"@wdio/protocols": "8.11.0",
|
|
53
53
|
"@wdio/types": "8.10.4",
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
"lodash.union": "^4.6.0",
|
|
66
66
|
"read-pkg-up": "9.1.0",
|
|
67
67
|
"recursive-readdir": "^2.2.3",
|
|
68
|
-
"webdriverio": "8.13.
|
|
68
|
+
"webdriverio": "8.13.10",
|
|
69
69
|
"yargs": "^17.7.2",
|
|
70
70
|
"yarn-install": "^1.0.0"
|
|
71
71
|
},
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"publishConfig": {
|
|
83
83
|
"access": "public"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "2a05643770eb3167ab366fc4912f723e9640af1d"
|
|
86
86
|
}
|