-
-
Notifications
You must be signed in to change notification settings - Fork 88
[plugin-web-app] Use tab
instead of window
in steps syntax
#3857
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
[plugin-web-app] Use tab
instead of window
in steps syntax
#3857
Conversation
@@ -129,6 +129,8 @@ public void switchingToFrame(Locator locator) | |||
* reference</i></a> | |||
*/ | |||
@When("I switch to a new window") | |||
// @When("I switch to a new tab") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// @When("I switch to a new tab") | |
// @When("I switch to new tab") |
@@ -164,6 +169,7 @@ public void closeCurrentWindowWithAlertsHandling() | |||
}); | |||
} | |||
|
|||
//TODO: rename? tryToCloseCurrentTab(BiConsumer<WebDriver, String> closeExecutor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, rename please
String switchToWindowWithMatchingTitle(Matcher<String> matcher); | ||
|
||
/** | ||
* Switches to a previous window | ||
*/ | ||
// rename? switchToPreviousTab(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, rename all methods
@@ -31,6 +31,8 @@ | |||
import org.vividus.selenium.IWebDriverProvider; | |||
import org.vividus.selenium.manager.IWebDriverManager; | |||
|
|||
// update according changes in IWindowsActions + update messages in methods | |||
// private methods renaming? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, full renaming
@@ -51,6 +51,7 @@ public void afterNavigateTo(String url, WebDriver driver) | |||
resetPerformanceMetrics(); | |||
} | |||
|
|||
// Should update to tab? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that's possible, it's an implementation of Selenium interface
d243342
to
6c8f1c8
Compare
if (descriptiveSoftAssert.assertThat(String.format("New window '%s' is found", newWindow), | ||
"New window is found", newWindow, not(equalTo(currentWindow)))) | ||
{ | ||
resetContext(); | ||
} | ||
} | ||
|
||
/** | ||
* Switch the focus of future browser commands to the new <b>window object</b>. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's avoid window
in javadocs and docs
9e14380
to
1bb7371
Compare
Codecov Report
@@ Coverage Diff @@
## master #3857 +/- ##
============================================
- Coverage 97.18% 97.15% -0.03%
+ Complexity 6432 6268 -164
============================================
Files 897 871 -26
Lines 18516 17990 -526
Branches 1216 1172 -44
============================================
- Hits 17995 17479 -516
+ Misses 412 404 -8
+ Partials 109 107 -2
... and 82 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
1bb7371
to
c3f7c0c
Compare
@@ -177,23 +177,29 @@ When I close browser | |||
|
|||
=== Wait for window and switch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update to tab
438c3c9
to
3fe992f
Compare
if (descriptiveSoftAssert.assertThat(String.format(NEW_TAB_FOUND_FORMAT, newTab), | ||
newTab, not(equalTo(currentTab)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does assertion message look like?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
New tab '{770e3411-5e19-4831-8f36-fc76e46a2807}' is found
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
quite informative :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does iit make sense to put tab title as part of this msg?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as a result of descussion -> just remove tab id from the message
|
||
This step is used to open the provided URL in a new browser tab. | ||
[NOTE] | ||
The newly opened tab will be the active tab, and any subsequent steps will be carried out in this new tab. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The newly opened tab will be the active tab, and any subsequent steps will be carried out in this new tab. | |
The newly opened tab will be the active tab, and any subsequent steps will be executed on this new tab. |
[source,gherkin] | ||
---- | ||
When I switch to a new window | ||
---- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes sense to keep it
vividus-build-system
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redundant changes
} | ||
|
||
private void closeSmallerWindows(Set<String> windows) | ||
// ??? Tabs or windows |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
windows
482015c
to
ff9a97a
Compare
vividus-plugin-web-app/src/main/java/org/vividus/steps/ui/web/PageSteps.java
Show resolved
Hide resolved
vividus-plugin-web-app/src/main/java/org/vividus/steps/ui/web/SetContextSteps.java
Show resolved
Hide resolved
vividus-plugin-web-app/src/main/java/org/vividus/steps/ui/web/SetContextSteps.java
Show resolved
Hide resolved
da91add
to
10adfc6
Compare
871e145
to
516bb68
Compare
@@ -696,6 +733,16 @@ Then text `Modal Frame Example` exists | |||
|
|||
Switch the focus of future browser commands to new tab. | |||
|
|||
This step gets the identifier of the currently active tab and then switches focus to the first available tab with a different identifier. For example, if tabs #1, #2, #3 are open and tab #2 is active, this method will switch focus to tab #3. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This step gets the identifier of the currently active tab and then switches focus to the first available tab with a different identifier. For example, if tabs #1, #2, #3 are open and tab #2 is active, this method will switch focus to tab #3. | |
This step gets the identifier of the currently active tab and then switches focus to the first available tab with a different identifier. For example, if tabs #1, #2, #3 are open and tab #2 is active, this step will switch focus to tab #3. |
|
||
[source,gherkin] | ||
---- | ||
When I open URL `$pageUrl` in new tab |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isn't it documented below?
* <ul> | ||
* <li>Gets identifier of the currently active tab; | ||
* <li>Switches focus to the first available tab with another identifier. So if currently there are 3 opened | ||
* tabs #1, #2, #3 and tab #2 is active one, using this method will switch focus to the tab #3; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* tabs #1, #2, #3 and tab #2 is active one, using this method will switch focus to the tab #3; | |
* tabs #1, #2, #3 and tab #2 is active one, using this step will switch focus to the tab #3; |
{ | ||
String currentTab = getWebDriver().getWindowHandle(); | ||
String newTab = windowsActions.switchToNewTab(currentTab); | ||
if (descriptiveSoftAssert.assertThat("New tab is found", newTab, not(equalTo(currentTab)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
haven't we agreed to simplify this assertion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I understand correctly, we decided just to simplify the assertion message - remove tab id from the message
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes sense to replace assertThat
with recordAssertion
, since matcher not(equalTo(currentTab))
doesn't provide any value for users
@@ -212,7 +264,7 @@ public Boolean apply(WebDriver driver) | |||
public String toString() | |||
{ | |||
//TODO: change to comparisonRule.toString() once it will be safe | |||
return String.format("switch to a window where title %s \"%s\"", comparisonRule.name(), title); | |||
return String.format("switch to the tab where title %s \"%s\"", comparisonRule.name(), title); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good time to switch to comparisonRule.toString()
516bb68
to
3b06421
Compare
3b06421
to
7797299
Compare
{ | ||
String currentTab = getWebDriver().getWindowHandle(); | ||
String newTab = windowsActions.switchToNewTab(currentTab); | ||
if (descriptiveSoftAssert.assertThat("New tab is found", newTab, not(equalTo(currentTab)))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it makes sense to replace assertThat
with recordAssertion
, since matcher not(equalTo(currentTab))
doesn't provide any value for users
softAssert.assertThat("Current window has been closed", driver.getWindowHandles(), | ||
not(contains(currentWindow))); | ||
softAssert.assertThat("Current tab has been closed", driver.getWindowHandles(), | ||
not(contains(currentTab))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see the comment above about using recordAssertion
instead of assertThat
!-- Deprecated: 0.7.0, When I wait `%1$s` until tab with title that %2$s `%3$s` appears and switch to it | ||
When I wait `<duration>` until tab with title that <comparisonRule> `<title>` appears and switch to it | ||
|
||
Composite: When I close the current window | ||
!-- Deprecated: 0.7.0, When I close current tab | ||
When I close current tab | ||
|
||
Composite: When I attempt to close current window with possibility to handle alert | ||
!-- Deprecated: 0.7.0, When I attempt to close current tab with possibility to handle alert |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was changed to upper case: !-- DEPRECATED:
7aa8bfe
to
e554e49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Integration tests are failed
6c0c86b
to
41290cf
Compare
41290cf
to
beb417b
Compare
tab
instead of window
in steps syntax
No description provided.