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

docu: update locators #148

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

tsaleksandrova
Copy link
Contributor

No description provided.

This content will be moved to a popover which is open by pressing a toggle button in the toolbar.
A toggle button will be shown only when there is overflowing content. This is a problem for tests because they should only try to press the button when it's visible and interactable. One way to solve this is to always start the application under test with with a fixed screen size. Another way is to first look for any toggle button - with no restriction on visibility, and then press on it only if it exists:
```javascript
var button = element(by.control({
Copy link
Contributor

Choose a reason for hiding this comment

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

have you tested this (why not add а test) ? IMHO this won't work because we have an implicit visible: true selector and so button will be null in case the toggle button is not displayed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tested

}
}));

button.getCssValue("visibility").then(function (visibility) {
Copy link
Contributor

Choose a reason for hiding this comment

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

checking for visibility аттрубте is very tricky, depending on a catch block is a code smell, let's find a better way. Something like finding all elements that match a selector and evaluating the condition if exactly one was found.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

we want to click on the element if it's found, and do nothing otherwise, so we don't need a catch block. an assertion here would be nice for debugging but not required

Copy link
Contributor

Choose a reason for hiding this comment

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

I delved a little bit in the docs of Protractor and it seems the correct way that does not involve catch block is isPresent().

}
}));

hiddenToggleButton.isPresent().then(function (isPresent) {
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO:

  1. try with isDisplayed,isEnabled
  2. try with executeScript and jq inside the browser => export as some helper on browser object

@CLAassistant
Copy link

CLAassistant commented Aug 5, 2020

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants