Skip to content

E2E test cache busting on playground.wordpress.net #855

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

Closed
adamziel opened this issue Dec 10, 2023 · 2 comments
Closed

E2E test cache busting on playground.wordpress.net #855

adamziel opened this issue Dec 10, 2023 · 2 comments
Labels
[Aspect] Browser [Type] Bug An existing feature does not function as intended [Type] Reliability Playground uptime, reliability, not crashing

Comments

@adamziel
Copy link
Collaborator

adamziel commented Dec 10, 2023

Occasionally, people report errors caused by loading outdated versions of Playground assets on playground.wordpress.net. For example, this report:

I ran into an error when I select “Browser” in the storage option:
Fatal error: Uncaught Error: Call to undefined function wp_check_php_mysql_versions() in /wordpress/wp-settings.php:2
One way this could have happened, is if the browser loaded mismatched versions of the WordPress wp.data file and the wp.js file. The wp.js contains a map of where each file starts and ends in wp.data and, given a wrong wp.data input, it would produce the correct directory structure, but each file would have the wrong contents.

Let's solve that.

Done is

  1. We start by building a failing E2E test for the following asset types. It should setup the browser and the playground to load a page, then update the asset files, then load the page again in a way that still uses the cached version of some of the assets.
    • php.js and php.wasm
    • wp.js and wp.data
    • service worker
    • web worker
  2. We write a patch that makes the test pass
  3. We keep the test to prevent regressions
@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Aspect] Browser [Type] Reliability Playground uptime, reliability, not crashing labels Dec 10, 2023
This was referenced Dec 10, 2023
adamziel added a commit that referenced this issue Jan 31, 2024
Adds a .htaccess file to playground.wordpress.net that does the following:

1. Prevents caching of the main index.html file. Otherwise the browser may
   try to load outdated JavaScript, CSS, and WASM assets and and up in a
   broken state.
2. Adds the Access-Control-Allow-Origin header for the blueprint-schema.json
   file and the hosted client.js library to enable `import()`-ing both.

 ## Testing instructions

None. I tested this in an Apache setup, then manually updated the production
.htaccess file, and it all worked as expected.

Related to #855
Closes #873
@adamziel
Copy link
Collaborator Author

adamziel commented Jan 31, 2024

These related PRs should solve most of the problem described in this issue:

The last problematic part I'm aware of is reliable reloading of the service worker, which is tracked here:

#566

We still need the E2E tests to confirm these fixes work reliably.

adamziel added a commit that referenced this issue Jan 31, 2024
…le importing the client.js library (#989)

Adds a .htaccess file to playground.wordpress.net that does the
following:

1. Prevents caching of the main index.html file. Otherwise the browser
may try to load outdated JavaScript, CSS, and WASM assets and and up in
a broken state.
2. Adds the Access-Control-Allow-Origin header for the
blueprint-schema.json file and the hosted client.js library to enable
`import()`-ing both.

## Testing instructions

None. I tested this in an Apache setup, then manually updated the
production .htaccess file, and it all worked as expected.

Related to #855
Closes #873
@adamziel adamziel reopened this Jan 31, 2024
@adamziel adamziel changed the title Cache busting broken on playground.wordpress.net E2E test cache busting on playground.wordpress.net Jan 31, 2024
@adamziel
Copy link
Collaborator Author

Addressed in #1821

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Aspect] Browser [Type] Bug An existing feature does not function as intended [Type] Reliability Playground uptime, reliability, not crashing
Projects
No open projects
Development

No branches or pull requests

1 participant