wordpress: tests: functional: Fix tests on Trixie

- In versions of WordPress in Debian Trixie and up the editing widget is inside
of an iframe instead of as a direct child of the main document. Elements inside
these iframes can't be queried directly and one must be the 'context' of the
iframe before querying elements inside.

- Fix the failures by using the splinter API to query inside iframe.

Tests:

- Run functional tests on WordPress in stable and testing containers twice.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa authored and Veiko Aasa committed 2024-10-11 12:40:54 +03:00
1 parent 56791df57e
commit fc86f3e507
1 file changed
+5 -1
@@ -143,7 +143,11 @@ def _write_post(browser, title):
if browser.find_by_id('post-title-0'):
browser.find_by_id('post-title-0').fill(title)
else:
browser.find_by_css('.editor-post-title').first.type(title)
if browser.find_by_css('.editor-visual-editor.is-iframed'):
with browser.get_iframe('editor-canvas') as iframe:
iframe.find_by_css('.editor-post-title').first.type(title)
else:
browser.find_by_css('.editor-post-title').first.type(title)
browser.find_by_css('.editor-post-publish-button__button')[0].click()
functional.eventually(browser.find_by_css, ['.editor-post-publish-button'])