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

Add/upload plugin e2e tests #1931

Open
wants to merge 14 commits into
base: trunk
Choose a base branch
from

Conversation

JustinyAhin
Copy link
Member

Related Trac Ticket: https://core.trac.wordpress.org/ticket/54334

Test Scenario

  • Replace the old plugin when uploading a new version
  • Cancel and go back to the old plugin while uploading a new version

@JustinyAhin
Copy link
Member Author

Cc @kevin940726, when you have some time, this PR might need some review.

Copy link
Member

@kevin940726 kevin940726 left a comment

Choose a reason for hiding this comment

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

Sorry for that late review. Good job on creating this! I have some concerns of using "Classic Editor" directly in tests, but it's a good start!

Comment on lines +36 to +45
if (pluginStatus === 'active') {
await deactivatePlugin(pluginSlug);
await uninstallPlugin(pluginSlug);
await installPlugin(pluginSlug, pluginName);
} else if (pluginStatus === 'inactive') {
await uninstallPlugin(pluginSlug);
await installPlugin(pluginSlug, pluginName);
} else {
await installPlugin(pluginSlug, pluginName);
}
Copy link
Member

Choose a reason for hiding this comment

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

We could just do this, might be simpler:

Suggested change
if (pluginStatus === 'active') {
await deactivatePlugin(pluginSlug);
await uninstallPlugin(pluginSlug);
await installPlugin(pluginSlug, pluginName);
} else if (pluginStatus === 'inactive') {
await uninstallPlugin(pluginSlug);
await installPlugin(pluginSlug, pluginName);
} else {
await installPlugin(pluginSlug, pluginName);
}
if (pluginStatus === 'active') {
await deactivatePlugin(pluginSlug);
}
if (pluginStatus === 'inactive') {
await uninstallPlugin(pluginSlug);
}
await installPlugin(pluginSlug, pluginName);


describe('Manage uploading new plugin/theme version', () => {
const pluginSlug = 'classic-editor';
const pluginName = 'Classic Editor';
Copy link
Member

Choose a reason for hiding this comment

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

Could we use a smaller and test-purposed plugin instead? It will have some benefits:

  • We'll be able to manage the zip source and check it into the source control as well.
  • The plugin name can be explicitly named for testing purposes.
  • We won't mess with the download count in wp.org.
  • It will be clear in the test whether the installation is an upgrade or a downgrade.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants