Skip to content

add-ons page validations#1963

Merged
Crabcyborg merged 6 commits into
masterfrom
issue-5331-validate_add_ons_page
Oct 1, 2024
Merged

add-ons page validations#1963
Crabcyborg merged 6 commits into
masterfrom
issue-5331-validate_add_ons_page

Conversation

@lauramekaj1
Copy link
Copy Markdown
Contributor

No description provided.

@lauramekaj1 lauramekaj1 self-assigned this Sep 3, 2024
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 3, 2024

Walkthrough

A new test file, validateAddOnsPage.cy.js, has been added to the Cypress testing framework. This file contains a suite of end-to-end tests for the "Add-Ons" page in the WordPress admin interface. The tests validate the presence and correctness of UI elements and functionality for add-ons, including searching capabilities and the display of various add-on attributes.

Changes

File Path Change Summary
tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js Introduced a comprehensive suite of end-to-end tests for the "Add-Ons" page, validating UI elements and search functionality for add-ons.

Possibly related PRs

  • Add cypress automated HTML validation #1788: This PR introduces Cypress tests for HTML validation on WordPress admin pages, which is related to the main PR's focus on validating UI elements and functionality on the Add-Ons page using Cypress.
  • Add some more cypress a11y exceptions on admin, add HTML validation t… #1790: This PR adds HTML validation tests in Cypress, similar to the main PR's focus on validating the Add-Ons page, indicating a shared goal of enhancing test coverage for WordPress admin interfaces.
  • form templates functionalities #1985: The form templates functionalities PR includes Cypress tests for validating the functionality of form templates, which aligns with the main PR's objective of validating the Add-Ons page, suggesting a common approach to testing within the WordPress admin environment.

Suggested reviewers

  • shervElmi: Suggested for review due to expertise in Cypress testing and familiarity with the WordPress admin interface.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Crabcyborg
Copy link
Copy Markdown
Contributor

@lauramekaj1 Does this update validate the old add-ons page we're replacing soon?

Or does it work with the new add-ons update as well? The page is changing quite a bit so I'm concerned these tests could immediately break.

The add-ons update is in this PR #1802

Have you run these tests against that branch?

@lauramekaj1
Copy link
Copy Markdown
Contributor Author

@Crabcyborg Yes, it validates the old page only. I tried to run the tests against the new add-ons PR #1802 but the tests fail.

Do you think I should update my tests based on the PR #1802 and as soon as the new add-ons will be released then we can add our tests as well?

@Crabcyborg
Copy link
Copy Markdown
Contributor

Crabcyborg commented Sep 16, 2024

@lauramekaj1 Yeah, I think we could branch off of Sherv's branch and merge it even into his branch ahead of time possibly.

We're likely going to merge his update some time this week. And the release will happen on October 2 if it goes to schedule.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 6bd9827 and 8bce788.

Files selected for processing (1)
  • tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js (1 hunks)

Comment thread tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js
Comment thread tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js
Comment thread tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js Outdated
@lauramekaj1
Copy link
Copy Markdown
Contributor Author

lauramekaj1 commented Sep 24, 2024

Hi @Crabcyborg, I updated it based on the new add-ons. If everything looks ok then we can merge against the new-add-ons branch.

Also, do you think it's better if I create a branch out of the new-add-ons branch and then will push the changes there?

@lauramekaj1
Copy link
Copy Markdown
Contributor Author

lauramekaj1 commented Sep 24, 2024

@Crabcyborg I think the search function is based on the pattern e.g. data-slug="signature". For example, when I try to search for "Digital signatures," no results are shown. However, when I search for just "signature," the search results are displayed.

@Crabcyborg
Copy link
Copy Markdown
Contributor

Thanks @lauramekaj1. I tried to come up with a solution to the plural search issue. I have a new pull request here #2007

Could you help test it? I assigned you for review.

@Crabcyborg
Copy link
Copy Markdown
Contributor

Crabcyborg commented Sep 25, 2024

Also, do you think it's better if I create a branch out of the new-add-ons branch and then will push the changes there?

@lauramekaj1 That's how I would probably do it. If we just merge the add-ons branch into this one and change the base merge branch here in GitHub to the add-ons branch it should be fine. We wouldn't merge this before the other update.

@lauramekaj1 lauramekaj1 changed the base branch from master to new-add-ons September 26, 2024 20:12
@lauramekaj1
Copy link
Copy Markdown
Contributor Author

Also, do you think it's better if I create a branch out of the new-add-ons branch and then will push the changes there?

@lauramekaj1 That's how I would probably do it. If we just merge the add-ons branch into this one and change the base merge branch here in GitHub to the add-ons branch it should be fine. We wouldn't merge this before the other update.

@Crabcyborg I merged new-add-ons branch into this one and also changed the base merge. There are some tests which are failing here. I think it's because that the Cypress check is being run on master!

Base automatically changed from new-add-ons to master October 1, 2024 18:30
Copy link
Copy Markdown
Contributor

@Crabcyborg Crabcyborg left a comment

Choose a reason for hiding this comment

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

@lauramekaj1 I think the only issue was a little mistake with the search checks. It checks for the signatures add-on, but still had the validation for the PayPal check before that.

I made a small commit and it's passing now ce26573

@Crabcyborg Crabcyborg merged commit b8af986 into master Oct 1, 2024
@Crabcyborg Crabcyborg deleted the issue-5331-validate_add_ons_page branch October 1, 2024 18:47
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (1)
tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js (1)

110-111: Avoid Manipulating target Attribute Unless Necessary

Removing the target attribute before clicking may not be needed in this context. If the intention is to keep the navigation within the same browser tab during testing, this is acceptable. Otherwise, consider whether this step is necessary.

If you decide to retain this step, adding a comment to clarify the reason could improve code readability.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 8bce788 and ce26573.

📒 Files selected for processing (1)
  • tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js (1 hunks)
🔇 Additional comments (1)
tests/cypress/e2e/Add-Ons/validateAddOnsPage.cy.js (1)

14-18: Ensure Consistency in Text Assertions

There is an inconsistency in the capitalization of "Pro" and "PRO" between the upgrade banner text and the link text. Verify that this difference is intentional and matches the actual content displayed on the page.

Run the following script to confirm the displayed texts:

Comment on lines +618 to +619
cy.get('#addon-search-input').clear().type("Add an electronic signature to your WordPress form. The visitor may write their signature with a trackpad/mouse or type it.");
cy.get('.plugin-card-signature').should("contain", "Digital Signatures");
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Enhance Search Test with More Realistic Input

Searching using the entire description text may not reflect typical user behavior. Consider modifying the test to search using keywords or partial phrases to better simulate real-world usage and ensure the search functionality handles common scenarios effectively.

Apply this change to use a relevant keyword:

-cy.get('#addon-search-input').clear().type("Add an electronic signature to your WordPress form. The visitor may write their signature with a trackpad/mouse or type it.");
+cy.get('#addon-search-input').clear().type("electronic signature");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cy.get('#addon-search-input').clear().type("Add an electronic signature to your WordPress form. The visitor may write their signature with a trackpad/mouse or type it.");
cy.get('.plugin-card-signature').should("contain", "Digital Signatures");
cy.get('#addon-search-input').clear().type("electronic signature");
cy.get('.plugin-card-signature').should("contain", "Digital Signatures");

Comment on lines +126 to +129
cy.contains('Plan required:').within(() => {
cy.get('a').should('have.attr', 'href', 'https://formidableforms.com/lite-upgrade/?utm_source=WordPress&utm_medium=addons&utm_campaign=liteplugin%20&%20utm_content%20=%20signature')
.and('contain.text', 'Business');
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Validate URL Encoding in href Attributes

The href attribute contains URL-encoded spaces (%20), which may indicate unintended formatting. Ensure that the URLs are correctly encoded and that there are no extraneous spaces or encoding issues that could lead to incorrect links.

Apply this diff to correct the URL:

-                    cy.get('a').should('have.attr', 'href', 'https://formidableforms.com/lite-upgrade/?utm_source=WordPress&utm_medium=addons&utm_campaign=liteplugin%20&%20utm_content%20=%20signature')
+                    cy.get('a').should('have.attr', 'href', 'https://formidableforms.com/lite-upgrade/?utm_source=WordPress&utm_medium=addons&utm_campaign=liteplugin&utm_content=signature')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cy.contains('Plan required:').within(() => {
cy.get('a').should('have.attr', 'href', 'https://formidableforms.com/lite-upgrade/?utm_source=WordPress&utm_medium=addons&utm_campaign=liteplugin%20&%20utm_content%20=%20signature')
.and('contain.text', 'Business');
});
cy.contains('Plan required:').within(() => {
cy.get('a').should('have.attr', 'href', 'https://formidableforms.com/lite-upgrade/?utm_source=WordPress&utm_medium=addons&utm_campaign=liteplugin&utm_content=signature')
.and('contain.text', 'Business');
});

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