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 E2E tests for terms feature #2931

Merged
merged 10 commits into from
Aug 15, 2022
Prev Previous commit
Next Next commit
Feedback addressed
  • Loading branch information
burhandodhy committed Aug 11, 2022
commit 799c51de3f97dda7cd1795aaaf8729f04e366738
39 changes: 24 additions & 15 deletions tests/cypress/integration/features/terms.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
describe('Terms Feature', () => {
const tags = ['Far From Home', 'No Way Home', 'The Most Fun Thing'];

after(() => {
cy.visitAdminPage('edit-tags.php?taxonomy=post_tag');

/**
* Delete all tags
*
* @todo Instead of looping through each tag, we would select all tags and delete them once the dummy data is removed.
*/
tags.forEach((tag) => {
cy.get('#tag-search-input').clear().type(tag);
cy.get('#search-submit')
.click()
.then(() => {
cy.get('.wp-list-table tbody tr')
.first()
.find('.row-actions .delete a')
.click({ force: true });
});
});
});
felipeelia marked this conversation as resolved.
Show resolved Hide resolved

it('Can turn the feature on', () => {
cy.login();

Expand Down Expand Up @@ -82,7 +105,6 @@ describe('Terms Feature', () => {

cy.visitAdminPage('edit-tags.php?taxonomy=post_tag');

const tags = ['Far From Home', 'No Way Home', 'The Most Fun Thing'];
// create tags.
tags.forEach((tag) => {
cy.createTaxonomy({ name: tag, taxonomy: 'post_tag' });
Expand All @@ -97,22 +119,9 @@ describe('Terms Feature', () => {
cy.get(
'#debug-menu-target-EP_Debug_Bar_ElasticPress .ep-query-debug .ep-query-result',
).should('contain.text', 'The Most Fun Thing');

// delete the tags.
tags.forEach((tag) => {
cy.get('#tag-search-input').clear().type(tag);
cy.get('#search-submit')
.click()
.then(() => {
cy.get('.wp-list-table tbody tr')
.first()
.find('.row-actions .delete a')
.click({ force: true });
});
});
});

it('can update a child term when a parent term is deleted', () => {
it('Can update a child term when a parent term is deleted', () => {
cy.login();
cy.maybeEnableFeature('terms');

Expand Down