Skip to content

Conversation

@up1512001
Copy link
Member

What?

This PR removes TT4, TT3 and TT1 theme installation when running npm run wp-env start as we are already getting all default themes from WordPress.

Why?

#62491

How?

remove unnecessary theme installations from .wp-env.json file.

Screenshot after modifying .wp-env.json

Screenshot 2024-06-11 at 23 36 24

@github-actions
Copy link

github-actions bot commented Jun 11, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: up1512001 <[email protected]>
Co-authored-by: youknowriad <[email protected]>
Co-authored-by: vcanales <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: talldan <[email protected]>
Co-authored-by: SirLouen <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jun 11, 2024
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @up1512001! In case you missed it, we'd love to have you join us in our Slack community.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

"wp-content/themes/gutenberg-test-themes": "./test/gutenberg-test-themes",
"wp-content/themes/gutenberg-test-themes/twentytwentyone": "https://downloads.wordpress.org/theme/twentytwentyone.2.1.zip",
"wp-content/themes/gutenberg-test-themes/twentytwentythree": "https://downloads.wordpress.org/theme/twentytwentythree.1.3.zip",
"wp-content/themes/gutenberg-test-themes/twentytwentyfour": "https://downloads.wordpress.org/theme/twentytwentyfour.1.0.zip"
Copy link
Contributor

Choose a reason for hiding this comment

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

I think these themes are actually used in performance tests no?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think if we remove these, the performance tests in CI might still run but locally, you'll have issues running these. cc @oandregal

Copy link
Member Author

Choose a reason for hiding this comment

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

@youknowriad but when I see that under the test folder all three theme folders are empty even before this modification also 🤔

Copy link
Member

Choose a reason for hiding this comment

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

They're being downloaded in the test environment, and they're used here:

'wp-content/themes/gutenberg-test-themes':
path.join(
testRunnerDir,
'test/gutenberg-test-themes'
),
'wp-content/themes/gutenberg-test-themes/twentytwentyone':
'https://downloads.wordpress.org/theme/twentytwentyone.1.7.zip',
'wp-content/themes/gutenberg-test-themes/twentytwentythree':
'https://downloads.wordpress.org/theme/twentytwentythree.1.0.zip',

Copy link
Member Author

Choose a reason for hiding this comment

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

@youknowriad I run a performance test locally and it's working fine.
npm run test:performance

Copy link
Contributor

Choose a reason for hiding this comment

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

This was added in #50905, but the purpose seems to be to keep theme versions consistent across performance tests.

@vcanales
Copy link
Member

Regarding the original issue, #62491, are you going to the site on port 8888 (development) or 8889 (test)? I usually do my local manual testing on the development site, since 8889 is used by automation. I can reproduce your issue, but I also expect the test site to have its own quirks.

➜  gutenberg git:(trunk) npm run wp-env start -- --xdebug=profile,trace,debug

> [email protected] wp-env
> wp-env start --xdebug=profile,trace,debug

WordPress development site started at http://localhost:8888 # I use this one for development
WordPress test site started at http://localhost:8889

Perhaps we're lacking a bit of cleanup on the test site, though.

@up1512001
Copy link
Member Author

I check on the 8889 port. @vcanales

@up1512001
Copy link
Member Author

up1512001 commented Jun 11, 2024

Still, one strange thing why the TT4, TT3 and TT1 folders are empty even after running the performance test?
cc: @vcanales @youknowriad
Screenshot 2024-06-11 at 23 57 31

@t-hamano t-hamano linked an issue Jun 12, 2024 that may be closed by this pull request
@talldan
Copy link
Contributor

talldan commented Jun 12, 2024

I check on the 8889 port.

It's recommended to use 8888 for anything you're doing manually, 8889 is for running tests. Those automated tests expect a clean environment, so you should avoid changing stuff in the WordPress instance there. When you run the tests, they'll also do some clean up like deleting posts, sometimes patterns, or even resetting styles, which is something you might not want to happen.

@up1512001
Copy link
Member Author

I guess we should update the performance test to run on the latest version to avoid duplicate theme installation.

@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts labels Jul 16, 2025
@github-actions
Copy link

Warning: Type of PR label mismatch

To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.

  • Type-related labels to choose from: [Type] Automated Testing, [Type] Breaking Change, [Type] Bug, [Type] Build Tooling, [Type] Code Quality, [Type] Copy, [Type] Developer Documentation, [Type] Enhancement, [Type] Experimental, [Type] Feature, [Type] New API, [Type] Task, [Type] Technical Prototype, [Type] Performance, [Type] Project Management, [Type] Regression, [Type] Security, [Type] WP Core Ticket, Backport from WordPress Core, Gutenberg Plugin.
  • Labels found: [Type] Bug, Gutenberg Plugin, First-time Contributor.

Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task.

@SirLouen
Copy link
Member

SirLouen commented Jul 16, 2025

Yes, I agree with @up1512001 this is a faulty behaviour (lucky that he found this out of chance playing around in :8889.

Basically, these are being installed twice in the testing container

# ls
emptytheme             index.php     twentyfifteen   twentynineteen   twentysixteen  twentythirteen  twentytwenty      twentytwentyfour  twentytwentythree
gutenberg-test-themes  twentyeleven  twentyfourteen  twentyseventeen  twentyten      twentytwelve    twentytwentyfive  twentytwentyone   twentytwentytwo
root@30d0550a4305:/var/www/html/wp-content/themes# ls gutenberg-test-themes/
block-bindings  darktheme  emptyhybrid  style-variations  twentytwentyfour  twentytwentyone  twentytwentythree

Also with this removed it seems that all tests are passing @talldan.

Tests should not be failing as these themes are being installed on the default image
Also it doesnt make any sense having to maintain those versions.

Can you elaborate a bit more on your concern?

@talldan
Copy link
Contributor

talldan commented Jul 17, 2025

Also with this removed it seems that all tests are passing @talldan.

Tests should not be failing as these themes are being installed on the default image
Also it doesnt make any sense having to maintain those versions.

Can you elaborate a bit more on your concern?

I don't think it was me that shared the concern - I just mentioned that port 8888 is what we use for local development, while 8889 is what we use for automated tests. (in relation to this comment - #62492 (comment))

The concerns were shared in this thread by others - #62492 (comment)

Those seem valid to me. The themes used in the test environments are fixed to a specific version number to keep the environment stable - it ensures upstream changes to themes don't cause the tests to fail. I think it's mostly a concern for performance tests where a specific baseline is used to compare performance.

Maybe when those locked version themes are added, any already installed themes of the same name should be removed?

SirLouen added a commit to SirLouen/gutenberg that referenced this pull request Jul 17, 2025
@SirLouen
Copy link
Member

I don't think it was me that shared the concern - I just mentioned that port 8888 is what we use for local development, while 8889 is what we use for automated tests. (in relation to this comment - #62492 (comment))

The concerns were shared in this thread by others - #62492 (comment)

@talldan @vcanales in fact this is not completely right. Performance tests actually create their own env file and download and install their own versions regardless of the ones specified here.

As @t-hamano commented, this was added in #50905 for performance testing but in #57841 they noted that versions were causing it to fail.

I guess we should update the performance test to run on the latest version to avoid duplicate theme installation.

If certain specific versions are required for this to work (which doesn't make any sense to have fixed versions because theoretically these tests should be always done against latest versions), then they could simply be moved into the default directory. Not only to avoid duplicate theme duplication, but to test against the reality. Tests are meant to protect against current threats.

Technically, the performance part is not required any more. Unless I'm wrong, it doesn't make any sense because writeFileSync doesn't write on top of current .wp-env.json and since tests are being thrown against with the code as-is, it looks redundant.

I've added #70754 just to check the performance testing suite on GHA. I've tested locally and it's passing 100%.

PS: Note that when #50905 was sent, wp-env did not include by default all these themes. This is why they had to be added on top of the current installation.

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

Labels

First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository Gutenberg Plugin Issues or PRs related to Gutenberg Plugin management related efforts [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Double time TT4, TT3 and TT1 theme is given in appearance

6 participants