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

Testing: Add e2e test for PluginPostStatusInfo #7284

Merged
merged 5 commits into from
Jun 25, 2018
Merged

Conversation

gziolo
Copy link
Member

@gziolo gziolo commented Jun 12, 2018

Description

Builds upon #7269.

This PR improves basic end-to-end tests for the PluginSidebar and PluginSidebarMoreMenuItem registration. In addition, it adds another test for PluginPostStatusInfo.

It would be great to replace this snapshot for PluginSidebar with something which tests also data sync between the page title and its copy in the sidebar, but I keep it for later to make sure we have also the publish flow covered.

Update: I also included the script with code that registers publish panels: PluginPrePublishPanel and PluginPostPublishPanel. We still need to add some basics tests to make sure it works as expected. I can be in another PR.

How has this been tested?

npm run test-e2e and Travis verification should be green.

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@gziolo gziolo added [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. [Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Plugins API Extending the Gutenberg project with plugins via the Plugins API labels Jun 12, 2018
@gziolo gziolo added this to the 3.1 milestone Jun 12, 2018
@gziolo gziolo self-assigned this Jun 12, 2018
@gziolo gziolo changed the title Update/plugins api e2e Testing: Add e2e test for PluginPostStatusInfo Jun 12, 2018
@gziolo gziolo force-pushed the update/plugins-api-e2e branch from df4b062 to 62a3123 Compare June 12, 2018 14:43
@gziolo gziolo requested a review from a team June 12, 2018 14:45
@gziolo gziolo modified the milestones: 3.1, 3.2 Jun 21, 2018
@gziolo gziolo force-pushed the update/plugins-api-e2e branch from 62a3123 to d6b7f0c Compare June 25, 2018 09:15
/**
* Clicks on the button in the header which opens Document Settings sidebar when it is closed.
*/
export async function ensureDocumentSettingsSidebarIsOpened() {
Copy link
Member

Choose a reason for hiding this comment

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

Not certain if this is the best name for the function, because if Publish panel is open, the button is not rendered and the function will not be able to ensure "document settings sidebar is opened".
An option is call the function click toggle sidebar or something similar but off course that name will bot transmit the main objective of clicking in the sidebar.

Copy link
Member Author

Choose a reason for hiding this comment

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

Would openDocumentSettingsSidebar work for you?

Copy link
Member

Choose a reason for hiding this comment

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

Yes openDocumentSettingsSidebar looks good, as it is not strong as "ensure".


const pluginSidebarContent = await page.$eval( '.edit-post-sidebar', ( el ) => el.innerHTML );
expect( pluginSidebarContent ).toMatchSnapshot();
const pluginPostStatusInfoText = await page.$eval( '.my-post-status-info-plugin', ( el ) => el.innerText );
Copy link
Member

Choose a reason for hiding this comment

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

I think we should improve the selector to `.edit-post-post-status .my-post-status-info-plugin' to test that it was rendered "inside" right now if we render outside of Document Setting sidebar the test will pass.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good catch

Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

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

I left some comments, but generally, this changes look good to me 👍 Thank you for adding this additional test cases!

@gziolo gziolo force-pushed the update/plugins-api-e2e branch from d6b7f0c to 55fd7d0 Compare June 25, 2018 15:40
@gziolo gziolo force-pushed the update/plugins-api-e2e branch from 55fd7d0 to 238c1c7 Compare June 25, 2018 16:27
@gziolo gziolo merged commit e7961cb into master Jun 25, 2018
@gziolo gziolo deleted the update/plugins-api-e2e branch June 25, 2018 16:43
oxyc added a commit to generoi/gutenberg that referenced this pull request Jun 26, 2018
* 'master' of https://github.com/WordPress/gutenberg: (69 commits)
  fix: Show permalink editor in editor (WordPress#7494)
  Fix text wrapping in Firefox. (WordPress#7472)
  Try another approach to fixing the sibling inserter in Firefox (WordPress#7530)
  fix: Improve "add block" text in NUX onboarding (WordPress#7511)
  Implement core style of including revisions data on Post response (WordPress#7495)
  Testing: Add e2e test for PluginPostStatusInfo (WordPress#7284)
  Add end 2 end test for sidebar behaviours on mobile and desktop. (WordPress#6877)
  Only save metaboxes when it's not an autosave (WordPress#7502)
  Fix broken links in documentation (WordPress#7532)
  Remove post type 'viewable' compatibility shim (WordPress#7496)
  Fix typo. (WordPress#7528)
  Blocks: Remove wrapping div from paragraph block (WordPress#7477)
  fix: change import for InnerBlocks (WordPress#7484)
  Polish library just a teeeeensy bit (WordPress#7522)
  feat: Add snapshot update script (WordPress#7514)
  Display server error message when one exists (WordPress#7434)
  Fix issues with gallery in IE11. (WordPress#7465)
  Polish region focus style (WordPress#7459)
  Fix IE11 formatting toolbar visibility (WordPress#7413)
  Update plugin version to 3.1. (WordPress#7402)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Extensibility The ability to extend blocks or the editing experience [Feature] Plugins API Extending the Gutenberg project with plugins via the Plugins API [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants