Skip to content

test(settings): match error toasts by role instead of text - #67745

Open
susnux wants to merge 1 commit into
masterfrom
fix/playwright-ai-settings-toast
Open

susnux wants to merge 1 commit into
masterfrom
fix/playwright-ai-settings-toast

Conversation

@susnux

@susnux susnux commented Dec 6, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Three settings e2e tests check error toasts with page.getByText(...). Since @nextcloud/dialogs 8, the toast container also copies each message into a hidden aria-live region for screen readers. The copy is written 50 ms after the toast appears and cleared after 7 s, so getByText sometimes matches both elements and fails with a strict-mode violation, e.g. on #65150:

strict mode violation: getByText('Could not save the AI settings') resolved to 2 elements:
  1) <div aria-atomic="true" aria-live="assertive" class="hidden-visually">Error: Could not save the AI settings</div>
  2) <span class="_toastMessage_iqed9_53">Could not save the AI settings</span>

These tests now use the existing getToast() helper. It matches only the toast itself (role="alert"/"status"), like the other specs already do.

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@susnux susnux added this to the Nextcloud 36 milestone Dec 6, 2026
@susnux susnux added 2. developing Work in progress tests Related to tests labels Dec 6, 2026
@susnux
susnux marked this pull request as ready for review December 6, 2026 00:41
@susnux
susnux requested a review from a team as a code owner December 6, 2026 00:41
@susnux
susnux requested review from kristian-zendato, payal8797 and skjnldsv and removed request for a team December 6, 2026 00:41
@susnux susnux added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Dec 6, 2026
@nextcloud/dialogs 8 also writes every toast message into a hidden
aria-live region for screen readers, shortly after the toast appears and
only for a few seconds. A plain getByText() then randomly hits both
elements and fails in strict mode, so match the toast itself.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@susnux
susnux force-pushed the fix/playwright-ai-settings-toast branch from 3ed0a3e to 333c09e Compare December 6, 2026 14:29
@github-actions

github-actions Bot commented Dec 6, 2026

Copy link
Copy Markdown
Contributor

Possible performance regression detected

Show Output
7 queries added

= /remote.php/dav/files/test
= /remote.php/dav/files/test/test.txt
= /remote.php/dav/files/test/many_files
= /remote.php/dav/files/test/new_file.txt
≠ /remote.php/dav/files/test/new_file.txt with 7 queries added
  - UPDATE "oc_filecache" SET "size" = :dcValue4 WHERE ("fileid" = :dcValue1) AND ("storage" = :dcValue2) AND (("size" <> :dcValue3) OR ("size" IS NULL))
  - UPDATE "oc_filecache" SET "size" = :dcValue4 WHERE ("fileid" = :dcValue1) AND ("storage" = :dcValue2) AND (("size" <> :dcValue3) OR ("size" IS NULL))
  - SELECT "path" FROM "oc_filecache" WHERE ("storage" = :dcValue1) AND ("fileid" = :dcValue2)
  - SELECT "path" FROM "oc_filecache" WHERE ("storage" = :dcValue1) AND ("fileid" = :dcValue2)
  + SELECT "storage", "path", "mimetype" FROM "oc_filecache" WHERE "fileid" = :dcValue1
  + SELECT "storage_id", "root_id", "user_id", "mount_point", "mount_id", "f"."path", "mount_provider_class" FROM "oc_mounts" "m" INNER JOIN "oc_filecache" "f" ON "m"."root_id" = "f"."fileid" WHERE ("m"."storage_id" = :dcValue1) AND ("f"."storage" = :dcValue2) AND (("f"."fileid" = :dcValue3) OR ("f"."path" = '') OR (("f"."path" || :dcValue4) = SUBSTR(:dcValue5, :dcValue6, LENGTH("f"."path") + :dcValue7))) AND ("user_id" = :dcValue8)
  + SELECT "filecache"."fileid", "storage", "path", "path_hash", "filecache"."parent", "filecache"."name", "mimetype", "mimepart", "size", "mtime", "storage_mtime", "encrypted", "filecache"."etag", "filecache"."permissions", "checksum", "unencrypted_size", "metadata_etag", "creation_time", "upload_time", "meta"."json" AS "meta_json", "meta"."sync_token" AS "meta_sync_token" FROM "oc_filecache" "filecache" LEFT JOIN "oc_filecache_extended" "fe" ON "filecache"."fileid" = "fe"."fileid" LEFT JOIN "oc_files_metadata" "meta" ON "filecache"."fileid" = "meta"."file_id" WHERE ("filecache"."fileid" = :dcValue1) AND ("storage" = :dcValue2)
  + DELETE FROM "oc_filecache" WHERE ("storage" = :dcValue1) AND ("fileid" = :dcValue2)
  + DELETE FROM "oc_filecache_extended" WHERE "fileid" = :dcValue1
  + SELECT "file_id", "json", "sync_token" FROM "oc_files_metadata" WHERE "file_id" IN (:dcValue1)
  + DELETE FROM "oc_files_metadata" WHERE "file_id" IN (:dcValue1)
  + DELETE FROM "oc_files_metadata_index" WHERE "file_id" IN (:dcValue1)
  + SELECT "fileid" FROM "oc_filecache" WHERE ("storage" = :dcValue1) AND ("path_hash" = :dcValue2)
  + UPDATE "oc_file_locks" SET "lock" = :dcValue1, "ttl" = :dcValue2 WHERE ("key" = :dcValue3) AND ("lock" = :dcValue4)
  + SELECT "filecache"."fileid", "storage", "path", "path_hash", "filecache"."parent", "filecache"."name", "mimetype", "mimepart", "size", "mtime", "storage_mtime", "encrypted", "filecache"."etag", "filecache"."permissions", "checksum", "unencrypted_size", "metadata_etag", "creation_time", "upload_time", "meta"."json" AS "meta_json", "meta"."sync_token" AS "meta_sync_token" FROM "oc_filecache" "filecache" LEFT JOIN "oc_filecache_extended" "fe" ON "filecache"."fileid" = "fe"."fileid" LEFT JOIN "oc_files_metadata" "meta" ON "filecache"."fileid" = "meta"."file_id" WHERE ("path_hash" = :dcValue1) AND ("storage" = :dcValue2)
= ./occ profiler:list

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews AI assisted tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants