Skip to content

Commit 381c7c8

Browse files
added _I tap {string}_ step (#101)
1 parent 6494c00 commit 381c7c8

File tree

10 files changed

+39
-12
lines changed

10 files changed

+39
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
88
:beetle: - bugfix
99
:x: - deprecation
1010

11-
## [Unreleased]
11+
## [0.42.0]
12+
- :rocket: added _I tap {string}_ step
13+
```gherkin
14+
When I tap 'Button'
15+
```
1216
- :beetle: added present timeout for value waits
1317

1418
## [0.41.5]

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@qavajs/steps-playwright",
3-
"version": "0.41.5",
3+
"version": "0.42.0",
44
"description": "steps to interact with playwright",
55
"main": "./index.js",
66
"scripts": {

src/actions.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,3 +426,13 @@ When('I click {playwrightBrowserButton} button', async function (button: 'back'
426426
if (button === 'back') return page.goBack();
427427
if (button === 'forward') return page.goForward();
428428
});
429+
430+
/**
431+
* Tap element
432+
* @param {string} alias - element to tap
433+
* @example I tap 'Google Button'
434+
*/
435+
When('I tap {string}', async function (alias: string) {
436+
const element = await getElement(alias);
437+
await element.tap();
438+
});

test-e2e/apps/actions.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<body style="height: 1000px">
88
<span id="action">Nothing</span>
99
<button id="button">Click Me!</button>
10+
<button id="buttonTap">Tap Me!</button>
1011
<button id="buttonHover">Hover Me!</button>
1112
<label for="input"></label><input type="text" id="input"/>
1213
<input type="file" id="fileInput"/>
@@ -59,6 +60,7 @@
5960
<script>
6061
const action = document.querySelector('#action');
6162
const button = document.querySelector('#button');
63+
const buttonTap = document.querySelector('#buttonTap');
6264
const buttonHover = document.querySelector('#buttonHover');
6365
const input = document.querySelector('#input');
6466
const fileInput = document.querySelector('#fileInput');
@@ -78,6 +80,10 @@
7880
action.innerText = 'click';
7981
});
8082

83+
buttonTap.addEventListener('touchend', function () {
84+
action.innerText = 'tap';
85+
});
86+
8187
button.addEventListener('dblclick', function () {
8288
action.innerText = 'dblclick';
8389
});

test-e2e/features/actions.feature

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,3 +228,7 @@ Feature: actions
228228
Then I expect current url to contain 'actions.html'
229229
When I click forward button
230230
Then I expect current url to contain 'values.html'
231+
232+
Scenario: tap
233+
When I tap 'Button Tap'
234+
Then I expect text of 'Action' to be equal 'tap'

test-e2e/page_object/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export default class App {
99
PromptButton = $('#prompt');
1010
Body = $('body');
1111
Button = $('#button');
12+
ButtonTap = $('#buttonTap');
1213
ButtonHover = $('#buttonHover');
1314
Input = $('#input');
1415
Select = $('#select');

test-e2e/step-definitions/index.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import { Then } from '@cucumber/cucumber';
22
import memory from '@qavajs/memory';
3-
import { Browser, BrowserContext, Page } from 'playwright';
3+
import { Page } from 'playwright';
44
import { expect } from 'chai';
55

66
declare global {
7-
var browser: Browser;
8-
var driver: Browser;
9-
var context: BrowserContext;
107
var page: Page;
11-
var config: any;
128
}
139

1410
Then('I expect {string} memory value to be equal {string}', async function(actual, expected) {

test-e2e/webui.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ const common = {
1111
page: 5000
1212
},
1313
capabilities: {
14-
browserName: 'chromium'
14+
browserName: 'chromium',
15+
hasTouch: true
1516
},
1617
trace: {
1718
event: ['onFail'],
@@ -57,7 +58,8 @@ export const debug = {
5758
},
5859
capabilities: {
5960
browserName: 'chromium',
60-
headless: false
61+
headless: false,
62+
hasTouch: true
6163
},
6264
trace: {
6365
event: ['onFail'],

tsconfig.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
"esModuleInterop": true,
1414
"forceConsistentCasingInFileNames": true,
1515
"strict": true,
16-
"skipLibCheck": true
16+
"skipLibCheck": true,
17+
"types": [
18+
"./global.d.ts",
19+
"node"
20+
]
1721
}
1822
}

0 commit comments

Comments
 (0)