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

Conversation

@gziolo
Member

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 this to the 3.1 milestone Jun 12, 2018

@gziolo gziolo added this to To do in Extensibility via automation Jun 12, 2018

@gziolo gziolo self-assigned this Jun 12, 2018

@gziolo gziolo requested review from youknowriad and jorgefilipecosta Jun 12, 2018

@gziolo gziolo changed the title from Update/plugins api e2e to Testing: Add e2e test for PluginPostStatusInfo Jun 12, 2018

@gziolo gziolo requested a review from WordPress/gutenberg-core Jun 12, 2018

@gziolo gziolo modified the milestones: 3.1, 3.2 Jun 21, 2018

/**
* Clicks on the button in the header which opens Document Settings sidebar when it is closed.
*/
export async function ensureDocumentSettingsSidebarIsOpened() {

This comment has been minimized.

@jorgefilipecosta

jorgefilipecosta Jun 25, 2018

Member

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.

This comment has been minimized.

@gziolo

gziolo Jun 25, 2018

Member

Would openDocumentSettingsSidebar work for you?

This comment has been minimized.

@jorgefilipecosta

jorgefilipecosta Jun 25, 2018

Member

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 );

This comment has been minimized.

@jorgefilipecosta

jorgefilipecosta Jun 25, 2018

Member

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.

This comment has been minimized.

@gziolo

gziolo Jun 25, 2018

Member

Good catch

@jorgefilipecosta

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

@gziolo gziolo merged commit e7961cb into master Jun 25, 2018

2 checks passed

codecov/project 46.76% remains the same compared to e222ccb
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

Extensibility automation moved this from To do to Done Jun 25, 2018

@gziolo gziolo deleted the update/plugins-api-e2e branch Jun 25, 2018

oxyc added a commit to generoi/gutenberg that referenced this pull request Jun 26, 2018

Merge branch 'master' of https://github.com/WordPress/gutenberg
* '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