@wdio/cli 9.0.0 → 9.0.3
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/config.d.ts.map +1 -1
- package/build/index.js +5 -3
- package/build/templates/exampleFiles/browser/Component.css.ejs +121 -0
- package/build/templates/exampleFiles/browser/Component.lit.ejs +154 -0
- package/build/templates/exampleFiles/browser/Component.lit.test.ejs +24 -0
- package/build/templates/exampleFiles/browser/Component.preact.ejs +28 -0
- package/build/templates/exampleFiles/browser/Component.preact.test.ejs +59 -0
- package/build/templates/exampleFiles/browser/Component.react.ejs +29 -0
- package/build/templates/exampleFiles/browser/Component.react.test.ejs +58 -0
- package/build/templates/exampleFiles/browser/Component.solid.ejs +28 -0
- package/build/templates/exampleFiles/browser/Component.solid.test.ejs +58 -0
- package/build/templates/exampleFiles/browser/Component.stencil.ejs +43 -0
- package/build/templates/exampleFiles/browser/Component.stencil.test.ejs +45 -0
- package/build/templates/exampleFiles/browser/Component.svelte.ejs +47 -0
- package/build/templates/exampleFiles/browser/Component.svelte.test.ejs +58 -0
- package/build/templates/exampleFiles/browser/Component.vue.ejs +34 -0
- package/build/templates/exampleFiles/browser/Component.vue.test.ejs +62 -0
- package/build/templates/exampleFiles/browser/standalone.test.ejs +13 -0
- package/build/templates/exampleFiles/cucumber/step_definitions/steps.js.ejs +55 -0
- package/build/templates/exampleFiles/mochaJasmine/test.e2e.js.ejs +11 -0
- package/build/templates/exampleFiles/pageobjects/login.page.js.ejs +45 -0
- package/build/templates/exampleFiles/pageobjects/page.js.ejs +17 -0
- package/build/templates/exampleFiles/pageobjects/secure.page.js.ejs +20 -0
- package/build/templates/exampleFiles/serenity-js/common/config/serenity.properties.ejs +1 -0
- package/build/templates/exampleFiles/serenity-js/common/serenity/github-api/GitHubStatus.ts.ejs +41 -0
- package/build/templates/exampleFiles/serenity-js/common/serenity/todo-list-app/TodoList.ts.ejs +100 -0
- package/build/templates/exampleFiles/serenity-js/common/serenity/todo-list-app/TodoListItem.ts.ejs +36 -0
- package/build/templates/exampleFiles/serenity-js/cucumber/step-definitions/steps.ts.ejs +37 -0
- package/build/templates/exampleFiles/serenity-js/cucumber/support/parameter.config.ts.ejs +18 -0
- package/build/templates/exampleFiles/serenity-js/cucumber/todo-list/completing_items.feature.ejs +23 -0
- package/build/templates/exampleFiles/serenity-js/cucumber/todo-list/narrative.md.ejs +17 -0
- package/build/templates/exampleFiles/serenity-js/jasmine/example.spec.ts.ejs +86 -0
- package/build/templates/exampleFiles/serenity-js/mocha/example.spec.ts.ejs +88 -0
- package/build/templates/snippets/afterTest.ejs +20 -0
- package/build/templates/snippets/capabilities.ejs +57 -0
- package/build/templates/snippets/cucumber.ejs +50 -0
- package/build/templates/snippets/electronTest.js.ejs +7 -0
- package/build/templates/snippets/jasmine.ejs +20 -0
- package/build/templates/snippets/macosTest.js.ejs +11 -0
- package/build/templates/snippets/mocha.ejs +14 -0
- package/build/templates/snippets/reporters.ejs +14 -0
- package/build/templates/snippets/serenity.ejs +18 -0
- package/build/templates/snippets/services.ejs +18 -0
- package/build/templates/snippets/testWithPO.js.ejs +22 -0
- package/build/templates/snippets/testWithoutPO.js.ejs +19 -0
- package/build/templates/snippets/vscodeTest.js.ejs +9 -0
- package/build/templates/wdio.conf.tpl.ejs +416 -0
- package/build/utils.d.ts.map +1 -1
- package/package.json +4 -4
package/build/templates/exampleFiles/serenity-js/cucumber/todo-list/completing_items.feature.ejs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Feature: Completing items
|
|
2
|
+
|
|
3
|
+
Scenario: Counting outstanding items
|
|
4
|
+
|
|
5
|
+
Given Alice started with a list containing:
|
|
6
|
+
| Buy dog food |
|
|
7
|
+
| Feed the dog |
|
|
8
|
+
| Book a vet's appointment |
|
|
9
|
+
When she marks the following items as completed:
|
|
10
|
+
| Buy dog food |
|
|
11
|
+
| Feed the dog |
|
|
12
|
+
Then she should see that she has 1 item outstanding
|
|
13
|
+
|
|
14
|
+
Scenario: Marking items as not completed
|
|
15
|
+
|
|
16
|
+
Given Alice started with a list containing:
|
|
17
|
+
| Buy dog food |
|
|
18
|
+
| Feed the dog |
|
|
19
|
+
And she marked the following items as completed:
|
|
20
|
+
| Buy dog food |
|
|
21
|
+
When she marks the following items as outstanding:
|
|
22
|
+
| Buy dog food |
|
|
23
|
+
Then she should see that she has 2 items outstanding
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Serenity/JS Todo List Example
|
|
2
|
+
|
|
3
|
+
Narrative:
|
|
4
|
+
|
|
5
|
+
This is a simple example of a Serenity/JS project, interacting with a [TodoMVC](http://todomvc.com/) application
|
|
6
|
+
available at [todo-app.serenity-js.org/](https://todo-app.serenity-js.org/).
|
|
7
|
+
|
|
8
|
+
This note is called _"the narrative"_. It can be used to provide the context around the business capability of your
|
|
9
|
+
product ("Reporting Results" in this case) and its features that help to enable this capability.
|
|
10
|
+
|
|
11
|
+
**Please note:** While [Cucumber](https://github.com/cucumber/cucumber-js) allows you to capture a description
|
|
12
|
+
of each feature in the `.feature` file, [Serenity/JS](https://serenityjs.org) allows us to group those `.feature`
|
|
13
|
+
files in directories corresponding to "epics", "themes" or "business capabilities" of your system and provide
|
|
14
|
+
each one of those with additional context using this `narrative.txt` file.
|
|
15
|
+
|
|
16
|
+
**By the way:** Did you notice that you can use **[markdown syntax](https://www.markdownguide.org/)** to better express
|
|
17
|
+
your thoughts?
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<%- _.import('Ensure, equals', '@serenity-js/assertions') %>
|
|
2
|
+
<%- _.import('actorCalled', '@serenity-js/core') %>
|
|
3
|
+
<%- _.import('By, Navigate, PageElement, Text', '@serenity-js/web') %>
|
|
4
|
+
|
|
5
|
+
<%- _.import('GitHubStatus', '../serenity/github-api/GitHubStatus') %>
|
|
6
|
+
<%- _.import('TodoList', '../serenity/todo-list-app/TodoList') %>
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Serenity/JS Screenplay Pattern test scenarios use one or more actors to represent people and external systems
|
|
10
|
+
* interacting with the system under test.
|
|
11
|
+
*
|
|
12
|
+
* To design a test scenario, give each actor a series of tasks and interactions to perform
|
|
13
|
+
* and instruct them to answer questions about the state of the system under test
|
|
14
|
+
* to ensure that the answers meet the expected results.
|
|
15
|
+
*
|
|
16
|
+
* This example test file demonstrates several ways of writing test scenarios using the Screenplay Pattern.
|
|
17
|
+
*
|
|
18
|
+
* Learn more:
|
|
19
|
+
* - Serenity/JS Screenplay Pattern - https://serenity-js.org/handbook/design/screenplay-pattern/
|
|
20
|
+
* - Web Testing with Serenity/JS - https://serenity-js.org/handbook/web-testing/
|
|
21
|
+
* - API Testing with Serenity/JS - https://serenity-js.org/handbook/api-testing/
|
|
22
|
+
* - Serenity/JS web module - https://serenity-js.org/api/web/
|
|
23
|
+
* - Serenity/JS REST module - https://serenity-js.org/api/rest/
|
|
24
|
+
* - Serenity/JS assertions module - https://serenity-js.org/api/assertions/
|
|
25
|
+
*/
|
|
26
|
+
describe('Serenity/JS Website', () => {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* This is the most basic example of a Serenity/JS Screenplay Pattern test scenario.
|
|
30
|
+
*
|
|
31
|
+
* This scenario uses a single actor configured to perform a series of web-based interactions,
|
|
32
|
+
* and uses only the low-level abstractions provided by the Serenity/JS web module.
|
|
33
|
+
*/
|
|
34
|
+
it('offers a web testing tutorial', async () => {
|
|
35
|
+
await actorCalled('Alice').attemptsTo(
|
|
36
|
+
Navigate.to('https://serenity-js.org'),
|
|
37
|
+
Ensure.that(
|
|
38
|
+
Text.of(PageElement.located(By.id('cta-start-automating'))),
|
|
39
|
+
equals('Start automating 🚀')
|
|
40
|
+
),
|
|
41
|
+
)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* This is a more advanced example of a Serenity/JS Screenplay Pattern test scenario.
|
|
46
|
+
*
|
|
47
|
+
* This scenario uses two actors:
|
|
48
|
+
* - Apisitt, responsible for interacting with an API to check if the system is up and running before performing any UI checks
|
|
49
|
+
* - Wendy, responsible for interacting with the website to perform the actual acceptance test
|
|
50
|
+
*
|
|
51
|
+
* In this scenario, rather than list all the interactions in the test itself, we use:
|
|
52
|
+
* - API Actions Class Pattern to group tasks concerning interacting with the GitHubStatus API
|
|
53
|
+
* - Screenplay Pattern flavour of Page Objects to group tasks and questions concerning interacting with the Serenity/JS Todo List app
|
|
54
|
+
*
|
|
55
|
+
* Note that apart from strongly encouraging the Screenplay Pattern,
|
|
56
|
+
* Serenity/JS doesn't require you to organise your code in any particular way.
|
|
57
|
+
* This gives you the freedom to choose patterns and abstractions that work best for you, your team,
|
|
58
|
+
* and reflect the domain of your system under test.
|
|
59
|
+
*/
|
|
60
|
+
it(`offers examples to help you practice test automation`, async () => {
|
|
61
|
+
|
|
62
|
+
// You can use API interactions to manage test data, or to ensure services are up and running before performing any UI checks.
|
|
63
|
+
// Since Serenity/JS demo website is deployed to GitHub Pages,
|
|
64
|
+
// before interacting with the website we ensure that GitHub itself is up and running.
|
|
65
|
+
await actorCalled('Apisitt').attemptsTo(
|
|
66
|
+
GitHubStatus.ensureAllSystemsOperational(),
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
// Once we know the system is up and running, Wendy can proceed with the web-based scenario.
|
|
70
|
+
await actorCalled('Wendy').attemptsTo(
|
|
71
|
+
TodoList.createListContaining([
|
|
72
|
+
`Buy dog food`,
|
|
73
|
+
`Feed the dog`,
|
|
74
|
+
`Book a vet's appointment`,
|
|
75
|
+
]),
|
|
76
|
+
TodoList.markAsCompleted([
|
|
77
|
+
`Buy dog food`,
|
|
78
|
+
`Feed the dog`,
|
|
79
|
+
]),
|
|
80
|
+
Ensure.that(
|
|
81
|
+
TodoList.outstandingItemsCount(),
|
|
82
|
+
equals(1)
|
|
83
|
+
),
|
|
84
|
+
)
|
|
85
|
+
})
|
|
86
|
+
})
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
<%- _.import('describe, it', 'mocha') %>
|
|
2
|
+
|
|
3
|
+
<%- _.import('Ensure, equals', '@serenity-js/assertions') %>
|
|
4
|
+
<%- _.import('actorCalled', '@serenity-js/core') %>
|
|
5
|
+
<%- _.import('By, Navigate, PageElement, Text', '@serenity-js/web') %>
|
|
6
|
+
|
|
7
|
+
<%- _.import('GitHubStatus', '../serenity/github-api/GitHubStatus') %>
|
|
8
|
+
<%- _.import('TodoList', '../serenity/todo-list-app/TodoList') %>
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Serenity/JS Screenplay Pattern test scenarios use one or more actors to represent people and external systems
|
|
12
|
+
* interacting with the system under test.
|
|
13
|
+
*
|
|
14
|
+
* To design a test scenario, give each actor a series of tasks and interactions to perform
|
|
15
|
+
* and instruct them to answer questions about the state of the system under test
|
|
16
|
+
* to ensure that the answers meet the expected results.
|
|
17
|
+
*
|
|
18
|
+
* This example test file demonstrates several ways of writing test scenarios using the Screenplay Pattern.
|
|
19
|
+
*
|
|
20
|
+
* Learn more:
|
|
21
|
+
* - Serenity/JS Screenplay Pattern - https://serenity-js.org/handbook/design/screenplay-pattern/
|
|
22
|
+
* - Web Testing with Serenity/JS - https://serenity-js.org/handbook/web-testing/
|
|
23
|
+
* - API Testing with Serenity/JS - https://serenity-js.org/handbook/api-testing/
|
|
24
|
+
* - Serenity/JS web module - https://serenity-js.org/api/web/
|
|
25
|
+
* - Serenity/JS REST module - https://serenity-js.org/api/rest/
|
|
26
|
+
* - Serenity/JS assertions module - https://serenity-js.org/api/assertions/
|
|
27
|
+
*/
|
|
28
|
+
describe('Serenity/JS Website', () => {
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* This is the most basic example of a Serenity/JS Screenplay Pattern test scenario.
|
|
32
|
+
*
|
|
33
|
+
* This scenario uses a single actor configured to perform a series of web-based interactions,
|
|
34
|
+
* and uses only the low-level abstractions provided by the Serenity/JS web module.
|
|
35
|
+
*/
|
|
36
|
+
it('offers a web testing tutorial', async () => {
|
|
37
|
+
await actorCalled('Alice').attemptsTo(
|
|
38
|
+
Navigate.to('https://serenity-js.org'),
|
|
39
|
+
Ensure.that(
|
|
40
|
+
Text.of(PageElement.located(By.id('cta-start-automating'))),
|
|
41
|
+
equals('Start automating 🚀')
|
|
42
|
+
),
|
|
43
|
+
)
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* This is a more advanced example of a Serenity/JS Screenplay Pattern test scenario.
|
|
48
|
+
*
|
|
49
|
+
* This scenario uses two actors:
|
|
50
|
+
* - Apisitt, responsible for interacting with an API to check if the system is up and running before performing any UI checks
|
|
51
|
+
* - Wendy, responsible for interacting with the website to perform the actual acceptance test
|
|
52
|
+
*
|
|
53
|
+
* In this scenario, rather than list all the interactions in the test itself, we use:
|
|
54
|
+
* - API Actions Class Pattern to group tasks concerning interacting with the GitHubStatus API
|
|
55
|
+
* - Screenplay Pattern flavour of Page Objects to group tasks and questions concerning interacting with the Serenity/JS Todo List app
|
|
56
|
+
*
|
|
57
|
+
* Note that apart from strongly encouraging the Screenplay Pattern,
|
|
58
|
+
* Serenity/JS doesn't require you to organise your code in any particular way.
|
|
59
|
+
* This gives you the freedom to choose patterns and abstractions that work best for you, your team,
|
|
60
|
+
* and reflect the domain of your system under test.
|
|
61
|
+
*/
|
|
62
|
+
it(`offers examples to help you practice test automation`, async () => {
|
|
63
|
+
|
|
64
|
+
// You can use API interactions to manage test data, or to ensure services are up and running before performing any UI checks.
|
|
65
|
+
// Since Serenity/JS demo website is deployed to GitHub Pages,
|
|
66
|
+
// before interacting with the website we ensure that GitHub itself is up and running.
|
|
67
|
+
await actorCalled('Apisitt').attemptsTo(
|
|
68
|
+
GitHubStatus.ensureAllSystemsOperational(),
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
// Once we know the system is up and running, Wendy can proceed with the web-based scenario.
|
|
72
|
+
await actorCalled('Wendy').attemptsTo(
|
|
73
|
+
TodoList.createListContaining([
|
|
74
|
+
`Buy dog food`,
|
|
75
|
+
`Feed the dog`,
|
|
76
|
+
`Book a vet's appointment`,
|
|
77
|
+
]),
|
|
78
|
+
TodoList.markAsCompleted([
|
|
79
|
+
`Buy dog food`,
|
|
80
|
+
`Feed the dog`,
|
|
81
|
+
]),
|
|
82
|
+
Ensure.that(
|
|
83
|
+
TodoList.outstandingItemsCount(),
|
|
84
|
+
equals(1)
|
|
85
|
+
),
|
|
86
|
+
)
|
|
87
|
+
})
|
|
88
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function to be executed after a test (in Mocha/Jasmine only)
|
|
3
|
+
* @param {object} test test object
|
|
4
|
+
* @param {object} context scope object the test was executed with
|
|
5
|
+
* @param {Error} result.error error object in case the test fails, otherwise `undefined`
|
|
6
|
+
* @param {*} result.result return object of test function
|
|
7
|
+
* @param {number} result.duration duration of test
|
|
8
|
+
* @param {boolean} result.passed true if test has passed, otherwise false
|
|
9
|
+
* @param {object} result.retries information about spec related retries, e.g. `{ attempts: 0, limit: 0 }`
|
|
10
|
+
*/<%
|
|
11
|
+
if (reporters.length && reporters.includes('allure')) {%>
|
|
12
|
+
afterTest: async function(test, context, { error, result, duration, passed, retries }) {
|
|
13
|
+
if (!passed) {
|
|
14
|
+
await browser.takeScreenshot();
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
<% } else { %>
|
|
18
|
+
// afterTest: function(test, context, { error, result, duration, passed, retries }) {
|
|
19
|
+
// },
|
|
20
|
+
<% } %>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
capabilities: [{<%
|
|
2
|
+
if (answers.expEnvAccessKey) { %>
|
|
3
|
+
// Experitest Access Key
|
|
4
|
+
// get more information at https://docs.experitest.com/display/TE/Obtaining+Access+Key
|
|
5
|
+
'experitest:accessKey': '<%- answers.expEnvAccessKey %>',<%
|
|
6
|
+
}
|
|
7
|
+
if (answers.browserEnvironment && answers.browserEnvironment.length) { %>
|
|
8
|
+
<%- answers.browserEnvironment.map((browserName) => {
|
|
9
|
+
return `browserName: '${browserName}'`
|
|
10
|
+
}).join('\n }, {\n ') %><%
|
|
11
|
+
} else if (answers.mobileEnvironment === 'android') { %>
|
|
12
|
+
// capabilities for local Appium web tests on an Android Emulator
|
|
13
|
+
platformName: 'Android',
|
|
14
|
+
browserName: 'Chrome',
|
|
15
|
+
'appium:deviceName': 'Android GoogleAPI Emulator',
|
|
16
|
+
'appium:platformVersion': '12.0',
|
|
17
|
+
'appium:automationName': 'UiAutomator2'<%
|
|
18
|
+
} else if (answers.mobileEnvironment === 'ios') { %>
|
|
19
|
+
// capabilities for local Appium web tests on iOS
|
|
20
|
+
platformName: 'iOS',
|
|
21
|
+
browserName: 'Safari',
|
|
22
|
+
'appium:deviceName': 'iPhone Simulator',
|
|
23
|
+
'appium:platformVersion': '16.4',
|
|
24
|
+
'appium:automationName': 'XCUITest'<%
|
|
25
|
+
} else if (answers.purpose === 'macos') { %>
|
|
26
|
+
platformName: 'Mac',
|
|
27
|
+
'appium:automationName': 'Mac2',
|
|
28
|
+
'appium:bundleId': '<%= answers.generateTestFiles ? 'com.apple.calculator' : '...' %>'<%
|
|
29
|
+
} else if (answers.purpose === 'vscode') { %>
|
|
30
|
+
browserName: 'vscode',
|
|
31
|
+
browserVersion: 'stable', // also possible: "insiders" or a specific version e.g. "1.80.0"
|
|
32
|
+
'wdio:vscodeOptions': {
|
|
33
|
+
// points to directory where extension package.json is located
|
|
34
|
+
extensionPath: __dirname,
|
|
35
|
+
// optional VS Code settings
|
|
36
|
+
userSettings: {
|
|
37
|
+
"editor.fontSize": 14
|
|
38
|
+
}
|
|
39
|
+
}<%
|
|
40
|
+
} else if (answers.purpose === 'electron') { %>
|
|
41
|
+
browserName: 'electron',
|
|
42
|
+
// Electron service options
|
|
43
|
+
// see https://webdriver.io/docs/desktop-testing/electron/configuration/#service-options
|
|
44
|
+
'wdio:electronServiceOptions': {<%
|
|
45
|
+
if (answers.electronAppBinaryPath) { %>
|
|
46
|
+
// custom path to app binary
|
|
47
|
+
appBinaryPath: '<%- answers.electronAppBinaryPath %>',<%
|
|
48
|
+
} %>
|
|
49
|
+
// custom application args
|
|
50
|
+
appArgs: []
|
|
51
|
+
}<%
|
|
52
|
+
} else {
|
|
53
|
+
%>
|
|
54
|
+
// capabilities for local browser web tests
|
|
55
|
+
browserName: 'chrome' // or "firefox", "microsoftedge", "safari"<%
|
|
56
|
+
} %>
|
|
57
|
+
}],
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<% if (answers.framework === 'cucumber') { %>
|
|
2
|
+
// If you are using Cucumber you need to specify the location of your step definitions.
|
|
3
|
+
cucumberOpts: {
|
|
4
|
+
// <string[]> (file/dir) require files before executing features
|
|
5
|
+
require: ['<%- answers.stepDefinitions %>'],
|
|
6
|
+
// <boolean> show full backtrace for errors
|
|
7
|
+
backtrace: false,
|
|
8
|
+
// <string[]> ("extension:module") require files with the given EXTENSION after requiring MODULE (repeatable)
|
|
9
|
+
requireModule: [],
|
|
10
|
+
// <boolean> invoke formatters without executing steps
|
|
11
|
+
dryRun: false,
|
|
12
|
+
// <boolean> abort the run on first failure
|
|
13
|
+
failFast: false,
|
|
14
|
+
// <string[]> Only execute the scenarios with name matching the expression (repeatable).
|
|
15
|
+
name: [],
|
|
16
|
+
// <boolean> hide step definition snippets for pending steps
|
|
17
|
+
snippets: true,
|
|
18
|
+
// <boolean> hide source uris
|
|
19
|
+
source: true,
|
|
20
|
+
// <boolean> fail if there are any undefined or pending steps
|
|
21
|
+
strict: false,
|
|
22
|
+
// <string> (expression) only execute the features or scenarios with tags matching the expression
|
|
23
|
+
tagExpression: '',
|
|
24
|
+
// <number> timeout for step definitions
|
|
25
|
+
timeout: 60000,
|
|
26
|
+
// <boolean> Enable this config to treat undefined definitions as warnings.
|
|
27
|
+
ignoreUndefinedDefinitions: false
|
|
28
|
+
},
|
|
29
|
+
<% } else if (answers.serenityAdapter === 'cucumber') { %>
|
|
30
|
+
// Cucumber configuration, see
|
|
31
|
+
// https://serenity-js.org/api/cucumber-adapter/interface/CucumberConfig/
|
|
32
|
+
cucumberOpts: {
|
|
33
|
+
// <string[]> (file/dir) require files before executing features
|
|
34
|
+
import: [
|
|
35
|
+
<% if (answers.stepDefinitions) {
|
|
36
|
+
%>'<%- answers.stepDefinitions %>',
|
|
37
|
+
<% } %>'./features/support/*.<%- answers.isUsingTypeScript ? 'ts' : 'js' %>',
|
|
38
|
+
],
|
|
39
|
+
// <string[]> (type[:path]) specify native Cucumber.js output format, if needed. Optionally supply PATH to redirect formatter output (repeatable)
|
|
40
|
+
format: [ ],
|
|
41
|
+
// <string> (name) specify the profile to use
|
|
42
|
+
profile: '',
|
|
43
|
+
// <boolean> fail if there are any undefined or pending steps
|
|
44
|
+
strict: false,
|
|
45
|
+
// <string[] | string> (expression) only execute the features or scenarios with tags matching the expression
|
|
46
|
+
tags: [],
|
|
47
|
+
// <number> timeout for step definitions
|
|
48
|
+
timeout: 60000,
|
|
49
|
+
},
|
|
50
|
+
<% } %>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<% if (answers.framework === 'jasmine') { %>
|
|
2
|
+
// Options to be passed to Jasmine.
|
|
3
|
+
jasmineOpts: {
|
|
4
|
+
// Jasmine default timeout
|
|
5
|
+
defaultTimeoutInterval: 60000,
|
|
6
|
+
//
|
|
7
|
+
// The Jasmine framework allows interception of each assertion in order to log the state of the application
|
|
8
|
+
// or website depending on the result. For example, it is pretty handy to take a screenshot every time
|
|
9
|
+
// an assertion fails.
|
|
10
|
+
expectationResultHandler: function(passed, assertion) {
|
|
11
|
+
// do something
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
<% } else if (answers.serenityAdapter === 'jasmine') { %>
|
|
15
|
+
// Jasmine configuration, see:
|
|
16
|
+
// https://serenity-js.org/api/jasmine-adapter/interface/JasmineConfig
|
|
17
|
+
jasmineOpts: {
|
|
18
|
+
defaultTimeoutInterval: 60000,
|
|
19
|
+
},
|
|
20
|
+
<% } %>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { expect, $ } from '@wdio/globals'
|
|
2
|
+
|
|
3
|
+
describe('MacOS Testing', () => {
|
|
4
|
+
it('should calculate the meaning of life', async function () {
|
|
5
|
+
await $('//XCUIElementTypeButton[@label="seven"]').click()
|
|
6
|
+
await $('//XCUIElementTypeButton[@label="multiply"]').click()
|
|
7
|
+
await $('//XCUIElementTypeButton[@label="six"]').click()
|
|
8
|
+
await $('//XCUIElementTypeButton[@title="="]').click()
|
|
9
|
+
await expect($('//XCUIElementTypeStaticText[@label="main display"]')).toHaveText('42')
|
|
10
|
+
})
|
|
11
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<% if (answers.framework === 'mocha') { %>
|
|
2
|
+
// Options to be passed to Mocha.
|
|
3
|
+
// See the full list at http://mochajs.org/
|
|
4
|
+
mochaOpts: {
|
|
5
|
+
ui: 'bdd',
|
|
6
|
+
timeout: 60000
|
|
7
|
+
},
|
|
8
|
+
<% } else if (answers.serenityAdapter === 'mocha') { %>
|
|
9
|
+
// Mocha configuration, see:
|
|
10
|
+
// https://serenity-js.org/api/mocha-adapter/interface/MochaConfig/
|
|
11
|
+
mochaOpts: {
|
|
12
|
+
timeout: 60000
|
|
13
|
+
},
|
|
14
|
+
<% } %>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Test reporter for stdout.
|
|
2
|
+
// The only one supported by default is 'dot'
|
|
3
|
+
// see also: https://webdriver.io/docs/dot-reporter<%
|
|
4
|
+
if (reporters.length) { %>
|
|
5
|
+
reporters: [<%- reporters.map(reporter => {
|
|
6
|
+
if (reporter === 'allure') {
|
|
7
|
+
return `['${reporter}', {outputDir: 'allure-results'}]`
|
|
8
|
+
} else {
|
|
9
|
+
return `'${reporter}'`
|
|
10
|
+
}
|
|
11
|
+
}) %>],<% } else { %>
|
|
12
|
+
// reporters: ['dot'],<%
|
|
13
|
+
}
|
|
14
|
+
%>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Serenity/JS configuration, see:
|
|
3
|
+
// https://serenity-js.org/handbook/getting-started/serenity-js-with-webdriverio/
|
|
4
|
+
serenity: {
|
|
5
|
+
runner: '<%- answers.serenityAdapter %>',
|
|
6
|
+
|
|
7
|
+
// Configure reporting services, see:
|
|
8
|
+
// https://serenity-js.org/handbook/reporting/
|
|
9
|
+
crew: [
|
|
10
|
+
'@serenity-js/console-reporter',
|
|
11
|
+
'@serenity-js/serenity-bdd',
|
|
12
|
+
[ '@serenity-js/core:ArtifactArchiver', { outputDirectory: 'target/site/serenity' } ],
|
|
13
|
+
[ '@serenity-js/web:Photographer', {
|
|
14
|
+
// strategy: 'TakePhotosOfFailures' // fast execution, screenshots only when tests fail
|
|
15
|
+
strategy: 'TakePhotosOfInteractions' // slower execution, more comprehensive reports
|
|
16
|
+
} ],
|
|
17
|
+
]
|
|
18
|
+
},
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
services: [<%- answers.services.map((service) => {
|
|
2
|
+
if (service === 'electron') {
|
|
3
|
+
return /*js*/`'electron'`
|
|
4
|
+
} else if (service === 'sauce' && answers.useSauceConnect) {
|
|
5
|
+
return /*js*/`[
|
|
6
|
+
'sauce',
|
|
7
|
+
{
|
|
8
|
+
sauceConnect: true,
|
|
9
|
+
sauceConnectOpts: {
|
|
10
|
+
// add Sauce Connect Options if needed
|
|
11
|
+
// see more at https://wiki.saucelabs.com/display/DOCS/Sauce+Connect+Proxy+Command-Line+Quick+Reference+Guide
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
]`
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return `'${service}'`
|
|
18
|
+
}).join(', ') %>],
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<%- answers.isUsingTypeScript || answers.esmSupport
|
|
2
|
+
? `import { expect } from '@wdio/globals'`
|
|
3
|
+
: `const { expect } = require('@wdio/globals')` %>
|
|
4
|
+
<%- answers.isUsingTypeScript || answers.esmSupport
|
|
5
|
+
? `import LoginPage from '${answers.relativePath}/login.page${answers.esmSupport ? '.js' : ''}'`
|
|
6
|
+
: `const LoginPage = require('${answers.relativePath}/login.page')` %>
|
|
7
|
+
<%- answers.isUsingTypeScript || answers.esmSupport
|
|
8
|
+
? `import SecurePage from '${answers.relativePath}/secure.page${answers.esmSupport ? '.js' : ''}'`
|
|
9
|
+
: `const SecurePage = require('${answers.relativePath}/secure.page')` %>
|
|
10
|
+
|
|
11
|
+
describe('My Login application', () => {
|
|
12
|
+
it('should login with valid credentials', async () => {
|
|
13
|
+
await LoginPage.open()
|
|
14
|
+
|
|
15
|
+
await LoginPage.login('tomsmith', 'SuperSecretPassword!')
|
|
16
|
+
await expect(SecurePage.flashAlert).toBeExisting()
|
|
17
|
+
await expect(SecurePage.flashAlert).toHaveTextContaining(
|
|
18
|
+
'You logged into a secure area!')<%-
|
|
19
|
+
answers.includeVisualTesting ? `
|
|
20
|
+
await expect(SecurePage.flashAlert).toMatchElementSnapshot('flashAlert')` : '' %>
|
|
21
|
+
})
|
|
22
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<%- answers.isUsingTypeScript || answers.esmSupport
|
|
2
|
+
? `import { expect, browser, $ } from '@wdio/globals'`
|
|
3
|
+
: `const { expect, browser, $ } = require('@wdio/globals')` %>
|
|
4
|
+
|
|
5
|
+
describe('My Login application', () => {
|
|
6
|
+
it('should login with valid credentials', async () => {
|
|
7
|
+
await browser.url(`https://the-internet.herokuapp.com/login`)
|
|
8
|
+
|
|
9
|
+
await $('#username').setValue('tomsmith')
|
|
10
|
+
await $('#password').setValue('SuperSecretPassword!')
|
|
11
|
+
await $('button[type="submit"]').click()
|
|
12
|
+
|
|
13
|
+
await expect($('#flash')).toBeExisting()
|
|
14
|
+
await expect($('#flash')).toHaveTextContaining(
|
|
15
|
+
'You logged into a secure area!')<%-
|
|
16
|
+
answers.includeVisualTesting ? `
|
|
17
|
+
await expect($('#flash')).toMatchElementSnapshot('flashAlert')` : '' %>
|
|
18
|
+
})
|
|
19
|
+
})
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { browser, expect } from '@wdio/globals'
|
|
2
|
+
|
|
3
|
+
describe('VS Code Extension Testing', () => {
|
|
4
|
+
it('should be able to load VSCode', async () => {
|
|
5
|
+
const workbench = await browser.getWorkbench()
|
|
6
|
+
expect(await workbench.getTitleBar().getTitle())
|
|
7
|
+
.toContain('[Extension Development Host]')
|
|
8
|
+
})
|
|
9
|
+
})
|