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

Fix openDocumentSettingsPanel and tests #43

Merged
merged 6 commits into from
Apr 1, 2022
Merged

Fix openDocumentSettingsPanel and tests #43

merged 6 commits into from
Apr 1, 2022

Conversation

cadic
Copy link
Contributor

@cadic cadic commented Mar 31, 2022

Description of the Change

This PR fixes multiple issues with openDocumentSettingsPanel and openDocumentSettingsSidebar commands:

  • Close welcome guide action failed in older WordPress versions, fixed in Close Welcome Guide #42
  • In WordPress prior to 5.4 the Document settings tab is called "Document", in later core versions it is renamed to the current post type name (Post, Page, etc.)
  • In WordPress prior to 5.4 panel names were called with capitalized style. Starting from 5.4 panel names are called with Upper-case-first style.

Closes #36

Tested against every WordPress core major release from the minimum 5.2 to the latest nightly build.

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

@cadic cadic requested a review from iamdharmesh March 31, 2022 10:54
@cadic cadic self-assigned this Mar 31, 2022

const panelButtonSelector = `.components-panel__body .components-panel__body-title button:contains("${ucWordsName}"),.components-panel__body .components-panel__body-title button:contains("${ucFirstName}")`;

cy.get(panelButtonSelector).then($button => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Some tabs (Tags, Categories, etc.) does not exist after the DOM is ready. They are added a few moments later after REST calls. In this case, using cy.get('button').contains(name) doesn't work: cy.get() is called before the tabs appear in DOM, finds other panels, but fails to filter any containing the name.

Using new panelButtonSelector with button:contains("tab name") to wait for the elements to appear in DOM.

Copy link
Member

@iamdharmesh iamdharmesh left a comment

Choose a reason for hiding this comment

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

@cadic Thanks for fixing this.
LGTM!! 👍

@iamdharmesh iamdharmesh merged commit ad814eb into trunk Apr 1, 2022
@iamdharmesh iamdharmesh deleted the fix/36 branch April 1, 2022 12:27
github-actions bot pushed a commit that referenced this pull request Apr 1, 2022
Fix openDocumentSettingsPanel and tests
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.

openDocumentSettingsPanel & openDocumentSettingsSidebar tests are failing in WP minimum env.
2 participants