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

Add expected conditions 1827 #1865

Merged
merged 24 commits into from
Apr 14, 2024

Conversation

emanlove
Copy link
Member

Some very early and very basic sketches of what this might become ..

Wanted to just throw out a sample test case, test application (page),
and a working keyword. Interesting this works at a very basic level. See
next paths for a few functionality like

- instead of snake_case create method for using "space case"
- add check for presence of method
- add polling delay, timeout
- ...?
These were some initial sketches for the keywords and their usage. As
they are not working I have moved them out of the test suite.
- Added 100 millisecond polling to wait. Seems like a good default. Will
  need to decide on how to let users set this.
- Copied dynamic_content.html making into seperate
  expected_conditions.html test page.
- Added another sample test case
yuriverweij and others added 8 commits November 15, 2023 12:04
…s_1827

added timeout argument to keyword wait_for_expected_condition
Made a few changes ..
- Catch unknown expoected conditions and reopport an error. This can still be improved
  by adding a here are the known expected conditions as well as a "did you mean ..."
  type message
- Brought in parser so one can use `Element To Be Clickable` instead of
  `element_to_be_clicable`. Admittedly it seems to simple and realized an issue, of case,
  as I type this.
- Added some test cases
Hadn't realized I do force the expected condition ame to all lower case letters. So just needed
to add a test case!
Some of the expected conditions expect a locator which is a tuple
consisting of the By string [1] and the string containing the locator.
I wanted to see what this was like. I am thinking that it would be good
to somehow use the libraries locator strategy.

Needed to also add to the test page so we had a new element after a delay.

[1] https://www.selenium.dev/selenium/docs/api/py/_modules/selenium/webdriver/common/by.html#By
@yuriverweij
Copy link
Member

"Wait For Expected Condition Times out within set timeout" test fails on Firefox only, strange...

Copy link
Member

@yuriverweij yuriverweij left a comment

Choose a reason for hiding this comment

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

Looks good to me. I added a few comments, but I don't think they should be blocking.

Made unit test compatible to both Selenium v4.17.2 and above as well as
v4.16.0 and prior
The delay for the title change was 600 miliseconds while the timeout was
0.5 seconds. I suspect this gives little time for error. The 600
milisecond timeout was specifically choosen along with the other
timeouts in the expected conditions tests such that any combination of
delays would be unique. This gives us a framework to test various
combinations. So I didn't want to change that. Noting I could simply
swap the 600 millisecond test for the 900 millisecond tes .. which might
be the best bet. But for now trying to reduce the timeout to 0.3
seconds.
def _get_preferences_attribute(self, result):
# -- temporary fix to transition selenium to v4.17.2 from v4.16.0 and prior
# from inspect import signature
# sig = signature(result)
Copy link
Member

Choose a reason for hiding this comment

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

These comments can be removed I assume?

@@ -11,7 +11,7 @@ jobs:
matrix:
python-version: [3.8, 3.11] # 3.12, pypy-3.9
rf-version: [5.0.1, 6.1.1, 7.0]
selenium-version: [4.14.0, 4.15.2, 4.16.0] #4.17.0, 4.18.0
selenium-version: [4.14.0, 4.15.2, 4.16.0, 4.17.2, 4.18.1, 4.19.0]
Copy link
Member

Choose a reason for hiding this comment

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

It's becoming quite a long list again.

This may greatly increase the archive file size which we need to simplify our matrix.
But at least we should get some more insights into failing tests.
@emanlove emanlove marked this pull request as ready for review April 14, 2024 23:27
@emanlove emanlove merged commit cafc0b4 into robotframework:master Apr 14, 2024
108 checks passed
@emanlove emanlove deleted the add-expected-conditions-1827 branch September 28, 2024 00:06
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