Skip to content

Commit 5de4924

Browse files
Versioning (#94)
* moved to pure versioning
1 parent b72a1cd commit 5de4924

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+2387
-58
lines changed

docusaurus.config.js

+7
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ const config = {
4040
/** @type {import('@docusaurus/preset-classic').Options} */
4141
({
4242
docs: {
43+
lastVersion: '2x',
44+
includeCurrentVersion: false,
4345
sidebarPath: require.resolve('./sidebars.js'),
4446
// Please change this to your repo.
4547
// Remove this to remove the "edit this page" links.
@@ -77,6 +79,11 @@ const config = {
7779
position: 'right',
7880
className: 'header-github-link',
7981
'aria-label': 'GitHub repository'
82+
},
83+
{
84+
type: 'docsVersionDropdown',
85+
position: 'left',
86+
dropdownActiveClassDisabled: true,
8087
}
8188
],
8289
},
File renamed without changes.

docs/Guides/page-object-v1.mdx renamed to versioned_docs/version-1x/Guides/page-object.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar_position: 2
55
import Tabs from '@theme/Tabs';
66
import TabItem from '@theme/TabItem';
77

8-
# Page Object v1
8+
# Page Object
99
Framework provides capability to call getElement method from po object that resolves plain-english selector and return element or array of elements.
1010
<Tabs>
1111
<TabItem value="js" label="JavaScript" default>

docs/Guides/vscode.md renamed to versioned_docs/version-1x/Guides/vscode.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,19 @@ This extension contributes the following settings:
5050
## How To Use
5151

5252
### Test Explorer
53-
![](../../static/img/test_explorer.png)
53+
![](../../../static/img/test_explorer.png)
5454

5555
### Page Object Explorer
5656
Click the copy icon to copy qavajs path
57-
![](../../static/img/po_explorer.png)
57+
![](../../../static/img/po_explorer.png)
5858

5959
### Page Object Autocomplete
6060
Type ?
61-
![](../../static/img/po_autocomplete.png)
61+
![](../../../static/img/po_autocomplete.png)
6262

6363
### Constants Autocomplete
6464
Type $
65-
![](../../static/img/memory_autocomplete.png)
65+
![](../../../static/img/memory_autocomplete.png)
6666

6767
## Known Issues and Limitation
6868

docs/Guides/webstorm.md renamed to versioned_docs/version-1x/Guides/webstorm.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ First, install webstorm-adapter package
1010
Then create new run configuration template and repoint cucumberjs package to @qavajs/webstorm-adapter.
1111
Optionally, set additional qavajs arguments (like config, profile, etc)
1212

13-
![img.png](../../static/img/webstorm.png)
13+
![img.png](../../../static/img/webstorm.png)
1414

1515
In case you are using typescript to run, you need to change nodejs executable to ts-node installation

docs/Steps-v1/_category_.json renamed to versioned_docs/version-1x/Steps/_category_.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"label": "Steps v1",
2+
"label": "Steps",
33
"position": 30,
44
"link": {
55
"type": "generated-index",

docs/Steps-v1/accessibility-v1.md renamed to versioned_docs/version-1x/Steps/accessibility.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 7
33
---
44

5-
# @qavajs/steps-accessibility v1
5+
# @qavajs/steps-accessibility
66
Steps to perform accessibility checks using axe library.
77
Library can work on top of playwright and webdriverio drivers
88

File renamed without changes.

docs/Steps-v1/files-v1.md renamed to versioned_docs/version-1x/Steps/files.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 5
33
---
44

5-
# @qavajs/steps-files v1
5+
# @qavajs/steps-files
66
Step library to work with file system
77

88
## Installation

docs/Steps-v1/gmail-v1.md renamed to versioned_docs/version-1x/Steps/gmail.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 8
33
---
44

5-
# @qavajs/steps-gmail v1
5+
# @qavajs/steps-gmail
66
Step library to test emails via gmail client
77

88
## Installation

docs/Steps-v1/lighthouse-v1.md renamed to versioned_docs/version-1x/Steps/lighthouse.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 8
33
---
44

5-
# @qavajs/steps-lighthouse v1
5+
# @qavajs/steps-lighthouse
66
Steps to perform lighthouse audit.
77
Library can work on top of playwright and webdriverio drivers
88

docs/Steps-v1/memory-v1.md renamed to versioned_docs/version-1x/Steps/memory.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
sidebar_position: 4
33
---
44

5-
# @qavajs/steps-memory v1
6-
Steps to work with memory module
5+
# @qavajs/steps-memory
6+
Steps to work with memory module and test data
77
## Installation
88
```
99
npm install @qavajs/steps-memory@1

docs/Steps-v1/playwright-v1.md renamed to versioned_docs/version-1x/Steps/playwright.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
sidebar_position: 1
33
---
44

5-
# @qavajs/steps-playwright v1
6-
Step library to work with playwright using DSL page object
7-
8-
It is docs for qavajs v2. If you are looking docs for v1 go to [(v2 docs)](../Steps/playwright-v2.md)
5+
# @qavajs/steps-playwright
96

107
## Installation
118
```
@@ -17,7 +14,7 @@ Playwright steps provide a couple of additional configuration properties
1714
| Name | Type | Description | Default |
1815
|--------------|----------|---------------------------------------------------------------------------------|---------|
1916
| `browser` | `object` | object describing playwright config | `{}` |
20-
| `pageObject` | `object` | instance of page object definitions [(page object)](../Guides/page-object-v1.mdx) | `{}` |
17+
| `pageObject` | `object` | instance of page object definitions [(page object)](../../../docs/Guides/page-object-v1.mdx) | `{}` |
2118

2219
```javascript
2320
const App = require('./page_object');

docs/Steps-v1/sql-v1.md renamed to versioned_docs/version-1x/Steps/sql.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 6
33
---
44

5-
# @qavajs/steps-sql v1
5+
# @qavajs/steps-sql
66
Step library to work with relational databases
77

88
## Installation

docs/Steps-v1/visual-testing-v1.md renamed to versioned_docs/version-1x/Steps/visual-testing.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 10
33
---
44

5-
# @qavajs/steps-visual-testing v1
5+
# @qavajs/steps-visual-testing
66
Step library to perform visual testing using pixelmatch library
77

88
## Installation

docs/Steps-v1/wdio-v1.md renamed to versioned_docs/version-1x/Steps/wdio.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
sidebar_position: 2
33
---
44

5-
# @qavajs/steps-wdio v1
5+
# @qavajs/steps-wdio
66
Step library to work with webdriverio using DSL page object
77
## Installation
88
```
@@ -14,7 +14,7 @@ wdio steps provide additional configuration properties
1414
| Name | Type | Description | Default |
1515
|--------------|----------|---------------------------------------------------------------------------------|---------|
1616
| `browser` | `object` | object describing wdio config | `{}` |
17-
| `pageObject` | `object` | instance of page object definitions [(page object)](../Guides/page-object-v1.mdx) | `{}` |
17+
| `pageObject` | `object` | instance of page object definitions [(page object)](../../../docs/Guides/page-object-v1.mdx) | `{}` |
1818

1919
```javascript
2020
const App = require('./page_object');

versioned_docs/version-1x/intro.md

+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
# Getting Started
6+
7+
The **qavajs** is a modular test automation framework designed to minimize setup time and streamline the development of test scripts. It incorporates the best test automation tools and practices into a single whole. The framework achieves efficiency through its built-in page object engine and ready-to-use sets of domain-agnostic step definitions suitable for both API and UI testing of the web and native mobile applications. Additionally, **qavajs** provides out of the box integration with ReportPortal, Mobitru, and the Xray and many more.
8+
9+
Next, you will be shown how to build your own low-code test automation framework with the **qavajs**.
10+
11+
### 📦 Installation from scratch
12+
Once you have set up a clear Node.js project, run the command
13+
```bash
14+
npm init @qavajs
15+
```
16+
to launch the CLI application. This will configure qavajs and install the necessary modules for your testing purposes. After the process is completed, a config.ts (or config.js) file will be generated in the project's root directory, which will be used to configure test execution.
17+
18+
### 👨‍💻 Test development
19+
As the **qavajs** based on the Cucumber the test scripts are written in [Gherkin](https://cucumber.io/docs/gherkin/reference/) language of both built-in steps and those you will create yourself.
20+
With years of experience across various domains, we have implemented [numerous packages](https://github.com/orgs/qavajs/repositories?q=steps&type=all) of step definitions that you can utilize.
21+
```gherkin
22+
Feature: Wikipedia
23+
24+
@wikipedia
25+
Scenario Outline: Search in wikipedia (<term>)
26+
Given I open '$wikipediaUrl' url
27+
When I type '<term>' to 'Wikipedia > Search Input'
28+
And I click 'Wikipedia > Search Button'
29+
And I expect text of 'Wikipedia Article > Title' equals '<term>'
30+
And I expect text of 'Wikipedia Article > Title' not to contain 'Python'
31+
And I expect 'Wikipedia Article > Title' to be visible
32+
And I expect 'Wikipedia Article > Title' to be visible
33+
34+
Examples:
35+
| term |
36+
| JavaScript |
37+
| Java |
38+
```
39+
It is worth mentioning the expression **'$wikipediaUrl'** in the example above starting with '**\$**' interpreted as a **qavajs** memory variable whose value is taken from the Memory class instance in runtime. [More details](https://qavajs.github.io/docs/Guides/memory).
40+
Another feature is a locator alias expression like **'Wikipedia > Search Input'** separated by the '**\>**' sign that describes hierarchic page structure. See how [to organize your page object](https://qavajs.github.io/docs/Guides/page-object-v2).
41+
42+
### 🛠️ Configuration
43+
In addition to the default features of Cucumber [config file](https://github.com/cucumber/cucumber-js/blob/main/docs/configuration.md#options) the **qavajs** config implements following [capabilities](https://github.com/qavajs/core/blob/main/src/IQavajsConfig.ts) to provide the advanced flexibility.
44+
45+
### 🔬 Test execution
46+
If you have the basic config `npx qavajs` will launch test execution.
47+
To specify custom path to the config file use `npx qavajs run --config <config>`.
48+
In case if your config exports an object with multiple properties, you can specify which property to read `npx qavajs run --profile <profile>`.
49+
50+
### 🛠️ Override memory values
51+
In case if tests need to be run with updated memory value they can be passed via CLI (e.g run scenarios on some other url)
52+
It can be done by passing `--memory-values` parameter which is JSON with params that need to be overridden.
53+
For instance, to override `$url` value:
54+
55+
```bash
56+
npx qavajs run --config config.ts --memory-values '{"url": "https://github.com"}'
57+
```
58+
59+
### 🛠️ Pass CLI params to workers
60+
All params that you passed to qavajs cli will be available in `CLI_ARGV` environment variable in all child workers.
61+
62+
### 🛠️ Test Sharding
63+
qavajs provides ability to shard your tests between different machines. To do so pass `--shard x/y` parameter in CLI,
64+
where x - current shard, y - total number of shards.
65+
66+
```
67+
npx qavajs run --config config.js --shard 1/2
68+
npx qavajs run --config config.js --shard 2/2
69+
```
70+
71+
### 🛠️ Execute steps from other steps
72+
It is possible to implement complex logic using built-in qavajs steps via `executeStep` world method
73+
```typescript
74+
When('I do smth complex', async function() {
75+
await this.executeStep(`I type 'username' to 'Username Input'`);
76+
await this.executeStep(`I type 'password' to 'Password Input'`);
77+
await this.executeStep(`I click 'Login Button'`);
78+
await this.executeStep(`I fill following fields`, new DataTable([
79+
[ 'Order', '123' ],
80+
[ 'Delivery Location', 'New York' ]
81+
]))
82+
});
83+
```
84+
85+
### 🛠️ Override step definition
86+
`Override` function provides capability to override step implementation and avoid ambiguous exception
87+
88+
```typescript
89+
import { Override } from '@qavajs/core';
90+
91+
When('I do test', async function () {});
92+
93+
Override('I do test', async function () {
94+
console.log('I am overridden');
95+
});
96+
```
97+
98+
99+
```gherkin
100+
Feature: feature with fixture
101+
102+
@pdp
103+
Scenario: scenario with fixture
104+
When I click 'qavajs T-shirt'
105+
And I click 'cart icon'
106+
Then I expect 'qavajs T-shirt cart item' to be visible
107+
```
108+
109+
### 🛠️ Service
110+
Services is an entities that can execute logic before and after whole test run.
111+
112+
```typescript
113+
import externalService from './externalService';
114+
115+
export default {
116+
service: [
117+
{
118+
options: {
119+
data: 42
120+
},
121+
before() {
122+
console.log(this.options.data);
123+
},
124+
after(result) {
125+
if (!result.success) process.exitCode = 1;
126+
}
127+
},
128+
{
129+
options: {
130+
data: 42
131+
},
132+
...externalService
133+
}
134+
]
135+
}
136+
```
137+
There is a one minute-long default timeout for a before and after test logic to prevent entire process from freezing.
138+
To set up a custom timeout in milliseconds use serviceTimeout property in the config file
139+
```typescript
140+
export default {
141+
serviceTimeout: 1_200_000
142+
}
143+
```
144+
145+
### 📘 Extra
146+
[Code Examples](https://github.com/qavajs/demo)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Formatters",
3+
"position": 50,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Built-in formatters"
7+
}
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
# @qavajs/console-formatter
6+
7+
Console formatter for cucumber framework
8+
9+
## Installation
10+
```
11+
npm install @qavajs/console-formatter
12+
```
13+
14+
## Configuration
15+
To use formatter just add formatter section in config file
16+
17+
```javascript
18+
module.exports = {
19+
default: {
20+
format: ['@qavajs/console-formatter'],
21+
formatOptions: {
22+
console: {
23+
showLogs: true, //show cucumber logs. Default - false
24+
showProgress: true //show progress bar. Default - false
25+
}
26+
},
27+
}
28+
}
29+
```
30+
31+
or pass `--format @qavajs/console-formatter in cli`
32+
33+
![](https://raw.githubusercontent.com/qavajs/console-formatter/master/assets/report_example.png)

0 commit comments

Comments
 (0)