Adjust test for changed display language modal

f1542d54db rewrote
the language selector dialog. Update the tests to also work with
cockpit ≥ 233.

Do the version comparison dynamically for the time being, as this breaks
several image refreshes. We can drop this again and only use the new
code once all of these landed.
This commit is contained in:
Martin Pitt 2020-12-30 17:12:43 +01:00 committed by Martin Pitt
parent 3dbd37a8c3
commit 670f528781

View file

@ -36,8 +36,14 @@ class TestApplication(testlib.MachineCase):
b.click("#navbar-dropdown") b.click("#navbar-dropdown")
b.click(".display-language-menu a") b.click(".display-language-menu a")
b.wait_popup('display-language') b.wait_popup('display-language')
b.set_val("#display-language select", "de-de") # the dialog changed in cockpit 233
b.click("#display-language-select-button") cockpit_version = float(m.execute("cockpit-bridge --version | sed -n '/Version:/ s/^.*: //p'").strip())
if cockpit_version >= 233:
b.set_val("#display-language-modal select", "de-de")
b.click("#display-language-modal button.pf-m-primary")
else:
b.set_val("#display-language select", "de-de")
b.click("#display-language-select-button")
b.expect_load() b.expect_load()
# HACK: work around language switching in Chrome not working in current session (Cockpit issue #8160) # HACK: work around language switching in Chrome not working in current session (Cockpit issue #8160)
b.reload(ignore_cache=True) b.reload(ignore_cache=True)
@ -50,5 +56,6 @@ class TestApplication(testlib.MachineCase):
# page label (from js) should be translated # page label (from js) should be translated
b.wait_in_text(".pf-c-alert__title", "Läuft auf") b.wait_in_text(".pf-c-alert__title", "Läuft auf")
if __name__ == '__main__': if __name__ == '__main__':
testlib.test_main() testlib.test_main()