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

Restore the importFile step that was accidentally removed in #780 #835

Merged
merged 14 commits into from
Dec 6, 2023

Conversation

adamziel
Copy link
Collaborator

@adamziel adamziel commented Dec 2, 2023

The importFile step, which allows developers to import WordPress content bia WXR and WXZ files, got accidentally removed in Pull Request #780. This commit restores that step.

Open questions

importFile sounds ambiguous. What if it was split into two distinct steps called importWxr and importWxz? Then, the new importWpFiles step could be called importWpContentDirectory instead.

Follow-up work

The importFile step uses DOMParser which isn't available in Node.js. It could, instead:

  • Call the appropriate import-related PHP functions directly, or...
  • Use the HTML Tag Processor available in WordPress 6.3+ (and polyfill it in the older WordPress versions).

Testing Instructions

Go to the following localhost URL and confirm the WordPress reflects the non-standard content it imported from WordPress theme unit tests data:

http://localhost:5400/website-server/#{%22steps%22:[{%22step%22:%22login%22},{%22step%22:%22importFile%22,%22file%22:{%22resource%22:%22url%22,%22url%22:%22https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml%22}}]}

In particular, the menu should say twitter.com, facebook.com etc

As the Playground codebase starts supporting using WordPress in unit tests, let's add a test case for this step.

Closes #833

CC @eliot-akira @aplamada

@aplamada
Copy link

aplamada commented Dec 2, 2023

Using the suggested URL the menu looks as desired. Many thanks @adamziel!

The importFile step, which allows developers to import WordPress content
bia WXR and WXZ files, got accidentally removed in Pull Request #780.
This commit restores that step.

Testing instructions

Go to the following localhost URL and confirm the WordPress reflects the
non-standard content it imported from WordPress theme unit tests data:

http://localhost:5400/website-server/#{%22steps%22:[{%22step%22:%22login%22},{%22step%22:%22importFile%22,%22file%22:{%22resource%22:%22url%22,%22url%22:%22https://raw.githubusercontent.com/WordPress/theme-test-data/master/themeunittestdata.wordpress.xml%22}}]}

In particular, the menu should say twitter.com, facebook.com etc

As the Playground codebase starts supporting using WordPress in unit
tests, let's add a test case for this step.

Closes #833
To use real WordPress in unit tests, we need to import it from
somewhere. At the moment, there is no easy way to do it without running
into a circular dependency problem. This PR adds a new module that has
no explicit import dependencies to solve that problem. It still does
have an implicit path-based dependency on the remote package, which
isn't ideal. Perhaps the build WordPress files could be moved to
yet another dependency-free module such as wp-playground/wordpress and
the remote package would use those files in its build process.
@adamziel adamziel force-pushed the restore-import-file-step branch from 55a4fed to dbd1646 Compare December 6, 2023 12:00
@adamziel adamziel merged commit 9d96856 into trunk Dec 6, 2023
5 checks passed
@adamziel adamziel deleted the restore-import-file-step branch December 6, 2023 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package][@wp-playground] Blueprints [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Blueprints API - importFile step no longer available
2 participants