Skip to content

Commit

Permalink
Merge pull request #324 from newfold-labs/update/tests
Browse files Browse the repository at this point in the history
Update/tests
  • Loading branch information
aratidgr8 authored Jun 26, 2024
2 parents d3737fe + bb0ee79 commit 9fba36e
Show file tree
Hide file tree
Showing 15 changed files with 634 additions and 625 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/brand-plugin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
needs: setup
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
with:
only-module-tests: true
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'bluehost/bluehost-wordpress-plugin'
Expand All @@ -41,7 +40,6 @@ jobs:
needs: setup
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
with:
only-module-tests: true
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'newfold-labs/wp-plugin-hostgator'
Expand All @@ -53,7 +51,6 @@ jobs:
needs: setup
uses: newfold-labs/workflows/.github/workflows/module-plugin-test.yml@main
with:
only-module-tests: true
module-repo: ${{ github.repository }}
module-branch: ${{ needs.setup.outputs.branch }}
plugin-repo: 'newfold-labs/wp-plugin-crazy-domains'
Expand Down
3 changes: 1 addition & 2 deletions build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<?php return array('dependencies' => array('lodash', 'moment', 'react', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'befd0e22adb79ae95781');

<?php return array('dependencies' => array('lodash', 'moment', 'react', 'react-dom', 'wp-api-fetch', 'wp-data', 'wp-date', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => 'fcffdffca026344a7b49');
3 changes: 2 additions & 1 deletion src/components/OnboardingList.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ function OnboardingCheckListItem({ children, actions, state, ...props }) {
"nfd-py-4 nfd-px-5",
"nfd-text-sm nfd-no-underline"
)}
data-testid={props.id}
target={state?.target || "_self"}
href={state.url}
{...(actions.manage && !manageAction.isMutating
Expand Down Expand Up @@ -124,7 +125,7 @@ export function OnboardingList(props) {
</div>
)}
{itemsToDisplay.length > 0 && (
<Card as="ul" className="nfd-p-0">
<Card as="ul" className="nfd-p-0" id="onboarding-list">
{itemsToDisplay.map((item) => (
<OnboardingCheckListItem key={item.name} {...item} />
))}
Expand Down
4 changes: 2 additions & 2 deletions src/components/WooCommerceUnavailable.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ export function WooCommerceUnavailable(props) {
<div className="nfd-bg-canvas nfd-rounded-lg nfd-border nfd-border-solid nfd-border-line">
<div className="nfd-px-4 nfd-py-2 nfd-flex nfd-items-center nfd-rounded-lg">
<div className="nfd-flex-1">
<Title size="4" className="nfd-leading-normal">
<Title size="4" className="nfd-leading-normal" data-testid="nfd-nowoo-store-title">
{__("Add a store to your site for FREE!", "wp-module-ecommerce")}
</Title>
<span className="nfd-whitespace-pre-wrap">
<span className="nfd-whitespace-pre-wrap" data-testid="nfd-nowoo-store-description">
{__(
"Adding a store to your website is quick and easy! \nJust install the free WooCommerce plugin and get ready to start making money!",
"wp-module-ecommerce"
Expand Down
16 changes: 16 additions & 0 deletions src/configs/OnboardingList.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export function OnboardingListDefinition(props) {
cards: [
{
name: "Update your website nameservers",
id: "nameservers",
text: __(
"Update your website nameservers",
"wp-module-ecommerce"
Expand All @@ -104,6 +105,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Connect this site to your domain",
id: "domain",
text: __(
"Connect this site to your domain",
"wp-module-ecommerce"
Expand All @@ -127,6 +129,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Need help with these steps?",
id: "help",
text: __(
"Need help with these steps?",
"wp-module-ecommerce"
Expand All @@ -148,6 +151,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Continue with store setup",
id: "continue",
text: __(
"Continue with store setup",
"wp-module-ecommerce"
Expand All @@ -166,6 +170,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Sign up for Bluehost WordPress Academy",
id: "academy",
text: __(
"Sign up for Bluehost WordPress Academy",
"wp-module-ecommerce"
Expand All @@ -187,6 +192,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "New Order Received",
id: "neworder",
text: __(
"New Order Received",
"wp-module-ecommerce"
Expand All @@ -204,6 +210,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Add your store info",
id: "storeinfo",
text: __("Add your store info", "wp-module-ecommerce"),
state: {
isAvailable: (queries) => queries?.plugins?.isWCActive,
Expand All @@ -219,6 +226,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Connect a payment processor",
id: "paymentprocessor",
text: __("Connect a payment processor", "wp-module-ecommerce"),
state: {
isAvailable: (queries) =>
Expand All @@ -243,6 +251,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Setup shipping options",
id: "shipping",
text: __("Setup shipping options", "wp-module-ecommerce"),
state: {
isAvailable: (queries) =>
Expand All @@ -263,6 +272,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Configure tax settings",
id: "tax",
text: __("Configure tax settings", "wp-module-ecommerce"),
state: {
isAvailable: (queries) => queries?.plugins?.isWCActive,
Expand All @@ -278,6 +288,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Add a product",
id: "addproduct",
text: __("Add a product", "wp-module-ecommerce"),
state: {
isActive: (queries) => queries?.plugins?.isWCActive,
Expand All @@ -294,6 +305,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Sign up for Yoast SEO Academy",
id: "seoacademy",
text: __("Sign up for Yoast SEO Academy", "wp-module-ecommerce"),
state: {
isAvailable: (queries) => queries?.settings?.isNovice,
Expand All @@ -310,6 +322,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Add a new page to your site",
id: "newpage",
text: NewfoldRuntime.hasCapability("isEcommerce")
? __("Add a new page to your store", "wp-module-ecommerce")
: __("Add a new page to your site", "wp-module-ecommerce"),
Expand All @@ -332,6 +345,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Upload media to your site",
id: "media",
text: __("Upload media to your site", "wp-module-ecommerce"),
state: {
isCompleted: (queries) => queries?.media,
Expand All @@ -350,6 +364,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Connect to your social media accounts",
id: "social",
text: __(
"Connect to your social media accounts",
"wp-module-ecommerce"
Expand All @@ -374,6 +389,7 @@ export function OnboardingListDefinition(props) {
},
{
name: "Enable Jetpack to connect to your social media accounts",
id: "jetpack",
text: __(
"Enable Jetpack to connect to your social media accounts",
"wp-module-ecommerce"
Expand Down
90 changes: 90 additions & 0 deletions tests/cypress/integration/Home/ecommerce-coming-soon.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { GetPluginId } from '../wp-module-support/pluginID.cy';
import {
wpLogin,
comingSoon,
uninstallPlugins,
} from '../wp-module-support/utils.cy';
import { EventsAPI, APIList } from '../wp-module-support/eventsAPIs.cy';

const customCommandTimeout = 20000;
const pluginId = GetPluginId();
const hg_region = 'br';

describe(
'e-commerce Home Page- Coming soon mode',
{ testIsolation: true },
() => {
beforeEach( () => {
wpLogin();
uninstallPlugins();
comingSoon( true );
cy.visit( '/wp-admin/admin.php?page=' + pluginId + '#/home' );
} );

it( 'Verify Congrats on your new site message, coming soon alert', () => {
cy.get( '.nfd-gap-4 .nfd-title.nfd-title--2', {
timeout: customCommandTimeout,
} )
.eq( 0 )
.should( 'exist' );
cy.get( '.nfd-alert.nfd-alert--warning', {
timeout: customCommandTimeout,
} )
.as( 'comingsoonalert' )
.should( 'exist' );
cy.get( '@comingsoonalert' )
.find( '.nfd-validation-icon' )
.should( 'exist' );
cy.get( '@comingsoonalert' )
.find( '.nfd-validation-message' )
.should( 'exist' );
} );

it( 'Verify Site Preview flex and View your site option', () => {
cy.get( '.nfd-justify-start > .nfd-flex-col > .nfd-absolute', {
timeout: customCommandTimeout,
} )
.as( 'sitePreviewFlex' )
.should( 'exist' );
cy.get( '@sitePreviewFlex' )
.trigger( 'mouseover' )
.find( '[data-cy="view-site"]' )
.should( 'exist' )
.invoke( 'removeAttr', 'target' )
.click();
cy.url().should( 'eq', Cypress.config().baseUrl + '/' );
cy.go( 'back' );
} );

it( 'Verify presense of Ready to go to live? canvas', () => {
cy.get( '.nfd-px-4', { timeout: customCommandTimeout } )
.as( 'readyToGoNextLevel' )
.should( 'exist' );
cy.get( '@readyToGoNextLevel', { timeout: customCommandTimeout } )
.find( '.nfd-flex-1 h1' )
.should( 'exist' );
cy.get( '@readyToGoNextLevel' )
.find( '.nfd-flex-1 span' )
.should( 'exist' );
cy.get( '@readyToGoNextLevel', { timeout: customCommandTimeout } )
.find( '#view-site' )
.should( 'exist' );
cy.get( '@readyToGoNextLevel' )
.find( '#launch-site' )
.should( 'exist' );
} );

it( 'Verify Visit your site and Launch your site functionality', () => {
cy.get( '.nfd-flex-none > .nfd-button--secondary', {
timeout: customCommandTimeout,
} )
.invoke( 'removeAttr', 'target' )
.click();
cy.url().should( 'eq', Cypress.config().baseUrl + '/' );
cy.go( 'back' );
cy.get( '.nfd-flex-none > .nfd-button--upsell' ).click();
cy.get('[data-testid="siteStatus"]').should('not.exist');
cy.get( '.nfd-notification--success' ).should( 'exist' );
} );
}
);
40 changes: 40 additions & 0 deletions tests/cypress/integration/Home/ecommerce-live.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { GetPluginId } from '../wp-module-support/pluginID.cy';
import {
wpLogin,
comingSoon,
uninstallPlugins,
} from '../wp-module-support/utils.cy';

const customCommandTimeout = 20000;
const pluginId = GetPluginId();

describe( 'e-commerce Home Page- Live Mode', { testIsolation: true }, () => {
beforeEach( () => {
wpLogin();
uninstallPlugins();
comingSoon( false );
cy.visit( '/wp-admin/admin.php?page=' + pluginId + '#/home' );
} );

it( 'Verify presense of Ready to go to next level? canvas', () => {
cy.get( '.nfd-flex.nfd-gap-4', { timeout: customCommandTimeout } )
.eq( 2 )
.as( 'readyToGoNextLevel' )
.should( 'exist' );
cy.get( '@readyToGoNextLevel', { timeout: customCommandTimeout } )
.find( 'h1' )
.should( 'exist' );
cy.get( '@readyToGoNextLevel' ).find( 'div span' ).should( 'exist' );
} );

it( 'Verify by default View Site option should be displayed', () => {
cy.get( '.nfd-button--primary', {
timeout: customCommandTimeout,
} )
.eq( 1 )
.should( 'exist' )
.invoke( 'removeAttr', 'target' )
.click();
cy.url().should( 'eq', Cypress.config().baseUrl + '/' );
} );
} );
Loading

0 comments on commit 9fba36e

Please sign in to comment.