Skip to content
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

"I close current tab" and "I open new window" steps added #53

Merged
merged 2 commits into from
Mar 9, 2018
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
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