Skip to content

Add data-test-id to the LearnDash video picker - #2396

Merged
KMchaudhary merged 1 commit into
developfrom
fix/learndash-data-test-id
Nov 19, 2026
Merged

KMchaudhary merged 1 commit into
developfrom
fix/learndash-data-test-id

Conversation

@KMchaudhary

@KMchaudhary KMchaudhary commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Adds data-test-id hooks to the LearnDash Video Progression picker UI from #2376, which shipped without any, so automated UI tests have stable targets. Attributes only — every element keeps its class/id, so nothing that already selected these nodes changes. Follows the plugin's godam-<area>-<element> convention.

Surface data-test-id
"Use GoDAM Video" switch godam-learndash-use-godam-switch
Picker container / input / preview / title godam-learndash-video-{picker,input,preview,title}
Preview <video> godam-learndash-video-preview-player
Select/Replace, Remove godam-learndash-video-{select,remove}

The switch and preview player are rendered by LearnDash and in JS respectively, so their attributes are set in admin.js; the rest are in the picker markup (class-learndash.php).

Scope note

Trimmed to the LearnDash picker only. The transcode-failure test-ids this PR also carried were the same work as #2393, already merged into develop, so that commit was dropped to avoid duplication.

Tests

learndash/admin.test.js (14) and LearnDashIntegrationTest (51) pass, with new assertions for the switch, preview player and picker hooks; phpcs and ESLint clean.

🤖 Generated with Claude Code

@github-actions

Copy link
Copy Markdown

🔍 WordPress Plugin Check Report

⚠️ Status: Passed with warnings

📊 Report

🎯 Total Issues ❌ Errors ⚠️ Warnings
15 0 15

⚠️ Warnings (15)

📁 readme.txt (2 warnings)
📍 Line 🔖 Check 💬 Message
0 mismatched_plugin_name Plugin name "GoDAM - Video Hosting for LMS & Online Courses" is different from the name declared in plugin header "GoDAM".
0 readme_parser_warnings_trimmed_section_description The "Description" section is too long and was truncated. A maximum of 2500 characters is supported.
📁 inc/classes/class-media-library-ajax.php (1 warning)
📍 Line 🔖 Check 💬 Message
1643 WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound Hook names invoked by a theme/plugin should start with the theme/plugin prefix. Found: "max_srcset_image_width".
📁 assets/build/pages/video-editor.min.js (1 warning)
📍 Line 🔖 Check 💬 Message
2 react_removed_api This file calls "ReactDOM.findDOMNode", which was removed in React 19 and stops working once WordPress upgrades React. Use a ref on the element instead.
📁 assets/build/css/main.css (1 warning)
📍 Line 🔖 Check 💬 Message
0 EnqueuedStylesScope This style is being loaded in all contexts.
📁 assets/src/libs/analytics.min.js (5 warnings)
📍 Line 🔖 Check 💬 Message
0 EnqueuedScriptsScope This script is being loaded in all frontend contexts.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880 (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/2026/11/19/hello-world/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/sample-page/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/demo-attachment-post/ (with handle analytics-library) is loaded in the footer. Consider a defer or async script loading strategy instead.
📁 assets/build/js/main.min.js (5 warnings)
📍 Line 🔖 Check 💬 Message
0 EnqueuedScriptsScope This script is being loaded in all frontend contexts.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880 (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/2026/11/19/hello-world/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/sample-page/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.
0 NonBlockingScripts.NoStrategy This script on http://localhost:8880/demo-attachment-post/ (with handle rtgodam-script) is loaded in the footer. Consider a defer or async script loading strategy instead.

🤖 Generated by WordPress Plugin Check Action • Learn more about Plugin Check

The LearnDash Video Progression surfaces from #2376 shipped with no
data-test-id, so automated UI tests had nothing stable to target. Add
hooks following the plugin's godam-<area>-<element> convention to the
"Use GoDAM Video" switch, the video picker (container, hidden input,
preview wrapper, preview player, title) and the Select/Replace and
Remove buttons.

The switch and preview player are rendered by LearnDash and in JS
respectively, so their attributes are set in admin.js; the rest are in
the picker markup. The additions are placed to keep the existing PHP
assertions intact, with the __remove assertion updated and picker/JS
assertions added.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@KMchaudhary
KMchaudhary force-pushed the fix/learndash-data-test-id branch from 141c031 to 8c606d6 Compare November 19, 2026 10:56
@KMchaudhary KMchaudhary changed the title Add data-test-id to the new 2.11.0 UI surfaces Add data-test-id to the LearnDash video picker Nov 19, 2026
@KMchaudhary
KMchaudhary merged commit 72428a3 into develop Nov 19, 2026
5 checks passed
@KMchaudhary
KMchaudhary deleted the fix/learndash-data-test-id branch November 19, 2026 10:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants