From fc86f3e5079cd437bb3364e4e2eba36292a7fe15 Mon Sep 17 00:00:00 2001 From: Sunil Mohan Adapa Date: Thu, 10 Oct 2024 13:30:23 -0700 Subject: [PATCH] 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 Reviewed-by: Veiko Aasa --- plinth/modules/wordpress/tests/test_functional.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plinth/modules/wordpress/tests/test_functional.py b/plinth/modules/wordpress/tests/test_functional.py index 0042ae427..040e7337a 100644 --- a/plinth/modules/wordpress/tests/test_functional.py +++ b/plinth/modules/wordpress/tests/test_functional.py @@ -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'])