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

The activatePlugin step doesn't throw an error when given invalid inputs #1347

Closed
adamziel opened this issue Apr 30, 2024 · 0 comments · Fixed by #1391
Closed

The activatePlugin step doesn't throw an error when given invalid inputs #1347

adamziel opened this issue Apr 30, 2024 · 0 comments · Fixed by #1391
Assignees
Labels
[Package][@wp-playground] Blueprints [Type] Bug An existing feature does not function as intended
Milestone

Comments

@adamziel
Copy link
Collaborator

The activatePlugin step is for plugins that were installed earlier but not activated. Also the path must point to the .php file where the plugin comment lives and be relative to wp-content, so e.g. gutenberg/gutenberg.php – this is what WordPress expects.

The Blueprint below should result in an error, since the plugin wasn't installed and even if it was the pluginPath is invalid. Unfortunately, it doesn't result in an error but a broken Playground installation:

{
    "landingPage": "/wp-admin/site-editor.php",

    "preferredVersions": {
        "php": "7.4",
        "wp": "6.5"
    },
    "phpExtensionBundles": [
        "kitchen-sink"
    ],

    "features": {
        "networking": true
    },
    
    "steps": [
        {
            "step": "login",
            "username": "admin",
            "password": "password"
        },
        {
            "step": "activatePlugin",
            "pluginName": "Gutenberg",
            "pluginPath": "/wordpress/wp-content/plugins/gutenberg"
        }
    ]
}
@adamziel adamziel added [Type] Bug An existing feature does not function as intended [Package][@wp-playground] Blueprints labels Apr 30, 2024
@adamziel adamziel added this to the Zero Crashes milestone Apr 30, 2024
@bgrgicak bgrgicak self-assigned this May 14, 2024
adamziel added a commit that referenced this issue May 16, 2024
…1391)

Fixes #1347

## What is this PR doing?
 
Throw an error when activating a theme or plugin that doesn't exist.

## What problem is it solving?

Users currently don't know when the activate plugin and theme steps
fail.

## How is the problem addressed?

By checking if the file exists before trying to activate it.

## Testing Instructions

- Checkout this branch
- [Run this blueprint
t](http://localhost:5400/website-server/#{%20%22landingPage%22:%20%22/wp-admin/site-editor.php%22,%20%22preferredVersions%22:%20{%20%22php%22:%20%227.4%22,%20%22wp%22:%20%226.5%22%20},%20%22phpExtensionBundles%22:%20[%20%22kitchen-sink%22%20],%20%22features%22:%20{%20%22networking%22:%20true%20},%20%22steps%22:%20[%20{%20%22step%22:%20%22login%22,%20%22username%22:%20%22admin%22,%20%22password%22:%20%22password%22%20},%20{%20%22step%22:%20%22activatePlugin%22,%20%22pluginName%22:%20%22Gutenberg%22,%20%22pluginPath%22:%20%22/wordpress/wp-content/plugins/gutenberg%22%20}%20]%20})o
activate an unexisting plugin
- You should see the error modal with an error about the failed plugin
install step
- [Run this blueprint
t](http://localhost:5400/website-server/#{%20%22steps%22:%20[%20{%20%22step%22:%20%22activateTheme%22,%20%22themeFolderName%22:%20%22storefront%22%20}%20]%20})o
activate an unexisting theme
- You should see the error modal with an error about the failed theme
install step

---------

Co-authored-by: Adam Zieliński <adam@adamziel.com>
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
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants