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

Update e2e tests to reflect that drafts are now part of post status #90288

Merged

Conversation

olaseni
Copy link
Contributor

@olaseni olaseni commented May 3, 2024

Fixes: #90290
Related: WordPress/gutenberg#60456

The UI for unpublishing a post has changed such that you now have to interact with the post status panel pop out. Also, the Update CTA text has changed to save

This is currently breaking some nightly e2e tests for Gutenberg. This change modifies the e2e's expectations to fit the new realities.

Testing instructions

Running e2e tests for Calypso

Run the page basic flow e2e edge tests for Simple and AT sites, which were failing before this fix:

cd test/e2e
yarn jest --clearCache && yarn build 
GUTENBERG_EDGE=1 yarn jest specs/editor/editor__post-advanced-flow.ts
GUTENBERG_EDGE=1 TEST_ON_ATOMIC=true yarn jest specs/editor/editor__post-advanced-flow.ts

@olaseni olaseni self-assigned this May 3, 2024
@olaseni olaseni requested a review from ntsekouras May 3, 2024 17:27
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 3, 2024
@matticbot
Copy link
Contributor

This PR does not affect the size of JS and CSS bundles shipped to the user's browser.

Generated by performance advisor bot at iscalypsofastyet.com.

@olaseni olaseni force-pushed the fix/update-e2e-where-drafts-are-now-part-of-post-status branch from 9157e12 to 43f81b9 Compare May 3, 2024 19:46
@olaseni olaseni requested review from a team and stephanethomas and removed request for a team May 4, 2024 11:19
@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug fix/update-e2e-where-drafts-are-now-part-of-post-status on your sandbox.

Copy link
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

Changes make sense and work as expected 👍

I left one comment that would be good to resolve before landing, though

Comment on lines +776 to +777
this.editorToolbarComponent.clickPublish(),
editorParent.getByRole( 'button' ).getByText( 'OK' ).click(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need both these calls? They seem to accomplish the same thing 🤔

The test also seems to complete successfully (on Simple and on Atomic) with only one of these lines.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually the edge versions on simple and AT are the same and you won't notice a difference there. There are both running 18.2.0.

For versions before i.e. 18.1.2, which is what ordinary sites ( non-edge sites ) are using.

You can test this with:

yarn jest specs/editor/editor__post-advanced-flow.ts

... without the GUTENBERG_EDGE=1 or TEST_ON_ATOMIC=true. Apologies for not leaving this in the description.

The UI for that version is different. That OK button is only present there.

Screenshot 2024-05-06 at 10 48 09

Without using Promise.race() with those two lines, you'll get this error:


  ● Editor: Advanced Post Flow › Revert post to draft › Switch to draft

    locator.click: Timeout 10000ms exceeded.
    =========================== logs ===========================
    waiting for frameLocator('iframe[src*="calypsoify"]').locator('body.block-editor-page').locator('.interface-navigable-region[class*="header"] button.editor-post-publish-button__button[aria-disabled="false"]')
    ============================================================

      276 | 		const editorParent = await this.editor.parent();
      277 | 		const publishButtonLocator = editorParent.locator( selectors.publishButton( 'enabled' ) );
    > 278 | 		await publishButtonLocator.click();
          | 		                           ^
      279 | 	}
      280 |
      281 | 	/**

      at EditorToolbarComponent.click [as clickPublish] (../../packages/calypso-e2e/src/lib/components/editor-toolbar-component.ts:278:30)
      at EditorPage.unpublish (../../packages/calypso-e2e/src/lib/pages/editor-page.ts:775:3)
      at Object.<anonymous> (specs/editor/editor__post-advanced-flow.ts:155:4)


Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha! I think I simply forgot to build after making my changes to the tests, or they wouldn't have passed 🤦‍♂️

Copy link
Contributor

@fredrikekelund fredrikekelund left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Comment on lines +776 to +777
this.editorToolbarComponent.clickPublish(),
editorParent.getByRole( 'button' ).getByText( 'OK' ).click(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha! I think I simply forgot to build after making my changes to the tests, or they wouldn't have passed 🤦‍♂️

@olaseni olaseni merged commit 61173aa into trunk May 6, 2024
12 checks passed
@olaseni olaseni deleted the fix/update-e2e-where-drafts-are-now-part-of-post-status branch May 6, 2024 10:28
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label May 6, 2024
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.

Gutenberg: Update e2e tests to reflect that drafts are now part of post status
3 participants