Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/7349: Add filter to select delayjs script #7350

Merged

Conversation

CrochetFeve0251
Copy link
Contributor

@CrochetFeve0251 CrochetFeve0251 commented Mar 9, 2025

Description

Fixes #7349

Added a filter to handle regression easier by letting the client select his delay js script.

Type of change

  • New feature (non-breaking change which adds functionality).
  • Bug fix (non-breaking change which fixes an issue).
  • Enhancement (non-breaking change which improves an existing functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as before).
  • Sub-task of #(issue number)
  • Chore
  • Release

Detailed scenario

What was tested

Describe the scenarios that you tested, and specify if it is automated or manual. For manual scenarios, provide a screenshot of the results.
I created an integration scenarios for the matching logic.

How to test

Describe how the PR can be tested so that the validator can be autonomous: environment, dependencies, specific setup, steps to perform, API requests, etc.

Execute the tests.

Use the filter rocket_delay_js_version_js_script with a callback to change the version and observe the script being sered.

Technical description

Documentation

Explain how this code works. Diagrams & drawings are welcome.
It just adds a new filter rocket_delay_js_version_js_script to add inside the Notion doc.

New dependencies

List any new dependencies that are required for this change.

Risks

List possible performance & security issues or risks, and explain how they have been mitigated.

Mandatory Checklist

Code validation

  • I validated all the Acceptance Criteria. If possible, provide screenshots or videos.
  • I triggered all changed lines of code at least once without new errors/warnings/notices.
  • I implemented built-in tests to cover the new/changed code.

Code style

  • I wrote a self-explanatory code about what it does.
  • I protected entry points against unexpected inputs.
  • I did not introduce unnecessary complexity.
  • Output messages (errors, notices, logs) are explicit enough for users to understand the issue and are actionnable.

Unticked items justification

If some mandatory items are not relevant, explain why in this section.

Additional Checks

  • In the case of complex code, I wrote comments to explain it.
  • When possible, I prepared ways to observe the implemented system (logs, data, etc.).
  • I added error handling logic when using functions that could throw errors (HTTP/API request, filesystem, etc.)

@CrochetFeve0251 CrochetFeve0251 self-assigned this Mar 9, 2025
@CrochetFeve0251 CrochetFeve0251 requested review from a team March 9, 2025 21:43
Copy link

codacy-production bot commented Mar 9, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 573e2741 100.00% (target: 50.00%)
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (573e274) Report Missing Report Missing Report Missing
Head commit (767940e) 39082 17142 43.86%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#7350) 10 10 100.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

@CrochetFeve0251
Copy link
Contributor Author

Without the filter:
image
With the script in place:
image

@CrochetFeve0251 CrochetFeve0251 added type: enhancement Improvements that slightly enhance existing functionality and are fast to implement module: delay JS labels Mar 9, 2025
@CrochetFeve0251 CrochetFeve0251 requested a review from a team March 9, 2025 22:05
@CrochetFeve0251
Copy link
Contributor Author

@wp-media/qa-team would it be possible for one of you to run the e2e tests on it to look for regressions?

Copy link
Contributor

@mostafa-hisham mostafa-hisham left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good
@wp-media/engineering-plugin-team please have a look too.

@mostafa-hisham mostafa-hisham requested a review from a team March 10, 2025 06:53
@Mai-Saad
Copy link
Contributor

For testing

  • Validate AC
    Given that no hook is registered on the filter, the delayJS current version must be injected.
    Given that a hook changes the filtered version to 1.2.6, the v1.2.6 of the scripts must be injected.
    Given that a hook changed the filtered version to something else than '1.2.6', the current version must be injected.
  • Run NRT https://wpmediaqa.testrail.io/index.php?/runs/view/982

@mostafa-hisham
Copy link
Contributor

mostafa-hisham commented Mar 12, 2025

test video

DJS-switch-.2.mp4

Run NRT https://wpmediaqa.testrail.io/index.php?/runs/view/982

not done yet

@mostafa-hisham
Copy link
Contributor

@MathieuLamiot do we need to do the NRT test for this PR?
the DJS script didn't change so I don't think we need to do it here (it is not about testing v2).

@MathieuLamiot
Copy link
Contributor

Looking at the NRT suggested by the QA team, they are minimal, it makes sens to quickly check them to ensure the script behaves as expected on the main features. (for instance, the elementor exclusions with the dedicated script, etc.)
We should not run a complete NRT plan of DelayJS of course, but I think the few tests in the test plan are reasonnable

@mostafa-hisham
Copy link
Contributor

mostafa-hisham commented Mar 12, 2025

@MathieuLamiot
I did the NRT. (moving to qa done)
@Mai-Saad I uploaded screenshots in the NRT if you want to have a look before moving this forward.

@wordpressfan wordpressfan added this pull request to the merge queue Mar 14, 2025
Merged via the queue into develop with commit fcbcb4f Mar 14, 2025
13 checks passed
@wordpressfan wordpressfan deleted the enhancement/7349-add-filter-to-select-delayjs-script branch March 14, 2025 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: delay JS type: enhancement Improvements that slightly enhance existing functionality and are fast to implement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

As a DelayJS user, I want to rollback to previous DelayJS version to mitigate regressions
5 participants