Skip to content

Conversation

@tfirdaus
Copy link
Contributor

@tfirdaus tfirdaus commented Apr 17, 2024

This Pull Request updates the theme to install in the feature tests from p2 to twentytwelve since the p2 has been removed from WP.org repository.

Reference

@ernilambar
Copy link
Member

ernilambar commented Apr 19, 2024

In Given, if we could provide like

And I run `wp theme delete --all --force`

then we need not have to update much of code. This way we only need to replace theme slug in When.

@tfirdaus
Copy link
Contributor Author

I tried using the --force flag, but it seems like it's going to require more updates to the initial feature spec than the necessary. Here's an example where it didn't work as expected. Since the twentytwenty theme is already installed, if I use --force, I'll have to change the output message from "Theme installed successfully." to "Theme updated successfully."

Screenshot 2024-04-24 at 1 49 11 PM

@ernilambar @swissspidy Thought on this. Do you think this is the preferable approach?
Ideally I'd prefer to keep the updates to a minimum.

@ernilambar
Copy link
Member

ernilambar commented Apr 24, 2024

I think you added --force to the command in When. We should not be updating those arguments. You can add And I run wp theme delete --all --force in Given (after line 4) in theme-install.feature. (Apologies. I think I didn't make that clear in earlier comment)

And I run `wp theme install twentytwelve`

Scenario: Delete an installed theme
When I run `wp theme delete p2`
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
When I run `wp theme delete p2`
When I run `wp theme delete twentytwelve`

Because we're now installing twentytwelve in Background

@swissspidy
Copy link
Member

There are still a lot of tests referencing p2. I'd probably start by replacing all of those with twentytwelve

@tfirdaus
Copy link
Contributor Author

tfirdaus commented Apr 25, 2024

@ernilambar this error is a bit weird to me. Somehow it does not happen when I run this test in local. What do you think I did wrong here? It seems there are slight differences between the environment that missed in my local.

009 Scenario: Parent theme is active when its child is active # features/theme.feature:577
      And I run `wp theme delete twentytwelve --force`        # features/theme.feature:579
        $ wp theme delete twentytwelve --force
        Success: Theme already deleted.

If I did not run wp theme delete twentytwelve --force, it would throw:

001 Scenario: Parent theme is active when its child is active # features/theme.feature:577
      And I run `wp theme install twentytwelve`               # features/theme.feature:580
        $ wp theme install twentytwelve
        Success: Theme already installed.
        
        Warning: twentytwelve: Theme already installed.

@swissspidy swissspidy requested a review from ernilambar April 25, 2024 07:54
@swissspidy swissspidy added this to the 2.1.20 milestone Apr 25, 2024
@tfirdaus
Copy link
Contributor Author

Thanks @ernilambar for your help on this PR 👏

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants