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

test: Add Browser.have_test_api() #21349

Merged
merged 3 commits into from
Nov 29, 2024

Conversation

martinpitt
Copy link
Member

@martinpitt martinpitt commented Nov 28, 2024

Check if the browser is running and has cockpit loaded, i.e. our various
ph_*() test-functions.js are actually available and thus we can call
Browser.is_visible() and friends. That may not be the case when
Cockpit hasn't been opened yet and thus the browser is still showing a
blank page, or has e.g. Grafana opened.

This is what Browser.assert_no_oops() actually needs to check, as on
non-Cockpit pages this doesn't make sense.

This will also help cockpit-machines to replace its incorrect usage of
the just removed Browser.valid flag with something useful.


This will help with cleaning up the very messy testAddDiskNFS failures here and here. I sent a corresponding cockpit-machines PR which uses this: cockpit-project/cockpit-machines#1929

This is redundant state: the webdriver can already tell us whether it is
still running. This flag wasn't meant to be public API, no external
project uses it except cockpit-machines -- and that uses it wrongly.
Check if the browser is running and has cockpit loaded, i.e. our various
ph_*() test-functions.js are actually available and thus we can call
`Browser.is_visible()` and friends. That may not be the case when
Cockpit hasn't been opened yet and thus the browser is still showing a
blank page, or has e.g. Grafana opened.

This is what `Browser.assert_no_oops()` actually needs to check, as on
non-Cockpit pages this doesn't make sense.

This will also help cockpit-machines to replace its incorrect usage of
the just removed `Browser.valid` flag with something useful.
martinpitt added a commit to martinpitt/cockpit-machines that referenced this pull request Nov 28, 2024
Some tests like `testAddDiskNFS` fail during setup [1], so the test
teardown runs while the browser still shows a blank page.

Use the new `Browser.have_test_api()` from
cockpit-project/cockpit#21349 instead of merely
checking if the browser is running to clean that up.

[1] cockpit-project/bots#7137
@martinpitt martinpitt requested a review from jelly November 28, 2024 13:15
@jelly jelly merged commit b453940 into cockpit-project:main Nov 29, 2024
83 of 85 checks passed
@martinpitt martinpitt deleted the browser-validity branch November 29, 2024 13:27
martinpitt added a commit to martinpitt/cockpit-machines that referenced this pull request Nov 29, 2024
Some tests like `testAddDiskNFS` fail during setup [1], so the test
teardown runs while the browser still shows a blank page.

Use the new `Browser.have_test_api()` from
cockpit-project/cockpit#21349 instead of merely
checking if the browser is running to clean that up.

[1] cockpit-project/bots#7137
jelly pushed a commit to cockpit-project/cockpit-machines that referenced this pull request Nov 29, 2024
Some tests like `testAddDiskNFS` fail during setup [1], so the test
teardown runs while the browser still shows a blank page.

Use the new `Browser.have_test_api()` from
cockpit-project/cockpit#21349 instead of merely
checking if the browser is running to clean that up.

[1] cockpit-project/bots#7137
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.

2 participants