Skip to content
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
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
:beetle: - bugfix
:x: - deprecation

## [Unreleased]
## [0.42.0]
- :rocket: added _I tap {string}_ step
```gherkin
When I tap 'Button'
```
- :beetle: added present timeout for value waits

## [0.41.5]
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@qavajs/steps-playwright",
"version": "0.41.5",
"version": "0.42.0",
"description": "steps to interact with playwright",
"main": "./index.js",
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,3 +426,13 @@ When('I click {playwrightBrowserButton} button', async function (button: 'back'
if (button === 'back') return page.goBack();
if (button === 'forward') return page.goForward();
});

/**
* Tap element
* @param {string} alias - element to tap
* @example I tap 'Google Button'
*/
When('I tap {string}', async function (alias: string) {
const element = await getElement(alias);
await element.tap();
});
6 changes: 6 additions & 0 deletions test-e2e/apps/actions.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<body style="height: 1000px">
<span id="action">Nothing</span>
<button id="button">Click Me!</button>
<button id="buttonTap">Tap Me!</button>
<button id="buttonHover">Hover Me!</button>
<label for="input"></label><input type="text" id="input"/>
<input type="file" id="fileInput"/>
Expand Down Expand Up @@ -59,6 +60,7 @@
<script>
const action = document.querySelector('#action');
const button = document.querySelector('#button');
const buttonTap = document.querySelector('#buttonTap');
const buttonHover = document.querySelector('#buttonHover');
const input = document.querySelector('#input');
const fileInput = document.querySelector('#fileInput');
Expand All @@ -78,6 +80,10 @@
action.innerText = 'click';
});

buttonTap.addEventListener('touchend', function () {
action.innerText = 'tap';
});

button.addEventListener('dblclick', function () {
action.innerText = 'dblclick';
});
Expand Down
4 changes: 4 additions & 0 deletions test-e2e/features/actions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,7 @@ Feature: actions
Then I expect current url to contain 'actions.html'
When I click forward button
Then I expect current url to contain 'values.html'

Scenario: tap
When I tap 'Button Tap'
Then I expect text of 'Action' to be equal 'tap'
1 change: 1 addition & 0 deletions test-e2e/page_object/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default class App {
PromptButton = $('#prompt');
Body = $('body');
Button = $('#button');
ButtonTap = $('#buttonTap');
ButtonHover = $('#buttonHover');
Input = $('#input');
Select = $('#select');
Expand Down
6 changes: 1 addition & 5 deletions test-e2e/step-definitions/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { Then } from '@cucumber/cucumber';
import memory from '@qavajs/memory';
import { Browser, BrowserContext, Page } from 'playwright';
import { Page } from 'playwright';
import { expect } from 'chai';

declare global {
var browser: Browser;
var driver: Browser;
var context: BrowserContext;
var page: Page;
var config: any;
}

Then('I expect {string} memory value to be equal {string}', async function(actual, expected) {
Expand Down
6 changes: 4 additions & 2 deletions test-e2e/webui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ const common = {
page: 5000
},
capabilities: {
browserName: 'chromium'
browserName: 'chromium',
hasTouch: true
},
trace: {
event: ['onFail'],
Expand Down Expand Up @@ -57,7 +58,8 @@ export const debug = {
},
capabilities: {
browserName: 'chromium',
headless: false
headless: false,
hasTouch: true
},
trace: {
event: ['onFail'],
Expand Down
6 changes: 5 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true
"skipLibCheck": true,
"types": [
"./global.d.ts",
"node"
]
}
}