Skip to content

Commit

Permalink
Merge pull request #53 from revjet-qa/feature/open-close-tabs
Browse files Browse the repository at this point in the history
"I close current tab" and "I open new window" steps added
  • Loading branch information
robomanus authored Mar 9, 2018
2 parents 764413c + 6767b67 commit 8ee55cb
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/steps/when.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,19 @@ module.exports = function () {
browser.pause(time);
});

When(_r('I close current tab$'), () => {
/**
* Close current tab
*/
browser.close();
});

When(_r('I open new window$'), () => {
/**
* Open default 'about:blank' tab
*/
browser.newWindow('about:blank');
});

});
};
11 changes: 11 additions & 0 deletions test/demo-app/new-page.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>NEW PAGE FOR THE WDIO-STEPS</title>
<link rel="stylesheet" href="styles/style.css">
</head>
<body>
<div id="new-header">New page header</div>
<div id="new-page">New page</div>
</body>
</html>
2 changes: 2 additions & 0 deletions test/features/page_objects/main.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
let e = {};

e.txtHeader = '//*[@id="header"]';
e.txtNewHeader = '//*[@id="new-header"]';
e.divTimeout = '//*[@id="div_timeout"]';
e.div = '//div';

module.exports = e;
22 changes: 22 additions & 0 deletions test/features/window.tab.manipulation.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@Fast
@Window
@Tab

Feature: Window/tab
In order to check window/tab manipulation
As a developer
I want to open/close window/tab and check that it works properly

Scenario: Open new window step should open new empty tab
Given I open "http://localhost:9000/new-page.html"
Then txtNewHeader from main page should be present
When I open new window
Then div from main page should not be present
And I close current tab

Scenario: Close current step should close recently opened tab
Given I open "http://localhost:9000"
When I open new window
When I close current tab
Then txtHeader from main page should be present

0 comments on commit 8ee55cb

Please # to comment.