Skip to content

Conversation

@xurizaemon
Copy link
Contributor

@xurizaemon xurizaemon commented Jul 5, 2021

Drupal 8 Media performs AJAX after a file is selected in the media upload widget, and we should wait for that to complete.

Summary by CodeRabbit

  • Chores
    • Strengthened the automated test framework's handling of JavaScript operations. The testing system now better recognizes and waits for asynchronous operations to complete before proceeding to the next step. This enhancement reduces timing-related test failures, improves test accuracy and reliability, and ensures consistent results during automated test execution.

✏️ Tip: You can customize this high-level summary in your review settings.

@xurizaemon
Copy link
Contributor Author

xurizaemon commented Jul 5, 2021

💚 test results here for xurizaemon@188259c

@AlexSkrypnyk
Copy link
Collaborator

@xurizaemon could you please re-base this against main. thank you

…kContext::attachFileToField()

Drupal 8 Media performs AJAX after a file is selected in the media
upload widget, and we should wait for that to complete.

- https://github.com/Behat/MinkExtension/blob/80f7849ba53867181b7e412df9210e12fba50177/src/Behat/MinkExtension/Context/MinkContext.php#L200-L219
@coderabbitai
Copy link

coderabbitai bot commented Jan 13, 2026

📝 Walkthrough

Walkthrough

The change adds "attach" as a trigger word for AJAX waiting behavior in JavaScript-enabled Mink context steps, extending the existing trigger set of follow, press, click, and submit.

Changes

Cohort / File(s) Summary
AJAX trigger word expansion
src/Drupal/DrupalExtension/Context/MinkContext.php
Added "attach" to the trigger word list in both before and after JavaScript step handlers, enabling automatic AJAX completion waiting when steps contain this term

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A whisker of change, so small and so neat,
One word added twice, the logic's complete,
When "attach" is pressed, the AJAX will wait,
A tiny adjustment that makes tests first-rate! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding AJAX wait functionality to the attachFileToField() method in MinkContext, which matches the PR's core objective.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5b61482 and 33a9de4.

📒 Files selected for processing (1)
  • src/Drupal/DrupalExtension/Context/MinkContext.php
🔇 Additional comments (2)
src/Drupal/DrupalExtension/Context/MinkContext.php (2)

105-108: LGTM! The addition of "attach" to the AJAX wait triggers is correct.

The word boundary \b prevents false positives from partial matches, and this appropriately handles Drupal Media's AJAX behavior after file selection.


122-125: Consistent with the beforeJavascriptStep change.

Both hooks now correctly wait for AJAX on attach operations.


Comment @coderabbitai help to get the list of available commands and usage tips.

@xurizaemon
Copy link
Contributor Author

@AlexSkrypnyk done 😄

@AlexSkrypnyk AlexSkrypnyk merged commit fe9f729 into jhedstrom:main Jan 13, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants