Skip to content

added visual testing module and minor fixes #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/Steps/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ Save file content to memory as pdf object with following properties:

| property | type | description |
|:--------------:|:------:|:---------------------------------:|
| textMultiline | string | text of pdf in multiline format |
| textMultiLine | string | text of pdf in multiline format |
| textSingleLine | string | text of pdf in single-line format |
| metadata | Object | pdf metadata |

Expand All @@ -156,5 +156,5 @@ example:
When I save './folder/file.pdf' pdf file content as 'pdfContent'
When I save '$filePath' pdf file content as 'pdfContent'
# if you use @qavajs/memory package
Then I expect '$pdfContent.textMultiline' to be equal 'expectedPdfContent'
Then I expect '$pdfContent.textMultiLine' to be equal 'expectedPdfContent'
```
63 changes: 63 additions & 0 deletions docs/Steps/visual-testing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---
sidebar_position: 10
---

# @qavajs/steps-visual-testing
Step library to perform visual testing

## Installation

`npm install @qavajs/steps-visual-testing`

## Config
```javascript
module.exports = {
default: {
require: [
'@qavajs/steps-visual-testing'
],
}
}
```

## Steps

---
### I expect {string} screenshot to equal {string}

Compare two screenshots from memory (saved as base64)

| param | type | description |
|:--------:|:------:|:----------------------------:|
| actual | string | alias of actual screenshot |
| expected | string | alias of expected screenshot |

example:
```gherkin
Then I expect '$actual' screenshot to equal '$expected'
```
---

### I expect {string} screenshot to equal {string}: [DataTable]

Compare two screenshots from memory (saved as base64) with provided compare parameters

| param | type | description |
|:--------:|:---------:|:----------------------------:|
| actual | string | alias of actual screenshot |
| expected | string | alias of expected screenshot |
| params | DataTable | table of key-value params |

Supported params:

| param | type | description |
|:-----------:|:------:|:-------------------------------------------------------------------------------------------:|
| threshold | number | Matching threshold, ranges from 0 to 1. Smaller values make the comparison more sensitive |

example:
```gherkin
Then I expect '$actual' screenshot to equal '$expected':
| threshold | 0.5 |
```
---

15 changes: 15 additions & 0 deletions docs/Steps/wdio.md
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,21 @@ example:
When I save screenshot as 'screenshot'
```

---
### I save screenshot of {string} as {string}

Save element screenshot into memory

| param | type | description |
|:-----:|:------:|:-------------------------:|
| key | string | key to store value |
| alias | string | element to get screenshot |

example:
```gherkin
When I save screenshot of 'Element' as 'screenshot'
```

---
### I save {string} css property of {string} as {string}

Expand Down
3 changes: 3 additions & 0 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,6 @@ Config file extends Cucumber [config file](https://github.com/cucumber/cucumber-
| `defaultTimeout` | `number` | default timeout for step definitions | 10000 |
| `services` | `[]` | list of services to run before/after tests (setup/teardown selenium, appium etc.) | [] |
| `memory` | `object` | instance of memory object with loaded constants and computed | {} |

### VSCode Extension
https://github.com/qavajs/vscode/releases
2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const darkCodeTheme = require('prism-react-renderer/themes/dracula');
/** @type {import('@docusaurus/types').Config} */
const config = {
title: '@qavajs',
tagline: 'All-in-one test automation framework',
tagline: 'Test Automation Framework',
url: 'https://qavajs.github.io',
baseUrl: '/',
onBrokenLinks: 'throw',
Expand Down