@sap_oss/wdio-qmate-service 1.0.0 → 1.0.2
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/README.md +2 -1
- package/{test/core/package-lock.json → docs/bestPractices/spec.md} +0 -0
- package/docs/doc.md +176 -353
- package/docs/gettingStarted/setup.md +2 -2
- package/docs/index.md +1 -1
- package/docs/sections/bestPractices/authentication.md +151 -0
- package/docs/sections/bestPractices/dataHandling.md +61 -0
- package/docs/sections/bestPractices/selectors.md +44 -0
- package/docs/{contact.md → sections/contact.md} +0 -0
- package/docs/sections/features/advancedDataHandling.md +252 -0
- package/docs/sections/features/config.md +171 -0
- package/docs/sections/features/dataHandling.md +83 -0
- package/docs/{gettingStarted → sections/features}/selectors.md +0 -0
- package/docs/sections/features/spec.md +0 -0
- package/docs/sections/gettingStarted/config.md +18 -0
- package/docs/sections/gettingStarted/execution.md +7 -0
- package/docs/sections/gettingStarted/setup.md +9 -0
- package/docs/sections/gettingStarted/spec.md +31 -0
- package/docs/sections/gettingStarted/specs.md +19 -0
- package/docs/sections/support/bugReporting.md +19 -0
- package/docs/sections/support/knownIssuesAndLimitations.md +0 -0
- package/docs/sections/support/troubleshooting.md +16 -0
- package/docs/sources/images/fiori_form.PNG +0 -0
- package/docs/sources/images/sapCloud_form.PNG +0 -0
- package/lib/index.js +59 -82
- package/lib/index.js.map +1 -1
- package/lib/reuse/authenticator/authHandler.js +12 -23
- package/lib/reuse/authenticator/authHandler.js.map +1 -1
- package/lib/reuse/authenticator/basicUrlAuthenticator.js +21 -32
- package/lib/reuse/authenticator/basicUrlAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/customAuthenticator.js +42 -55
- package/lib/reuse/authenticator/customAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/formAuthenticator.js +37 -50
- package/lib/reuse/authenticator/formAuthenticator.js.map +1 -1
- package/lib/reuse/authenticator/plainAuthenticator.js +5 -16
- package/lib/reuse/authenticator/plainAuthenticator.js.map +1 -1
- package/lib/reuse/helper/jsDocGen.js +4 -12
- package/lib/reuse/helper/jsDocGen.js.map +1 -1
- package/lib/reuse/index.js +20 -5
- package/lib/reuse/index.js.map +1 -1
- package/lib/reuse/modules/common/navigation.js +10 -23
- package/lib/reuse/modules/common/navigation.js.map +1 -1
- package/lib/reuse/modules/common/userInteraction.js +40 -73
- package/lib/reuse/modules/common/userInteraction.js.map +1 -1
- package/lib/reuse/modules/nonUi5/assertion.js +31 -52
- package/lib/reuse/modules/nonUi5/assertion.js.map +1 -1
- package/lib/reuse/modules/nonUi5/element.js +266 -331
- package/lib/reuse/modules/nonUi5/element.js.map +1 -1
- package/lib/reuse/modules/nonUi5/navigation.js +10 -21
- package/lib/reuse/modules/nonUi5/navigation.js.map +1 -1
- package/lib/reuse/modules/nonUi5/userInteraction.js +176 -215
- package/lib/reuse/modules/nonUi5/userInteraction.js.map +1 -1
- package/lib/reuse/modules/service/odata.d.ts +106 -94
- package/lib/reuse/modules/service/odata.js +209 -204
- package/lib/reuse/modules/service/odata.js.map +1 -1
- package/lib/reuse/modules/service/rest.js +64 -81
- package/lib/reuse/modules/service/rest.js.map +1 -1
- package/lib/reuse/modules/ui5/assertion.js +217 -268
- package/lib/reuse/modules/ui5/assertion.js.map +1 -1
- package/lib/reuse/modules/ui5/confirmationDialog.js +17 -42
- package/lib/reuse/modules/ui5/confirmationDialog.js.map +1 -1
- package/lib/reuse/modules/ui5/control.js +12 -33
- package/lib/reuse/modules/ui5/control.js.map +1 -1
- package/lib/reuse/modules/ui5/date.js +70 -89
- package/lib/reuse/modules/ui5/date.js.map +1 -1
- package/lib/reuse/modules/ui5/element.js +121 -156
- package/lib/reuse/modules/ui5/element.js.map +1 -1
- package/lib/reuse/modules/ui5/errorDialog.js +4 -17
- package/lib/reuse/modules/ui5/errorDialog.js.map +1 -1
- package/lib/reuse/modules/ui5/footerBar.js +28 -63
- package/lib/reuse/modules/ui5/footerBar.js.map +1 -1
- package/lib/reuse/modules/ui5/mockserver.js +390 -427
- package/lib/reuse/modules/ui5/mockserver.js.map +1 -1
- package/lib/reuse/modules/ui5/navigation.js +105 -132
- package/lib/reuse/modules/ui5/navigation.js.map +1 -1
- package/lib/reuse/modules/ui5/navigationBar.js +58 -77
- package/lib/reuse/modules/ui5/navigationBar.js.map +1 -1
- package/lib/reuse/modules/ui5/qunit.js +16 -27
- package/lib/reuse/modules/ui5/qunit.js.map +1 -1
- package/lib/reuse/modules/ui5/session.js +200 -236
- package/lib/reuse/modules/ui5/session.js.map +1 -1
- package/lib/reuse/modules/ui5/table.js +79 -98
- package/lib/reuse/modules/ui5/table.js.map +1 -1
- package/lib/reuse/modules/ui5/userInteraction.js +264 -335
- package/lib/reuse/modules/ui5/userInteraction.js.map +1 -1
- package/lib/reuse/modules/util/browser.js +131 -178
- package/lib/reuse/modules/util/browser.js.map +1 -1
- package/lib/reuse/modules/util/data.js +3 -2
- package/lib/reuse/modules/util/data.js.map +1 -1
- package/lib/reuse/modules/util/file.js +71 -90
- package/lib/reuse/modules/util/file.js.map +1 -1
- package/lib/reuse/modules/util/function.js +68 -87
- package/lib/reuse/modules/util/function.js.map +1 -1
- package/lib/reuse/modules/util/system.js +22 -33
- package/lib/reuse/modules/util/system.js.map +1 -1
- package/lib/scripts/dataExchange/dataExchange.js +145 -160
- package/lib/scripts/dataExchange/dataExchange.js.map +1 -1
- package/lib/scripts/dataExchange/dataExchangeUtil.js +93 -114
- package/lib/scripts/dataExchange/dataExchangeUtil.js.map +1 -1
- package/lib/scripts/hooks/after.js +3 -14
- package/lib/scripts/hooks/after.js.map +1 -1
- package/lib/scripts/hooks/before.js +9 -20
- package/lib/scripts/hooks/before.js.map +1 -1
- package/lib/scripts/hooks/beforeSession.js +7 -18
- package/lib/scripts/hooks/beforeSession.js.map +1 -1
- package/lib/scripts/hooks/onComplete.js +2 -13
- package/lib/scripts/hooks/onComplete.js.map +1 -1
- package/lib/scripts/hooks/onPrepare.js +9 -20
- package/lib/scripts/hooks/onPrepare.js.map +1 -1
- package/lib/scripts/hooks/utils/addLocatorCommands.js +109 -172
- package/lib/scripts/hooks/utils/addLocatorCommands.js.map +1 -1
- package/lib/scripts/hooks/utils/browserLog.js +18 -31
- package/lib/scripts/hooks/utils/browserLog.js.map +1 -1
- package/lib/scripts/hooks/utils/dataExchangeCommands.js +13 -24
- package/lib/scripts/hooks/utils/dataExchangeCommands.js.map +1 -1
- package/lib/scripts/hooks/utils/decryption.d.ts +1 -1
- package/lib/scripts/hooks/utils/decryption.js +33 -14
- package/lib/scripts/hooks/utils/decryption.js.map +1 -1
- package/lib/scripts/hooks/utils/lib.js +249 -272
- package/lib/scripts/hooks/utils/lib.js.map +1 -1
- package/lib/scripts/hooks/utils/locatorCommands.js +154 -183
- package/lib/scripts/hooks/utils/locatorCommands.js.map +1 -1
- package/mkdocs.yml +16 -3
- package/package.json +14 -11
- package/test/authenticator/staticLogin/specs/custom.spec.js +30 -1
- package/test/reuse/nonUi5/element/getById.spec.js +17 -0
- package/test/reuse/service/odata/get.spec.js +61 -0
- package/test/reuse/service/odata/getEntitySet.spec.js +87 -0
- package/test/reuse/service/odata/test.odata.conf.js +15 -0
- package/test/reuse/ui5/confirmationDialog/clickButton.spec.js +87 -0
- package/test/reuse/ui5/confirmationDialog/test.confirmationDialog.conf.js +2 -1
- package/test/reuse/ui5/element/test.element.conf.js +2 -1
- package/test/reuse/ui5/element/waitForAll.spec.js +46 -0
- package/test/reuse/ui5/userInteraction/clearAndFillSmartFieldInputAndRetry.spec.js +28 -0
- package/test/reuse/ui5/userInteraction/test.userInteraction.conf.js +1 -0
- package/test/reuse/util/browser/switchToNewWindow.spec.js +2 -2
- package/test/reuse/util/console/console.spec.js +27 -0
- package/test/reuse/util/console/test.console.conf.js +12 -0
- package/test/reuse/util/data/data/test.secure.json +7 -3
- package/test/reuse/util/data/getSecureData.spec.js +9 -3
- package/test/reuse/util/file/pdfParser.spec.js +33 -8
- package/test/reuse/util/system/system.spec.js +16 -0
- package/test/reuse/util/system/test.system.conf.js +12 -0
- package/tsconfig.json +1 -1
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
## Important WebdriverIO Parameters
|
|
2
|
+
|
|
3
|
+
!!!info "WebdriverIO Parameters"
|
|
4
|
+
For more information about how to setup your config please see the official [documentation](https://webdriver.io/docs/configurationfile/) from WebdriverIO.
|
|
5
|
+
|
|
6
|
+
### *baseUrl*
|
|
7
|
+
The `baseUrl` defines the entry point of your script. Here you can define in which system or application your script/s is/are being executed.
|
|
8
|
+
```javascript
|
|
9
|
+
baseUrl: "https://www.sap.com"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
### *specs*
|
|
13
|
+
Inside the `specs` array you specify the scripts to execute.
|
|
14
|
+
```js
|
|
15
|
+
specs: [
|
|
16
|
+
path.resolve(__dirname, "path/to/specs/yourSpec1.spec.js"),
|
|
17
|
+
path.resolve(__dirname, "path/to/specs/yourSpec2.spec.js"),
|
|
18
|
+
path.resolve(__dirname, "path/to/specs/yourSpec3.spec.js")
|
|
19
|
+
],
|
|
20
|
+
```
|
|
21
|
+
!!! warning
|
|
22
|
+
These specs are being executed sequentially in **different instances**. Therefore, data (e.g. via references.json) **can not be passed** between the specs.
|
|
23
|
+
|
|
24
|
+
To pass data between the specs (run them in a shared instance), you have to group them as shown below:
|
|
25
|
+
```js
|
|
26
|
+
specs: [
|
|
27
|
+
// grouped
|
|
28
|
+
[
|
|
29
|
+
path.resolve(__dirname, "path/to/specs/yourSpec1.spec.js"),
|
|
30
|
+
path.resolve(__dirname, "path/to/specs/yourSpec2.spec.js")
|
|
31
|
+
],
|
|
32
|
+
// ungrouped
|
|
33
|
+
path.resolve(__dirname, "path/to/specs/yourSpec3.spec.js")
|
|
34
|
+
],
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### *maxInstances*
|
|
38
|
+
The number of parallel instances running at the same time.
|
|
39
|
+
```javascript
|
|
40
|
+
maxInstances: 0
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### *bail* & *mocha bail*
|
|
44
|
+
In qmate there are **two different** types of parameters to specify how your test executions should behave in case of a failure. Please make sure to set both parameters with the values according to the table below.
|
|
45
|
+
|
|
46
|
+
=== "wdio bail"
|
|
47
|
+
Possible values are: `0`, `1`
|
|
48
|
+
```javascript
|
|
49
|
+
bail: 1
|
|
50
|
+
```
|
|
51
|
+
=== "mocha bail"
|
|
52
|
+
Possible values: `true`, `false`
|
|
53
|
+
```javascript
|
|
54
|
+
mochaOpts: {
|
|
55
|
+
bail: true
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Please find the below table for a detailed overview of all possible options:
|
|
60
|
+
|
|
61
|
+
| name | mocha bail | wdio bail | result |
|
|
62
|
+
| ------------- | ---------- | --------- | ------------------------------------------------------------------------|
|
|
63
|
+
| break all | ``true`` | ``1`` | break whole test execution after failure |
|
|
64
|
+
| break further | ``false`` | ``1`` | continue with failed spec, break further spec execution after failure |
|
|
65
|
+
| break current | ``true`` | ``0`` | break failed spec, continue further spec execution |
|
|
66
|
+
| ignore | ``false`` | ``0`` | don't break test execution at all |
|
|
67
|
+
|
|
68
|
+
!!! warning
|
|
69
|
+
Grouped specs or describes within the same file will behave the same as the failed spec.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### *specFileRetries*
|
|
74
|
+
The number of times to retry an entire specfile when it fails as a whole.
|
|
75
|
+
```javascript
|
|
76
|
+
specFileRetries: 3
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### *logLevel*
|
|
80
|
+
The level of logging verbosity.
|
|
81
|
+
|
|
82
|
+
Possible values are: ``trace`` | ``debug`` | ``info`` | ``warn`` | ``error`` | ``silent``
|
|
83
|
+
```javascript
|
|
84
|
+
logLevel: warn
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
___
|
|
88
|
+
## Qmate Service specific parameters
|
|
89
|
+
The `params` object inside your config defines soe specific Qmate relevant parameters.
|
|
90
|
+
```javascript
|
|
91
|
+
params: {
|
|
92
|
+
// [..]
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
!!! warning
|
|
97
|
+
The following parameters are being defined inside the `params` object above.
|
|
98
|
+
|
|
99
|
+
#### *auth*
|
|
100
|
+
Specifies the way, Qmate will login to the system. See section [Authentication](../bestPractices/authentication.md) for possible options and more details.
|
|
101
|
+
```javascript
|
|
102
|
+
params: {
|
|
103
|
+
auth: {
|
|
104
|
+
formType: "plain"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
#### *systemUrl*
|
|
110
|
+
Defines your system url used for OData/REST API calls.
|
|
111
|
+
```javascript
|
|
112
|
+
params: {
|
|
113
|
+
systemUrl: "https://www.sap.com"
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
#### *logUI5Version*
|
|
118
|
+
Specifies the log level of the UI5 version and timestamp of the system in use. Possible values are:
|
|
119
|
+
|
|
120
|
+
=== "always"
|
|
121
|
+
Logs the UI5 version after each system login.
|
|
122
|
+
```javascript
|
|
123
|
+
params: {
|
|
124
|
+
logUI5Version: "always"
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
=== "true"
|
|
129
|
+
Logs the UI5 version per execution.
|
|
130
|
+
```javascript
|
|
131
|
+
params: {
|
|
132
|
+
logUI5Version: true
|
|
133
|
+
}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
=== "false"
|
|
137
|
+
Does not log the UI5 version at all.
|
|
138
|
+
```javascript
|
|
139
|
+
params: {
|
|
140
|
+
logUI5Version: false
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
```console title="console output"
|
|
145
|
+
UI5 Version: 1.96.1
|
|
146
|
+
UI5 Timestamp: 25/11/2021
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
#### *qmateCustomTimeout*
|
|
150
|
+
Overwrites the default timeout of 30 seconds in the functions from the Qmate Reuse API with the given value. Unit is milliseconds.
|
|
151
|
+
```javascript
|
|
152
|
+
params: {
|
|
153
|
+
qmateCustomTimeout: 40000
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### *stepSleepTime*
|
|
158
|
+
Static sleep time after each step. Unit is milliseconds. Can be used to manually slow down the test execution. Set to `0` to disable.
|
|
159
|
+
```javascript
|
|
160
|
+
params: {
|
|
161
|
+
stepSleepTime: 5000
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
#### *loadPropertyTimeout*
|
|
166
|
+
Overwrites the default loadPropertyTimeout of 10 seconds in the functions from the Qmate Reuse API with the given value. Unit is milliseconds.
|
|
167
|
+
```javascript
|
|
168
|
+
params: {
|
|
169
|
+
qmateCustomTimeout: 20000
|
|
170
|
+
}
|
|
171
|
+
```
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Data Handling
|
|
2
|
+
> Related Topics: [Best Practices - Data Handling](../bestPractices/dataHandling.md) | [Advanced Data Handling](./advancedDataHandling.md)
|
|
3
|
+
|
|
4
|
+
## Data Types
|
|
5
|
+
There are basically two different types of data being used within your test execution.
|
|
6
|
+
### Input Data
|
|
7
|
+
Input data is the data defined by the scenario to perform all types of user inputs within the test execution. It is recommended to **create one JSON file for each spec** or test. A common pattern is to **name the data file exactly like the spec file**. E.g. `createSupplierInvoice.json` contains all and exclusively the required data for the test `createSupplierInvoice.spec.js`. With that, the relationship between the data and the test itself is clear and the data is easily maintainable. Your data file could look like:
|
|
8
|
+
```json title="data/createSupplierInvoice.json"
|
|
9
|
+
{
|
|
10
|
+
"session": {
|
|
11
|
+
"username": "AP_ACCOUNTANT",
|
|
12
|
+
"password": "Welcome1!"
|
|
13
|
+
},
|
|
14
|
+
"generalInformation": {
|
|
15
|
+
"companyCode": "1010",
|
|
16
|
+
"postingDate": "today",
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
As you can see above, the data is separated into different sections like `session` and `generalInformation`. To keep transparency, it is recommended to follow that approach and define your data according to the related section of the UI.
|
|
21
|
+
|
|
22
|
+
### Reference Data
|
|
23
|
+
For some cases - especially for scenario testing - it is required to pass dynamically created data between different specs. For example, your first script is creating a document number you might require inside the process of the second script. Therefore this data needs to be shared during the runtime between multiple scripts. To do so, you can create a `reference.json` file within your data folder which will then be imported in all related scripts.
|
|
24
|
+
```json title="data/references.json"
|
|
25
|
+
{
|
|
26
|
+
"purchaseOrderNumber": null,
|
|
27
|
+
"supplierInvoiceNumber": null
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
!!! info
|
|
31
|
+
Here, the initial values are not set (set to `null`), since they will be [stored](#store-data) during the runtime of your test execution.
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## Data Import
|
|
35
|
+
With the following approach, it is possible to dynamically define (different) data and data paths independently from the actual location of the specs or data files. Thus, it is the recommended way to handle your test data.
|
|
36
|
+
|
|
37
|
+
### Define data paths
|
|
38
|
+
Commonly, your data is stored inside the *data* folder of your test suite. Therefore the path pointing to the data file(s) is defined in the configuration file like:
|
|
39
|
+
```js title="config.js"
|
|
40
|
+
params: {
|
|
41
|
+
import: {
|
|
42
|
+
data: "./data/"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
```
|
|
46
|
+
!!! tip
|
|
47
|
+
For some special cases, you might require to defined multiple and more advanced data paths. Please find further information under [Advanced Data Handling](./advancedDataHandling.md).
|
|
48
|
+
|
|
49
|
+
### Load data
|
|
50
|
+
To import data inside your spec, add the following code at the top of your test / describe block:
|
|
51
|
+
```js title="specs/createSupplierInvoice.spec"
|
|
52
|
+
const data = browser.config.params.import.data["createSupplierInvoice"];
|
|
53
|
+
const references = browser.config.params.import.data["references"];
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
!!! tip
|
|
57
|
+
Alternatively, you can load the data with the following [reuse method](https://pages.github.tools.sap/sProcurement/wdio-qmate-service-ts/doc/#util.data.getData):
|
|
58
|
+
```js
|
|
59
|
+
const data = util.data.getData("createSupplierInvoice");
|
|
60
|
+
```
|
|
61
|
+
This function only works for data located in the folder defined as ``data`` in the config.
|
|
62
|
+
|
|
63
|
+
### Store data
|
|
64
|
+
To store any value inside the imported file and make it available for other specs within the same group, use the following code **inside a step (it block)**:
|
|
65
|
+
```javascript title="specs/createPurchaseOrder.spec"
|
|
66
|
+
references.documentNumber = "4500012345";
|
|
67
|
+
```
|
|
68
|
+
!!! warning
|
|
69
|
+
To be able to share data between different scripts, the specs need to be grouped together inside the configuration file. Please find more information under [Configuration - Specs](https://pages.github.tools.sap/sProcurement/qmate-profiles/sections/parameters/main/#specs). Please consider, that the data is only stored during the runtime of the test execution. To store data persistently, please see chapter [Advanced Data Handling](./advancedDataHandling.md).
|
|
70
|
+
|
|
71
|
+
### Read data
|
|
72
|
+
To read data from the input data or reference file, use the following code **inside a step (it block)**:
|
|
73
|
+
=== "Input Data"
|
|
74
|
+
|
|
75
|
+
```javascript title="specs/createSupplierInvoice.spec"
|
|
76
|
+
const companyCode = data.generalInformation.companyCode;
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
=== "Reference Data"
|
|
80
|
+
|
|
81
|
+
```javascript title="specs/createSupplierInvoice.spec"
|
|
82
|
+
const purchaseOrderNumber = references.purchaseOrderNumber;
|
|
83
|
+
```
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
> Related Topics: [Features ❯ Config](../features/config.md)
|
|
2
|
+
|
|
3
|
+
## Enable Qmate Service
|
|
4
|
+
|
|
5
|
+
To use our service you have to enable `@sap_oss/wdio-qmate-service` in your *config.js*.
|
|
6
|
+
|
|
7
|
+
```js title="config.js"
|
|
8
|
+
const QmateService = require("@sap_oss/wdio-qmate-service");
|
|
9
|
+
|
|
10
|
+
exports.config = {
|
|
11
|
+
// ...
|
|
12
|
+
services: [[QmateService]],
|
|
13
|
+
// ...
|
|
14
|
+
};
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
!!! info "WebdriverIO Parameters"
|
|
18
|
+
For more information about **how to setup your config**, please see the official [documentation](https://webdriver.io/docs/configurationfile/) from WebdriverIO.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
## Prerequisites
|
|
2
|
+
- Make sure [Node.js](https://nodejs.org/en/download/) is installed on your computer.
|
|
3
|
+
- To use **Qmate Service**, you will have to install [WebdriverIO](https://webdriver.io/).
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
To install the latest version of the service, simply execute the following command:
|
|
7
|
+
```bash
|
|
8
|
+
npm install @wdio/qmate-service
|
|
9
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
> Related Topics: [Features ❯ Spec](../features/config.md) | [Features ❯ Selectors](../features/selectors.md)
|
|
2
|
+
|
|
3
|
+
## Sample
|
|
4
|
+
|
|
5
|
+
Inside the *.spec.js* file, you define the sequence of steps for your test script. Each file consists of at least one *describe* block.
|
|
6
|
+
```js title="clickGoOnListReport.spec.js"
|
|
7
|
+
describe("clickGoOnListReport - click 'Go' on ListReport", function () {
|
|
8
|
+
|
|
9
|
+
it("Step 01: Navigate to your application", async function () {
|
|
10
|
+
await ui5.navigation.navigateToApplication("PurchaseOrder-manage")
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("Step 02: Navigate", async function () {
|
|
14
|
+
await ui5.session.login("JOHNDOE", "Greetings1!");
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
it("Step 03: Click 'Go' on ListReport", async function () {
|
|
18
|
+
const selector = {
|
|
19
|
+
"elementProperties": {
|
|
20
|
+
"viewName": "sap.suite.ui.generic.template.ListReport.view.ListReport",
|
|
21
|
+
"metadata": "sap.m.Button",
|
|
22
|
+
"id": "*listReportFilter-btnGo"
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
await ui5.userInteraction.click(selector);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
// ...
|
|
29
|
+
|
|
30
|
+
});
|
|
31
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Specs
|
|
2
|
+
|
|
3
|
+
Inside the *.spec.js* file, you define the sequence of steps for your test script. Each file consists of at least one *describe* block.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
describe("01_yourScript - describe the test", function () {
|
|
7
|
+
|
|
8
|
+
it("Step 01: describe the step", async function () {
|
|
9
|
+
// [...]
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it("Step 02: describe the step", async function () {
|
|
13
|
+
// [...]
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
// [...]
|
|
17
|
+
|
|
18
|
+
});
|
|
19
|
+
```
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Bug Reporting & Feature Requests
|
|
2
|
+
> Related Topics: [Troubleshooting](troubleshooting.md) | [Known Issues & Limitations](knownIssuesAndLimitations.md)
|
|
3
|
+
|
|
4
|
+
## Report a Bug
|
|
5
|
+
!!! bug "Important Information"
|
|
6
|
+
**Before** you open an [issue](https://github.com/SAP/wdio-qmate-service/issues), please go through the checklist below.
|
|
7
|
+
|
|
8
|
+
- [ ] Have a look at the **[trouble shooting](troubleshooting.md)** and **[known Issues & Limitations](knownIssuesAndLimitations.md)** section first, and check if a solution for your issue already exists.
|
|
9
|
+
- [ ] Be sure that there is **no syntactical** error displayed in the error log.
|
|
10
|
+
- [ ] Provide **links** to pipelines/gh-actions and/or specs/files of your repository.
|
|
11
|
+
- [ ] Provide a **detailed analysis** and add **screenshots** if possible.
|
|
12
|
+
- [ ] Follow the **template** given when opening an issue.
|
|
13
|
+
|
|
14
|
+
[Report a Bug :fontawesome-solid-bug:](https://github.tools.sap/sProcurement/qmate/issues/new/choose){ .md-button }
|
|
15
|
+
|
|
16
|
+
## Request a Feature
|
|
17
|
+
If you want to request a feature, please make sure that it will add a common value to *Qmate Service*.
|
|
18
|
+
|
|
19
|
+
[Request a Feature :fontawesome-solid-puzzle-piece:](https://github.com/SAP/wdio-qmate-service/issues/new?assignees=Templada%2C+DIFSRIP&labels=feature&template=feature_request.md&title=%5BFeatureRequest%5D+-+Title+of+desired+feature){ .md-button .md-button--primary }
|
|
File without changes
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
If you find any bug or issue which is not listed below, please open a new [issue](https://github.com/SAP/wdio-qmate-service/issues) in the qmate repository. Thanks for your support.
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## SessionNotCreatedError
|
|
6
|
+
???+ bug "Error Message"
|
|
7
|
+
``Error: SessionNotCreatedError: session not created: This version of ChromeDriver only supports Chrome version 89 Current browser version is 91.0.4472.77 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe``
|
|
8
|
+
|
|
9
|
+
??? warning "Possible Reasons"
|
|
10
|
+
The installed chromedriver does not support the current chrome-browser version or vice versa.
|
|
11
|
+
|
|
12
|
+
??? check "Possible Solutions"
|
|
13
|
+
- Please update your chromedriver version.
|
|
14
|
+
- Also update your Chrome Browser version by visiting [About Google Chrome](chrome://settings/help). This will automatically trigger the Chrome Browser update. You will have to restart Chrome after the update is completed.
|
|
15
|
+
|
|
16
|
+
|
|
Binary file
|
|
Binary file
|
package/lib/index.js
CHANGED
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
"use strict";
|
|
3
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
3
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
4
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
5
|
};
|
|
@@ -38,23 +29,21 @@ module.exports = class CustomWorkerService {
|
|
|
38
29
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
39
30
|
*/
|
|
40
31
|
// @ts-ignore
|
|
41
|
-
onPrepare(config, capabilities) {
|
|
42
|
-
|
|
43
|
-
const logo = ` __
|
|
32
|
+
async onPrepare(config, capabilities) {
|
|
33
|
+
const logo = ` __
|
|
44
34
|
____ _____ ___ ____ _/ /____
|
|
45
35
|
/ __ \`/ __ \`__ \\/ __ \`/ __/ _ \\
|
|
46
36
|
/ /_/ / / / / / / /_/ / /_/ __/
|
|
47
37
|
\\__, /_/ /_/ /_/\__,_/\\__/\\___/
|
|
48
38
|
/_/ \x1b[3m service v.${pj.version}\x1b[0m
|
|
49
39
|
`;
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
});
|
|
40
|
+
console.log(logo);
|
|
41
|
+
try {
|
|
42
|
+
await (0, onPrepare_1.default)(config, capabilities);
|
|
43
|
+
}
|
|
44
|
+
catch (e) {
|
|
45
|
+
console.error(`onPrepare hook failed: ${e}`);
|
|
46
|
+
}
|
|
58
47
|
}
|
|
59
48
|
/**
|
|
60
49
|
* Gets executed just before initializing the webdriver session and test framework. It allows you
|
|
@@ -64,21 +53,19 @@ module.exports = class CustomWorkerService {
|
|
|
64
53
|
* @param {Array.<String>} specs List of spec file paths that are to be run
|
|
65
54
|
*/
|
|
66
55
|
// @ts-ignore
|
|
67
|
-
beforeSession(config, capabilities, specs) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
async beforeSession(config, capabilities, specs) {
|
|
57
|
+
try {
|
|
58
|
+
await (0, beforeSession_1.default)(config, capabilities, specs);
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
if (specs && specs[0]) {
|
|
62
|
+
// `specs` variable is an array, but includes only one current spec
|
|
63
|
+
console.error(`qmateLoader() in 'beforeSession' hook failed for spec '${specs[0]}'. ${e}`);
|
|
71
64
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
// `specs` variable is an array, but includes only one current spec
|
|
75
|
-
console.error(`qmateLoader() in 'beforeSession' hook failed for spec '${specs[0]}'. ${e}`);
|
|
76
|
-
}
|
|
77
|
-
else {
|
|
78
|
-
console.error(`qmateLoader() in 'beforeSession' hook failed. ${e}`);
|
|
79
|
-
}
|
|
65
|
+
else {
|
|
66
|
+
console.error(`qmateLoader() in 'beforeSession' hook failed. ${e}`);
|
|
80
67
|
}
|
|
81
|
-
}
|
|
68
|
+
}
|
|
82
69
|
}
|
|
83
70
|
/**
|
|
84
71
|
* Gets executed before test execution begins. At this point you can access to all global
|
|
@@ -88,49 +75,43 @@ module.exports = class CustomWorkerService {
|
|
|
88
75
|
* @param {Object} browser instance of created browser/device session
|
|
89
76
|
*/
|
|
90
77
|
// @ts-ignore
|
|
91
|
-
before(capabilities, specs, browser) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
78
|
+
async before(capabilities, specs, browser) {
|
|
79
|
+
// Errors in WDIO hooks are suppressed by default => we call process.exit(1). It will mark all specs as failed
|
|
80
|
+
try {
|
|
81
|
+
await (0, before_1.default)(capabilities, specs, browser);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
if (specs && specs[0]) {
|
|
85
|
+
// `specs` variable is an array, but includes only one current spec
|
|
86
|
+
util.console.error(`qmateLoader() in 'before' hook failed for spec '${specs[0]}'. ${e}`);
|
|
96
87
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
// `specs` variable is an array, but includes only one current spec
|
|
100
|
-
util.console.error(`qmateLoader() in 'before' hook failed for spec '${specs[0]}'. ${e}`);
|
|
101
|
-
}
|
|
102
|
-
else {
|
|
103
|
-
util.console.error(`qmateLoader() in 'before' hook failed. ${e}`);
|
|
104
|
-
}
|
|
88
|
+
else {
|
|
89
|
+
util.console.error(`qmateLoader() in 'before' hook failed. ${e}`);
|
|
105
90
|
}
|
|
106
|
-
}
|
|
91
|
+
}
|
|
107
92
|
}
|
|
108
93
|
/**
|
|
109
94
|
* Gets executed before the suite starts.
|
|
110
95
|
* @param {Object} suite suite details
|
|
111
96
|
*/
|
|
112
|
-
beforeSuite(suite) {
|
|
113
|
-
|
|
114
|
-
util.console.log(` ${suite.fullTitle} `, "black", "white");
|
|
115
|
-
});
|
|
97
|
+
async beforeSuite(suite) {
|
|
98
|
+
util.console.log(` ${suite.fullTitle} `, "black", "white");
|
|
116
99
|
}
|
|
117
100
|
/**
|
|
118
101
|
* Function to be executed after a test (in Mocha/Jasmine)
|
|
119
102
|
*/
|
|
120
103
|
// @ts-ignore
|
|
121
|
-
afterTest(test, context, { error, result, duration, passed, retries }) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
}
|
|
133
|
-
});
|
|
104
|
+
async afterTest(test, context, { error, result, duration, passed, retries }) {
|
|
105
|
+
// test.title - for mocha framework
|
|
106
|
+
// test.description - for jasmine framework
|
|
107
|
+
const testName = test.title || test.description;
|
|
108
|
+
// Print test titles as in vyperForAll during test run
|
|
109
|
+
if (!error && passed === true) {
|
|
110
|
+
util.console.info(`\x1b[32m\t✓ ${testName}\x1b[0m (${Math.round(duration / 1000)}s)`);
|
|
111
|
+
}
|
|
112
|
+
else if (error || passed !== true) {
|
|
113
|
+
util.console.error(`\x1b[31m\t✗ ${testName}\x1b[0m (${Math.round(duration / 1000)}s)`);
|
|
114
|
+
}
|
|
134
115
|
}
|
|
135
116
|
/**
|
|
136
117
|
* Gets executed after all tests are done. You still have access to all global variables from
|
|
@@ -139,15 +120,13 @@ module.exports = class CustomWorkerService {
|
|
|
139
120
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
140
121
|
* @param {Array.<String>} specs List of spec file paths that ran
|
|
141
122
|
*/
|
|
142
|
-
after(result, capabilities, specs) {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
}
|
|
150
|
-
});
|
|
123
|
+
async after(result, capabilities, specs) {
|
|
124
|
+
try {
|
|
125
|
+
(0, after_1.default)(result, capabilities, specs);
|
|
126
|
+
}
|
|
127
|
+
catch (e) {
|
|
128
|
+
util.console.error(`after hook failed: ${e}`);
|
|
129
|
+
}
|
|
151
130
|
}
|
|
152
131
|
/**
|
|
153
132
|
* Gets executed after all workers have shut down and the process is about to exit.
|
|
@@ -157,15 +136,13 @@ module.exports = class CustomWorkerService {
|
|
|
157
136
|
* @param {Array.<Object>} capabilities list of capabilities details
|
|
158
137
|
* @param {<Object>} results object containing test results
|
|
159
138
|
*/
|
|
160
|
-
onComplete(exitCode, config, capabilities, results) {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
});
|
|
139
|
+
async onComplete(exitCode, config, capabilities, results) {
|
|
140
|
+
try {
|
|
141
|
+
await (0, onComplete_1.default)(exitCode, config, capabilities, results);
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
util.console.error(`onComplete hook failed: ${e}`);
|
|
145
|
+
}
|
|
169
146
|
}
|
|
170
147
|
};
|
|
171
148
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,YAAY,CAAC
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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