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 themes e2e tests #1813

Open
wants to merge 4 commits into
base: master
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 theme by uploading a new version
  • Cancel and go back to the old theme while uploading a new version

@JustinyAhin
Copy link
Member Author

@kevin940726 @tellthemachines @hellofromtonya this PR is ready for reviews.
cc @juhi123

Comment on lines +11 to +13
installTheme,
deleteTheme,
isThemeInstalled,
Copy link
Member

Choose a reason for hiding this comment

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

Just a reminder that we should probably test these individually here in core instead, and rewrite the utils using rest API or other alternatives.

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you mean we should rewrite these utilities in Core @kevin940726?

Copy link
Member

Choose a reason for hiding this comment

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

I mean we should test these utilities in core, so that we don't have to do them manually in e2e-test-utils. Currently, these utils are implemented in a slow way of manually navigating to the themes page and interact with the buttons. We should be able to rewrite them using programmatic methods like REST API so that they can be faster. We still have to write e2e tests for installing and deleting themes though and they should be in core rather than in gutenberg.

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense.

The isThemeInstalled utility would benefit to be rewritten using the REST API.
Not sure if we can delete and install themes using the API though 🤔.

I will go ahead and create a new PR with a utility folder and functions.


await page.click('.update-from-upload-actions a:not(.update-from-upload-overwrite)');

expect(await checkThemeVersion(themeName)).not.toBe(themeVersion);
Copy link
Member

Choose a reason for hiding this comment

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

What is the expected theme version then? Maybe I'm missing something, why is the old version and the updated version both 2.0.0?

Copy link
Member Author

Choose a reason for hiding this comment

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

why is the old version and the updated version both 2.0.0?

This is actually the opposite: not.toBe. Since the update has been canceled, we make sure that the current version is different from the old that was being uploaded.

Copy link
Member

Choose a reason for hiding this comment

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

What was the old version? Isn't themeVersion equals to 2.0.0 which is used in oldThemePath?

Copy link
Member Author

Choose a reason for hiding this comment

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

The old version is themeVersion yes.

The current version is 2.4.1 which is the latest version of Hello Elementor.

@JustinyAhin
Copy link
Member Author

Hi @kevin940726 👋🏻
Any updates for your review? I also created this PR #1858 for the helpers for e2e in Core.

@kevin940726
Copy link
Member

Hi @JustinyAhin! Sorry, been busy with 5.9 and other things. I'll try to find some time to review this 🙇‍♂️ !

@JustinyAhin
Copy link
Member Author

Hi @JustinyAhin! Sorry, been busy with 5.9 and other things. I'll try to find some time to review this 🙇‍♂️ !

Thank you, Kevin :)

__experimentalRest as rest,
} from "@wordpress/e2e-test-utils";

const themeSlug = "hello-elementor";
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we replace this with a skeleton theme that has only the files required for a theme to be considered valid?

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.

3 participants