Skip to content

Conversation

@aquality-automation
Copy link
Collaborator

No description provided.

d.bogatko added 8 commits August 8, 2019 22:43
changed IElementStateProvider interface: added methods for waitings with default condition timeouts excluded ability to call state methods directly from elements, now users have to use state() method
refactored elements' states added isClickable
…ity-selenium-java # Conflicts: #	src/main/java/aquality/selenium/elements/DesiredState.java #	src/main/java/aquality/selenium/elements/Element.java #	src/main/java/aquality/selenium/elements/ElementFinder.java #	src/main/java/aquality/selenium/elements/ElementStateProvider.java #	src/main/java/aquality/selenium/elements/interfaces/IElement.java #	src/main/java/aquality/selenium/waitings/ConditionalWait.java #	src/test/java/tests/integration/ElementStateTests.java #	src/test/java/tests/usecases/ElementExistNotDisplayedTest.java
conditional wait moved under tests/ because of many places where it is used
conditional wait moved under tests/ because of many places where it is used
Copy link
Contributor

@mialeska mialeska left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please throw exception when failed to select option by contain in ComboBox.
Also don't catch in the TextBox submit method

…g exception if it was failed attempt to select removed catching of WebDriverException in TextBox
@aquality-automation
Copy link
Collaborator Author

@mialeska changed according to your comments

}
return false;
if (!isSelected){
throw new StaleElementReferenceException(String.format(getLocManager().getValue("loc.combobox.impossible.to.select.contain.value.or.text"), value, getName()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this ain't a real staleElementReference, why should we do retry in this case? let's throw unhandled exception, like we do it in dotnet solution

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still actual question

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

replaced

getElement().clear();
getElement().sendKeys(value);
return true;
} catch (WebDriverException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should not catch here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still actual

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

try {
getElement().sendKeys(value);
return true;
} catch (WebDriverException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should not catch here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still actual

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

infoLoc("loc.clicking");
new JsActions(element, type, name).highlightElement();
ConditionalWait.waitFor(driver -> performAction(new Actions(driver).click(element.getElement())));
ElementActionRetrier.doWithRetry(() -> performAction(new Actions(getBrowser().getDriver()).click(element.getElement())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems that it does make sense to make a private method with common logic (please see the dotnet implementation for more details)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still actual

}
return false;
if (!isSelected){
throw new StaleElementReferenceException(String.format(getLocManager().getValue("loc.combobox.impossible.to.select.contain.value.or.text"), value, getName()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still actual question

getLogger().debug(e.getMessage());
return false;
}
ElementActionRetrier.doWithRetry(() -> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't need curly braces here

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

try {
getElement().sendKeys(value);
return true;
} catch (WebDriverException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still actual

getElement().clear();
getElement().sendKeys(value);
return true;
} catch (WebDriverException e) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still actual

@@ -1,4 +1,4 @@
package aquality.selenium.waitings;
package utils;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you mean it?

Copy link
Collaborator Author

@aquality-automation aquality-automation Aug 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, no longer than today morning I thought we had decided to remove ConditionalWait with its end :) But times are changing

I will get back ConditionalWait in separate PR

infoLoc("loc.clicking");
new JsActions(element, type, name).highlightElement();
ConditionalWait.waitFor(driver -> performAction(new Actions(driver).click(element.getElement())));
ElementActionRetrier.doWithRetry(() -> performAction(new Actions(getBrowser().getDriver()).click(element.getElement())));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

still actual

* Click Right (call context menu) on the element
*/
public void rightClick() {
public void clickRight() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it should be named rightClick

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reverted this change

@paveliam paveliam merged commit 0b0aaeb into master Aug 15, 2019
@paveliam paveliam deleted the add-retry branch August 15, 2019 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants