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

Refactor collection conditions #2312

Merged
merged 25 commits into from May 28, 2023
Merged

Refactor collection conditions #2312

merged 25 commits into from May 28, 2023

Conversation

asolntsev
Copy link
Member

@asolntsev asolntsev commented May 25, 2023

Introduce new (primary) method in CollectionCondition:

abstract CheckResult check(CollectionSource collection);

This method will be preferred over current method

abstract boolean test(List<WebElement> collection)

because it will allow new features:

  1. Return the actual value at the moment of last check.
  2. Perform last check with the help of JavaScript (e.g. quickly get all texts of a big collection with one JS call)

Also, in this PR I reviewed existing tests of collection conditions, and converted many (quite useless) unit-tests to integration tests. And added more detailed checks for their output.

Now it's the preferred method. Will replace the previous method `test(List<WebElement>)`.
P.S. replaced useless unit-tests by analogous integration test
P.S. replaced useless unit-tests by analogous integration test
P.S. replaced useless unit-tests by analogous integration test
instead of old `fail(..List elements..)`
It will speed up the tests: we will not fetch actual attribute values when generating an error message
@asolntsev asolntsev self-assigned this May 25, 2023
@asolntsev asolntsev added this to the 6.15.0 milestone May 25, 2023
@asolntsev asolntsev force-pushed the refactor-collection-conditions branch from 398dddd to 343f472 Compare May 26, 2023 12:08
@asolntsev asolntsev force-pushed the refactor-collection-conditions branch from 77dc8c8 to b8723b6 Compare May 27, 2023 08:16
replaced useless unit-tests by analogous integration test
replaced useless unit-tests by analogous integration test
replaced useless unit-tests by analogous integration test
replaced useless unit-tests by analogous integration test
replaced useless unit-tests by analogous integration test
@asolntsev asolntsev force-pushed the refactor-collection-conditions branch from b8723b6 to a5e931f Compare May 27, 2023 12:53
replaced useless unit-tests by analogous integration test
@asolntsev asolntsev force-pushed the refactor-collection-conditions branch from 0d0c57a to 0bef8ae Compare May 27, 2023 17:07
replaced useless unit-tests by analogous integration test
replaced useless unit-tests by analogous integration test
In most tests, we don't really need to wait 4 seconds.
There is only a few tests where we do want to test the "waiting".
@asolntsev asolntsev force-pushed the refactor-collection-conditions branch from ec4bbcd to 8cdd60a Compare May 28, 2023 10:06
replaced useless unit-tests by analogous integration test
replaced useless unit-tests by analogous integration test
@sonarcloud
Copy link

sonarcloud bot commented May 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@asolntsev asolntsev merged commit 62722b6 into main May 28, 2023
14 checks passed
@asolntsev asolntsev deleted the refactor-collection-conditions branch May 28, 2023 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant