From 0366d80afa9463397d72f5a2692ad01bfa815c2c Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 13 Dec 2023 16:17:37 -0500 Subject: [PATCH 1/3] add brand plugin test workflow --- .github/workflows/brand-plugin-test.yml | 74 +++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 .github/workflows/brand-plugin-test.yml diff --git a/.github/workflows/brand-plugin-test.yml b/.github/workflows/brand-plugin-test.yml new file mode 100644 index 0000000..f31d801 --- /dev/null +++ b/.github/workflows/brand-plugin-test.yml @@ -0,0 +1,74 @@ +name: Build and Test Module Updates in Brand Plugins +on: + pull_request: + types: [ opened, reopened, ready_for_review, synchronize ] + branches: + - main + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} + cancel-in-progress: true + +jobs: + setup: + name: Setup + runs-on: ubuntu-latest + outputs: + branch: ${{ steps.extract_branch.outputs.branch }} + steps: + + - name: Extract branch name + shell: bash + run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT + id: extract_branch + + bluehost: + name: Bluehost Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'bluehost/bluehost-wordpress-plugin' + secrets: inherit + + hostgator: + name: HostGator Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-hostgator' + secrets: inherit + + web: + name: Web.com Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-web' + secrets: inherit + + crazydomains: + name: Crazy Domains Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-crazy-domains' + secrets: inherit + + mojo: + name: Mojo Build and Test + needs: setup + uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main + with: + module-repo: ${{ github.repository }} + module-branch: ${{ needs.setup.outputs.branch }} + plugin-repo: 'newfold-labs/wp-plugin-mojo' + secrets: inherit From 0c2a5096057d11ab326ffea5d8073c557249f95e Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Wed, 13 Dec 2023 16:17:47 -0500 Subject: [PATCH 2/3] lint fixes on test file --- .../integration/deactivation-survey.cy.js | 201 ++++++++++-------- 1 file changed, 114 insertions(+), 87 deletions(-) diff --git a/tests/cypress/integration/deactivation-survey.cy.js b/tests/cypress/integration/deactivation-survey.cy.js index 88279ad..9209a4c 100644 --- a/tests/cypress/integration/deactivation-survey.cy.js +++ b/tests/cypress/integration/deactivation-survey.cy.js @@ -1,105 +1,132 @@ // -describe('Plugin Deactivation Survey', () => { +describe( 'Plugin Deactivation Survey', () => { + before( () => { + cy.visit( '/wp-admin/plugins.php' ); - before(() => { - cy.visit('/wp-admin/plugins.php'); + // ignore notifications errors if there are any + cy.intercept( + { + method: 'GET', + url: /newfold-notifications/, + }, + { body: {} } + ); + } ); - // ignore notifications errors if there are any - cy.intercept({ - method: 'GET', - url: /newfold-notifications/, - }, { body: {} }); + it( 'Plugin deactivate link opens modal', () => { + // body does not have no scroll class + cy.get( 'body' ).should( 'not.have.class', 'nfd-noscroll' ); + cy.get( '.nfd-deactivation-survey__content' ).should( 'not.exist' ); - }); + // click link + cy.get( + '.deactivate a[id*="' + Cypress.env( 'pluginId' ) + '"]' + ).click(); - it('Plugin deactivate link opens modal', () => { - // body does not have no scroll class - cy.get('body').should('not.have.class', 'nfd-noscroll'); - cy.get('.nfd-deactivation-survey__content').should('not.exist'); + // body has no scroll class + cy.get( 'body' ).should( 'have.class', 'nfd-noscroll' ); - // click link - cy.get('.deactivate a[id*="' + Cypress.env('pluginId') + '"]').click(); + // modal exists + cy.get( '.nfd-deactivation-survey__content' ) + .scrollIntoView() + .should( 'be.visible' ); + } ); - // body has no scroll class - cy.get('body').should('have.class', 'nfd-noscroll'); - - // modal exists - cy.get('.nfd-deactivation-survey__content') - .scrollIntoView() - .should('be.visible'); - }); + it( 'Cancel button exists and exits modal', () => { + cy.get( 'button[nfd-deactivation-survey-destroy]' ).should( + 'be.visible' + ); + cy.get( 'button[nfd-deactivation-survey-destroy]' ).click(); - it('Cancel button exists and exits modal', () => { - cy.get('button[nfd-deactivation-survey-destroy]') - .should('be.visible'); - cy.get('button[nfd-deactivation-survey-destroy]').click(); + cy.get( 'body' ).should( 'not.have.class', 'nfd-noscroll' ); + cy.get( '.nfd-deactivation-survey__content' ).should( 'not.exist' ); + } ); - cy.get('body').should('not.have.class', 'nfd-noscroll'); - cy.get('.nfd-deactivation-survey__content').should('not.exist'); - }); - - it('Skip button deactivates plugin', () => { - // ignore notifications errors if there are any - cy.intercept({ - method: 'GET', - url: /newfold-notifications/, - }, { body: {} }); - cy.intercept({ + it( 'Skip button 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/, - }).as('surveyEvent'); + } ).as( 'surveyEvent' ); - // reopen modal - cy.get('.deactivate a[id*="' + Cypress.env('pluginId') + '"]').click(); - // skip & deactivate functions + // reopen modal + cy.get( + '.deactivate a[id*="' + Cypress.env( 'pluginId' ) + '"]' + ).click(); + // skip & deactivate functions - cy.get('button[nfd-deactivation-survey-skip]') - .should('be.visible'); - cy.get('button[nfd-deactivation-survey-skip]').click(); - cy.wait('@surveyEvent') - // .its('request.body.action').should('eq', 'deactivation_survey_freeform') - .its('request.body.data.survey_input').should('eq', 'No input'); - // verify modal closed - cy.get('.nfd-deactivation-survey__content').should('not.exist'); - // verify plugin is deactivated - cy.get('.deactivate a[id*="' + Cypress.env('pluginId') + '"]').should('not.exist'); - cy.get('.activate a[id*="' + Cypress.env('pluginId') + '"]').should('exist'); - // reactivate plugin - cy.get('.activate a[id*="' + Cypress.env('pluginId') + '"]').click(); - cy.wait(500); - }); + cy.get( 'button[nfd-deactivation-survey-skip]' ).should( 'be.visible' ); + cy.get( 'button[nfd-deactivation-survey-skip]' ).click(); + cy.wait( '@surveyEvent' ) + // .its('request.body.action').should('eq', 'deactivation_survey_freeform') + .its( 'request.body.data.survey_input' ) + .should( 'eq', 'No input' ); + // verify modal closed + cy.get( '.nfd-deactivation-survey__content' ).should( 'not.exist' ); + // verify plugin is deactivated + cy.get( + '.deactivate a[id*="' + Cypress.env( 'pluginId' ) + '"]' + ).should( 'not.exist' ); + cy.get( '.activate a[id*="' + Cypress.env( 'pluginId' ) + '"]' ).should( + 'exist' + ); + // reactivate plugin + cy.get( + '.activate a[id*="' + Cypress.env( 'pluginId' ) + '"]' + ).click(); + cy.wait( 500 ); + } ); - it('Survey successfully deactivates plugin', () => { - // ignore notifications errors if there are any - cy.intercept({ - method: 'GET', - url: /newfold-notifications/, - }, { body: {} }); - cy.intercept({ + 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/, - }).as('surveyEvent'); - - // reopen modal - cy.get('.deactivate a[id*="' + Cypress.env('pluginId') + '"]').click(); - // can enter reason - const ugcReason = 'automated testing'; - cy.get('#nfd-deactivation-survey__input').type(ugcReason); - // submit and deactivate works - cy.get('input[nfd-deactivation-survey-submit]') - .should('be.visible'); - cy.get('input[nfd-deactivation-survey-submit]').click(); - cy.wait('@surveyEvent') - // .its('request.body.action').should('eq', 'deactivation_survey_freeform') - .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'); - cy.get('.activate a[id*="' + Cypress.env('pluginId') + '"]').should('exist'); - // reactivate plugin - cy.get('.activate a[id*="' + Cypress.env('pluginId') + '"]').click(); - cy.wait(500); - }); + } ).as( 'surveyEvent' ); -}); + // reopen modal + cy.get( + '.deactivate a[id*="' + Cypress.env( 'pluginId' ) + '"]' + ).click(); + // can enter reason + const ugcReason = 'automated testing'; + cy.get( '#nfd-deactivation-survey__input' ).type( ugcReason ); + // submit and deactivate works + cy.get( 'input[nfd-deactivation-survey-submit]' ).should( + 'be.visible' + ); + cy.get( 'input[nfd-deactivation-survey-submit]' ).click(); + cy.wait( '@surveyEvent' ) + // .its('request.body.action').should('eq', 'deactivation_survey_freeform') + .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' ); + cy.get( '.activate a[id*="' + Cypress.env( 'pluginId' ) + '"]' ).should( + 'exist' + ); + // reactivate plugin + cy.get( + '.activate a[id*="' + Cypress.env( 'pluginId' ) + '"]' + ).click(); + cy.wait( 500 ); + } ); +} ); From eb00e1eb0029b2f9327d37b8aa9c59d01bf276e7 Mon Sep 17 00:00:00 2001 From: Evan Mullins Date: Thu, 14 Dec 2023 16:09:14 -0500 Subject: [PATCH 3/3] add .nvmrc as v16 --- .nvmrc | 1 + 1 file changed, 1 insertion(+) create mode 100644 .nvmrc diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 0000000..6f7f377 --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v16