Skip to content

Commit

Permalink
Merge pull request #2 from newfold-labs/update/test
Browse files Browse the repository at this point in the history
Update/test
  • Loading branch information
circlecube authored Oct 17, 2023
2 parents 5fa1db9 + 5a3e249 commit dd8bf18
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions tests/cypress/integration/deactivation-survey.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ describe('Plugin Deactivation Survey', () => {

before(() => {
cy.visit('/wp-admin/plugins.php');

// ignore notifications errors if there are any
cy.intercept({
method: 'GET',
url: /newfold-notifications/,
}, { body: {} });

});

it('Plugin deactivate link opens modal', () => {
Expand Down Expand Up @@ -33,6 +40,12 @@ describe('Plugin Deactivation Survey', () => {
});

it('Skip button deactivates plugin', () => {
// ignore notifications errors if there are any
cy.intercept({
method: 'GET',
url: /newfold-notifications/,
}, { body: {} });

// reopen modal
cy.get('.deactivate a[id*="' + Cypress.env('pluginId') + '"]').click();
// skip & deactivate functions
Expand All @@ -53,6 +66,11 @@ describe('Plugin Deactivation Survey', () => {


it('Survey successfully deactivates plugin', () => {
// ignore notifications errors if there are any
cy.intercept({
method: 'GET',
url: /newfold-notifications/,
}, { body: {} });
cy.intercept({
method: 'POST',
url: /newfold-data(\/|%2F)v1(\/|%2F)events/,
Expand All @@ -69,7 +87,7 @@ describe('Plugin Deactivation Survey', () => {
cy.get('input[nfd-deactivation-survey-submit]').click();
cy.wait('@surveyEvent')
// .its('request.body.action').should('eq', 'deactivation_survey_freeform')
.its('request.body.data.label_key').should('eq', ugcReason);
.its('request.body.data.survey_input').should('eq', ugcReason);
cy.wait(500);
// verify plugin is deactivated
cy.get('.deactivate a[id*="' + Cypress.env('pluginId') + '"]').should('not.exist');
Expand All @@ -79,4 +97,4 @@ describe('Plugin Deactivation Survey', () => {
cy.wait(500);
});

})
});

0 comments on commit dd8bf18

Please sign in to comment.