Skip to content

Commit e34e24d

Browse files
authored
add I close current tab step (#86)
* add I close current tab step * add current node engine to unit test matrix
1 parent 99a74d0 commit e34e24d

File tree

5 files changed

+31
-6
lines changed

5 files changed

+31
-6
lines changed

.github/workflows/pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
test:
1010
strategy:
1111
matrix:
12-
version: [ 18, 20 ]
12+
version: [ 18, 20, 21 ]
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v3

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how
88
:beetle: - bugfix
99
:x: - deprecation
1010

11+
## [0.38.0]
12+
- :rocket: added _I close current tab_ step
13+
1114
## [0.37.0]
1215
- :rocket: added _I wait until {string} css property of {string} {playwrightValueWait} {string}( ){playwrightTimeout}_ step
1316
- :rocket: added experimental electron support

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/actions.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,21 @@ When('I open new tab', async function () {
357357
await page.evaluate(() => { window.open('about:blank', '_blank') });
358358
});
359359

360+
/**
361+
* Close current tab
362+
* @example
363+
* Then I close current tab
364+
*/
365+
When('I close current tab', async function () {
366+
await page.close()
367+
global.page = context.pages()[0]
368+
if (global.page) {
369+
//@ts-ignore
370+
po.driver = page;
371+
await page.bringToFront();
372+
}
373+
});
374+
360375
/**
361376
* Click certain coordinates in element
362377
* @param {string} coords - x, y coordinates to click

test-e2e/features/actions.feature

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ Feature: actions
105105
When I expect 'Frame Element' to be visible
106106

107107
Examples:
108-
| test | param |
109-
| index | 2 |
110-
| title | 'Frame' |
111-
| url | 'frame.html' |
108+
| test | param |
109+
| index | 2 |
110+
| title | 'Frame' |
111+
| url | 'frame.html' |
112112

113113
Scenario: refresh page
114114
When I type 'test value' to 'Input'
@@ -192,6 +192,13 @@ Feature: actions
192192
And I type 'I am not a robot' to alert
193193
Then I expect text of 'Action' to be equal 'I am not a robot'
194194

195+
Scenario: close current browser tab
196+
When I expect current url to contain 'actions.html'
197+
And I open new tab
198+
And I switch to 2 window
199+
And I close current tab
200+
Then I expect current url to contain 'actions.html'
201+
195202
Scenario: expect text of alert
196203
When I click "Prompt Button"
197204
Then I expect text of alert to be equal 'Are you robot?'

0 commit comments

Comments
 (0)