wp-media / wp-rocket-e2e

Playwright E2E testing repo
GNU General Public License v3.0
0 stars 0 forks source link

Properly Integrate wp cli commands #13

Open jeawhanlee opened 1 year ago

jeawhanlee commented 1 year ago

Describe the solution you'd like Currently we support wp cli but we are not being used in the tests, we should integrate them properly and reduce relating with the interface except for actual tests.

For example, installation of plugin and uninstalling of the plugin can be done without passing the UI except for test where we are actually testing the deleting of the plugin.

jeawhanlee commented 1 year ago

Scope a solution ✅

In general we have steps like install, activate and clean up, we can move this to using the wp cli.

We need to use the functions already defined in our test suite in https://github.com/wp-media/wp-rocket-e2e/blob/trunk/utils/commands.ts: We will no longer need these: https://github.com/wp-media/wp-rocket-e2e/blob/8ae65d2a2861e89c1a5c42fe5e926199d45984b5/src/support/hooks.ts#L26-L37 To simplify the installation, we will need a new function to pull in the plugin from a relative folder:

export async function installPlugin(name: string): Promise<void>  {
     await wp(`plugin install plugin/${name}`)
}

finally we can uncomment the wp cli module in the hooks file so as to also reset WP instead of using the clean up step in the step definition.

Estimate the effort ✅ [S]