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: Rewrite TestGrafanaClient without relying on Promise #21019

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

martinpitt
Copy link
Member

Latest Grafana started to use zone.js [1], which completely replaces the
global Promise class with a custom implementation. This doesn't
serialize well through WebDriver, and completely breaks the
awaitPromise mode of script evaluation. In other words, this breaks
all our Browser.wait*() methods.

So rewrite the Grafana part of TestGrafanaClient to use Python-level
polling, and use the old JS-layer mouse click emulation (as the HTML
Element result from ph_find_scroll_into_view() also isn't accessible).

See cockpit-project/bots#6838

[1] https://github.com/angular/zone.js


Plus a few small fixes.

bugs.fd.o has been dead/read-only for many years. Move the bug reference
link to GitHub.

Fixes cockpit-project#20792
Stop assuming that `object` members are defined scalar values. Instead,
recursively unpack them, to take account their type. E.g. `type: undefined`
does not even have a `value` entry, causing a `KeyError`.
Latest Grafana started to use zone.js [1], which completely replaces the
global `Promise` class with a custom implementation. This doesn't
serialize well through WebDriver, and completely breaks the
`awaitPromise` mode of script evaluation. In other words, this breaks
all our `Browser.wait*()` methods.

So rewrite the Grafana part of `TestGrafanaClient` to use Python-level
polling, and use the old JS-layer mouse click emulation (as the HTML
Element result from `ph_find_scroll_into_view()` also isn't accessible).

See cockpit-project/bots#6838

[1] https://github.com/angular/zone.js
@martinpitt
Copy link
Member Author

I developed this against the updated services image and that passes now. It should be fine against the current main image as well (I locally verified TestGrafanaClient against it)

Copy link
Member

@jelly jelly left a comment

Choose a reason for hiding this comment

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

Thanks, assuming it goes green

@martinpitt martinpitt merged commit 74f3569 into cockpit-project:main Sep 18, 2024
82 checks passed
@martinpitt martinpitt deleted the fix-services branch September 18, 2024 13:29
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