Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…oarding into enhance/ai-onboarding
  • Loading branch information
arunshenoy99 committed Jan 31, 2024
2 parents 9cf476f + 1932200 commit aa8d9d9
Show file tree
Hide file tree
Showing 72 changed files with 709 additions and 463 deletions.
2 changes: 1 addition & 1 deletion bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function nfd_wp_module_onboarding_register() {

// Set Global Constants
if ( ! defined( 'NFD_ONBOARDING_VERSION' ) ) {
define( 'NFD_ONBOARDING_VERSION', '1.12.0' );
define( 'NFD_ONBOARDING_VERSION', '1.12.1' );
}
if ( ! defined( 'NFD_ONBOARDING_DIR' ) ) {
define( 'NFD_ONBOARDING_DIR', __DIR__ );
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
354 changes: 186 additions & 168 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@newfold-labs/wp-module-onboarding",
"version": "1.12.0",
"version": "1.12.1",
"description": "Next-generation WordPress Onboarding for WordPress sites at Newfold Digital.",
"license": "GPL-2.0-or-later",
"private": true,
Expand Down
39 changes: 22 additions & 17 deletions tests/cypress/integration/1-Initial-steps/branding.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <reference types="Cypress" />
import { GetPluginId } from '../wp-module-support/pluginID.cy';
import { GetPluginId, GetPluginName } from '../wp-module-support/pluginID.cy';

describe( 'Branding', function () {
before( () => {
Expand All @@ -8,14 +8,18 @@ describe( 'Branding', function () {

// since we are setting brand from plugin container, it will not be set to "newfold"
// by default even if mm_brand option is deleted from the database
it( 'Has ' + GetPluginId() + ' CSS when mm_brand does not exist.', () => {
it( 'Has ' + GetPluginId() + ' class when mm_brand does not exist.', () => {
cy.exec( 'npx wp-env run cli wp option delete mm_brand' );
cy.reload();
cy.get( 'body' ).should( 'have.class', `nfd-brand-${ GetPluginId() }` );
cy.get( '.is-bg-primary' )
.should( 'have.css', 'background-color', 'rgb(53, 117, 211)' )
.should( 'have.css', 'color', 'rgb(255, 255, 255)' );
cy.get( '.nfd-step-card-subheading' ).should( 'contain',GetPluginId().charAt(0).toUpperCase() + GetPluginId().slice(1) );
if(GetPluginId()=='hostgator'){
cy.exec( 'npx wp-env run cli wp option set hg_region BR' )
cy.reload();
cy.get(`.nfd-brand-${ GetPluginId() }-br`,{timeout:10000}).should('be.visible');
}
else{
cy.get( 'body', {timeout:15000} ).should( 'have.class', `nfd-brand-${ GetPluginId() }` );
}
GetPluginName();
} );

it( 'Has default WordPress styles when mm_brand has an empty value', () => {
Expand All @@ -25,19 +29,20 @@ describe( 'Branding', function () {
);
cy.reload();
cy.get( 'body' ).should( 'have.class', 'nfd-brand-wordpress' );
cy.get( '.is-bg-primary' )
.should( 'have.css', 'background-color', 'rgb(0, 124, 186)' )
.should( 'have.css', 'color', 'rgb(255, 255, 255)' );
cy.get( '.nfd-step-card-subheading' ).should( 'contain', 'web host' );
if(GetPluginId()!='hostgator'){
cy.get( '.nfd-step-card-subheading' ).should( 'contain', 'web host' );
};
} );

it( 'Has brand specific CSS for ' + GetPluginId(), () => {
it( 'Has brand specific class for ' + GetPluginId(), () => {
cy.exec( `npx wp-env run cli wp option update mm_brand ${ GetPluginId() }` );
cy.reload();
cy.get( 'body' ).should( 'have.class', `nfd-brand-${ GetPluginId() }` );
cy.get( '.is-bg-primary' )
.should( 'have.css', 'background-color', 'rgb(53, 117, 211)' )
.should( 'have.css', 'color', 'rgb(255, 255, 255)' );
cy.get( '.nfd-step-card-subheading' ).should( 'contain', GetPluginId().charAt(0).toUpperCase() + GetPluginId().slice(1) );
if(GetPluginId()=='hostgator'){
cy.get(`.nfd-brand-${ GetPluginId() }-br`,{timeout:10000}).should('be.visible');
}
else{
cy.get( 'body', {timeout:15000} ).should( 'have.class', `nfd-brand-${ GetPluginId() }` );
}
GetPluginName();
} );
} );
66 changes: 37 additions & 29 deletions tests/cypress/integration/1-Initial-steps/whats-next.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
// <reference types="Cypress" />
import { DrawerActivityForMenu } from '../wp-module-support/drawer.cy';
import { CheckCardHeadingSubheading } from '../wp-module-support/header.cy';
import { GetPluginId } from '../wp-module-support/pluginID.cy';
import {
BasicSidebarCheck,
CheckHelpPanelLinks,
CheckIllustrationPanel,
CheckInfoPanel,
Expand All @@ -16,44 +18,50 @@ describe( 'What Next Page', function () {
cy.wait( 5000 );
} );

it.skip( 'Check Drawer Activity', () => {
it( 'Check Drawer Activity', () => {
DrawerActivityForMenu(
'Exit to WordPress',
'WordPress',
':nth-child(6)',
'What Next',
false
);
} );

it( 'Check to make sure sidebar opens, content is in place and close sidebar', () => {
CheckIntroPanel( '__what-next', 'What’s Next' );
CheckIllustrationPanel( '__what-next' );
CheckInfoPanel( 2 );
CheckHelpPanelLinks();
} );
if(GetPluginId()=='bluehost'){
it( 'Check to make sure sidebar opens, content is in place and close sidebar', () => {
CheckIntroPanel( '__what-next', 'What’s Next' );
CheckIllustrationPanel( '__what-next' );
CheckInfoPanel( 2 );
CheckHelpPanelLinks();
} );

it( 'Hovering over overview tab panel and asserting the tab data', () => {
cy.contains( 'button', 'WHATS NEXT' ).trigger( 'mouseover' );
cy.get( '.tab-text' ).should(
'contain',
'Add content, organize your menu and launch.'
);
cy.contains( 'button', 'HELP & RESOURCES' ).trigger( 'mouseover' );
cy.get( '.tab-text' ).should(
'contain',
"Next step or next level, we're your partner."
);
cy.contains( 'button', 'HIRE OUR EXPERTS' ).trigger( 'mouseover' );
cy.get( '.tab-text' ).should(
'contain',
'Make our great people your people.'
);
} );
}
else{
it( 'Check to make sure Sidebar opens', () => {
BasicSidebarCheck();
} );
};

it( 'Check if whatnext card is visible', () => {
cy.get( '.whatnext-card' ).should( 'be.visible' );
} );

it( 'Hovering over overview tab panel and asserting the tab data', () => {
cy.contains( 'button', 'WHATS NEXT' ).trigger( 'mouseover' );
cy.get( '.tab-text' ).should(
'contain',
'Add content, organize your menu and launch.'
);
cy.contains( 'button', 'HELP & RESOURCES' ).trigger( 'mouseover' );
cy.get( '.tab-text' ).should(
'contain',
"Next step or next level, we're your partner."
);
cy.contains( 'button', 'HIRE OUR EXPERTS' ).trigger( 'mouseover' );
cy.get( '.tab-text' ).should(
'contain',
'Make our great people your people.'
);
} );

it( 'Check if main heading and sub heading shows up', () => {
CheckCardHeadingSubheading();
} );
Expand All @@ -63,11 +71,11 @@ describe( 'What Next Page', function () {
} );

it( 'Check if complete setup button is visible', () => {
cy.contains( 'button', 'Complete Setup' ).should( 'be.visible' );
cy.get('.nfd-nav-card-button').should( 'be.visible' );
} );

it( 'Check Finish button is visible and finish the setup', () => {
cy.contains( 'button', 'Finish' ).should( 'be.visible' ).click();
cy.get('.components-button-group > .components-button').should( 'be.visible' ).click();
cy.wait( 1000 );
cy.url().should( 'not.contain', '/wp-setup/step/what-next' );
} );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
import { DrawerClose } from '../wp-module-support/drawer.cy';
import { CheckHeadingSubheading } from '../wp-module-support/header.cy';
import {
BasicSidebarCheck,
CheckHelpPanelLinks,
CheckIllustrationPanel,
CheckInfoPanel,
CheckIntroPanel
} from '../wp-module-support/sidebar.cy';
import { SocialMediaTextValidations } from '../wp-module-support/socialMedia.cy';
import { APIList, BasicInfoAPI } from '../wp-module-support/EventsApi.cy';
import { GetPluginId } from '../wp-module-support/pluginID.cy';

describe( 'Basic Info Page', function () {
const desc = 'Welcome to WordPress';
Expand All @@ -35,7 +37,6 @@ describe( 'Basic Info Page', function () {

cy.get( ':nth-child(2) > .nfd-onboarding-drawer__panel-menu-link' )
.should( 'have.class', 'active' )
.should( 'have.text', 'Basic Info' )
.and( 'have.attr', 'href' )
.then( ( value ) => ( href = value ) );
cy.url().then( ( url ) => {
Expand All @@ -49,18 +50,19 @@ describe( 'Basic Info Page', function () {
CheckHeadingSubheading();
} );

it( 'Check to make sure sidebar opens, content is in place and close sidebar', () => {
CheckIntroPanel( '__basic-info', 'Basic Info' );
CheckIllustrationPanel();
CheckInfoPanel();
CheckHelpPanelLinks();
} );

it( 'Check if Header has text `website` in it', () => {
cy.get( '.nfd-main-heading__title' )
.should( 'be.visible' )
.contains( 'website' );
} );
if(GetPluginId()=='bluehost'){
it( 'Check to make sure sidebar opens, content is in place and close sidebar', () => {
CheckIntroPanel( '__basic-info', 'Basic Info' );
CheckIllustrationPanel();
CheckInfoPanel();
CheckHelpPanelLinks();
} );
}
else{
it( 'Check to make sure Sidebar opens', () => {
BasicSidebarCheck();
} );
};

it( 'Enter a Title and then Check if it reflects elsewhere', () => {
const titleBox = cy.get( ':nth-child(1) > label > .nfd-input__field' );
Expand Down Expand Up @@ -164,24 +166,32 @@ describe( 'Basic Info Page', function () {
socialTest2.focus();
socialTest.type( invalidURL );
socialTest2.focus();

if(GetPluginId()!='hostgator'){
cy.get( '.Tooltip-Wrapper', { timeout: 3000 } ).should( 'exist' );
cy.get( '.Tooltip-Tip', { timeout: 3000 } )
.should( 'be.visible' )
.should( 'contain', Tooltiptext2 );
cy.get( '.navigation-buttons_next' ).click();
cy.get( '.components-modal__content' ).should( 'be.visible' );
cy.get( '.components-modal__header-heading' ).should(
'have.text',
ModalText2
);
cy.get( '.components-modal__header button' , { timeout: customCommandTimeout } ).click()
cy.get(
'.browser-content_social_icon[style="background-image: var(--facebook-icon);"]'
).should( 'have.css', 'opacity', '0.75' );
}
else{
cy.get( '.Tooltip-Wrapper', { timeout: 3000 } ).should( 'exist' );
cy.get( '.Tooltip-Tip', { timeout: 3000 } )
.should( 'be.visible' );
};
// The URL Checker runs on a debounce
// Shows the message to the User in case of Invalid URL
cy.get( '.Tooltip-Wrapper', { timeout: 3000 } ).should( 'exist' );
cy.get( '.Tooltip-Tip', { timeout: 3000 } )
.should( 'be.visible' )
.should( 'contain', Tooltiptext2 );
cy.get( '.navigation-buttons_next' ).click();
cy.get( '.components-modal__content' ).should( 'be.visible' );
cy.get( '.components-modal__header-heading' ).should(
'have.text',
ModalText2
);

// cy.get( '.components-modal__content' ).type( '{esc}' );
cy.get( '.components-modal__header button' , { timeout: customCommandTimeout } ).click()
cy.get(
'.browser-content_social_icon[style="background-image: var(--facebook-icon);"]'
).should( 'have.css', 'opacity', '0.75' );


socialTest.focus();
socialTest.clear();
Expand All @@ -207,7 +217,6 @@ describe( 'Basic Info Page', function () {
cy
.get( '.image-uploader_window-reset-btn' )
.should( 'exist' )
.contains( 'UPLOAD' )
) {
cy.get( '.image-uploader_window-logo-icon-selected' ).should(
'not.exist'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
// <reference types="Cypress" />

const { GetPluginId } = require("../wp-module-support/pluginID.cy");

describe( 'Exit to WordPress', function () {
before( () => {
cy.visit( 'wp-admin/?page=nfd-onboarding#/wp-setup/step/basic-info' );
} );

it.skip( 'Go to the Page where the Drawer contains Exit to WordPress Button', () => {
it( 'Go to the Page where the Drawer contains Exit to WordPress Button', () => {
cy.get( '.nfd-onboarding-etw__trigger' ).click();
cy.get( '.components-modal__content' ).should( 'be.visible' );
} );

it.skip( 'Check if heading and paragraph content exists', () => {
it ('Check if the Exit modal opens up', () => {
cy.get( '.components-modal__content' ).should('be.visible');
cy.get( 'h1.components-modal__header-heading' ).should( 'be.visible' );
cy.get( '.components-modal__content > p' ).should( 'be.visible' );
} );

it.skip( "Stay on Onboarding Page when 'X'/Continue is clicked", () => {
it( "Stay on Onboarding Page when 'X'/Continue is clicked", () => {
cy.url().then( ( currUrl ) => {
// When 'X' is clicked
cy.get( '.components-modal__header > .components-button' ).click();
Expand All @@ -28,10 +30,9 @@ describe( 'Exit to WordPress', function () {
} );
} );

it.skip( 'Exit to WordPress Page', () => {
it( 'Exit to WordPress Page', () => {
cy.get( '.nfd-onboarding-etw__trigger' ).click();
cy.get( '.nfd-onboarding-etw__buttons > .is-primary' ).click();
cy.url( { timeout: 12000 } ).should( 'contain', 'index.php' );
cy.url( { timeout: 12000 } ).should( 'contain', GetPluginId() );
} );

} );
Loading

0 comments on commit aa8d9d9

Please sign in to comment.