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 2024-10-10 13:30:23 -07:00 committed by Veiko Aasa
parent 56791df57e
commit fc86f3e507
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

View File

@ -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'])