Skip to content

Add playground e2e tests#17065

Closed
ellatrix wants to merge 3 commits intomasterfrom
try/playground-e2e
Closed

Add playground e2e tests#17065
ellatrix wants to merge 3 commits intomasterfrom
try/playground-e2e

Conversation

@ellatrix
Copy link
Copy Markdown
Member

Description

WIP

How has this been tested?

Screenshots

Types of changes

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.

return;
}

return window._getContent();
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not sure how this should best be done. Alternatively we expose everything though window.wp as well, or we create a text field with the value.

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.

I feel we shouldn't try to touch the e2e-test-utils or at least we should have specific WordPress utils, Playground utils and potentially Common utils too. These can still live in this utils package but it definitely need more organization. Right now it's just something where we put everything without thinking of organizing it properly especially because most of these utils have "context" in which they can be used in or not.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I agree. This was a temporary thing. I'm not sure what's the best way to check content for the playground right now as well.

@ellatrix ellatrix added the [Type] Automated Testing Testing infrastructure changes impacting the execution of end-to-end (E2E) and/or unit tests. label Aug 16, 2019
} );
} );

bundler.serve();
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.

Is this separate script needed? I wonder if we could be able to do something like npm run playground:start && npm run test:e2e-playground or something like that.

The reason being to decouple the environment from running the tests.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I tried and failed. See parcel-bundler/parcel#1131 (comment). This seems to be the only way to run something after parcel is done building and is serving.


afterAll( () => {
removePageEvents();
} );
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.

There are probably things we can factorize between our two bootstraps. Maybe the console logging catch could be a utility in the utils package for instance...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Maybe :) I was even thinking about removing it...


// Viewing posts on the front end can result in this error, which
// has nothing to do with Gutenberg.
if ( text.includes( 'net::ERR_UNKNOWN_URL_SCHEME' ) ) {
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We should remove all the irrelevant stuff here.


<!-- wp:paragraph -->
<p></p>
<p>Foo</p>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Needs to be investigated. Accidentally overwrote this file.

@ellatrix
Copy link
Copy Markdown
Member Author

Moving the tests revealed some errors with reusable blocks fetching. Also history doesn't work there yet. Perhaps the latter can be fixed as part of this PR.

@youknowriad
Copy link
Copy Markdown
Contributor

This PR might help with the reusable blocks #14367

@gziolo
Copy link
Copy Markdown
Member

gziolo commented Aug 26, 2019

I'm late to the party but I think that using the playground for testing the block editor is a brilliant idea 🚀

I didn't think enough about it but I anticipate that it should fall under both the component and integration testing layers which is awesome if you think about it. We still have to keep e2e tests which have to work with WordPress instance so there should be some overlap which can help to catch some issues related to WordPress core. We can always move some tests back to e2e tests group if we figure out it's not enough to use playground only.

The question is whether all those tests which use the playground, shouldn't be moved to test/integraation folder or extracted to another package maybe? I don't know to be honest, it also seems like we wouldn't have to maintain this reset script for those types of tests as all those tests won't use the persistence layer at all.

@ellatrix ellatrix added the [Status] In Progress Tracking issues with work in progress label Oct 8, 2019
@ellatrix
Copy link
Copy Markdown
Member Author

Closing this for now as it's outdated and I'm not planning to work on it for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Status] In Progress Tracking issues with work in progress [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.

3 participants