- { title }
+ { decodeEntities( title ) }
diff --git a/src/app/components/webinars-banner/index.js b/src/app/components/webinars-banner/index.js
index 0a42a4b3e..c6868a70e 100644
--- a/src/app/components/webinars-banner/index.js
+++ b/src/app/components/webinars-banner/index.js
@@ -1,12 +1,11 @@
import { useState, useEffect } from '@wordpress/element';
-import { Button, Title } from '@newfold/ui-component-library';
+import { Button, Container, Title } from '@newfold/ui-component-library';
import {
ArrowRightIcon,
CalendarIcon,
ClockIcon,
} from '@heroicons/react/24/outline';
import { ReactComponent as WebinarsVector } from 'App/images/webinars-vector.svg';
-import { SectionContainer, SectionContent } from 'App/components/section';
/**
* A component that displays the next monthly webinar.
@@ -106,8 +105,8 @@ const WebinarsBanner = () => {
}
return (
-
-
+
+
@@ -173,8 +172,8 @@ const WebinarsBanner = () => {
-
-
+
+
);
};
diff --git a/src/app/data/routes.js b/src/app/data/routes.js
index 33d4a36c7..53ead493d 100644
--- a/src/app/data/routes.js
+++ b/src/app/data/routes.js
@@ -31,15 +31,17 @@ export const AppRoutes = () => {
return (
{ routes.map( ( page ) => (
- }
- />
+ true === page.condition && (
+ }
+ />
+ )
) ) }
} />
{
diff --git a/src/app/pages/help/index.js b/src/app/pages/help/index.js
index fd0961d18..b1e0db6aa 100644
--- a/src/app/pages/help/index.js
+++ b/src/app/pages/help/index.js
@@ -1,10 +1,10 @@
-import { Button, Card, Title } from '@newfold/ui-component-library';
-import { Page } from 'App/components/page';
import {
- SectionContainer,
- SectionContent,
- SectionHeader,
-} from 'App/components/section';
+ Button,
+ Card,
+ Container,
+ Page,
+ Title,
+} from '@newfold/ui-component-library';
import help from 'App/data/help';
const HelpCard = ( { item } ) => {
@@ -46,17 +46,17 @@ const Help = () => {
};
return (
-
-
+
- { renderHelpCards() }
-
+ { renderHelpCards() }
+
);
};
diff --git a/src/app/pages/help/stylesheet.scss b/src/app/pages/help/stylesheet.scss
deleted file mode 100644
index 66ddbf4d2..000000000
--- a/src/app/pages/help/stylesheet.scss
+++ /dev/null
@@ -1,17 +0,0 @@
-.card-help {
- text-align: center;
- flex-grow: 2;
-
- .components-card-header,
- .components-card-footer {
- flex-direction: column;
- justify-content: end;
- }
-
- /* <= WP 5.8 */
- .components-card__header,
- .components-card__footer {
- justify-content: center;
- }
-
-}
\ No newline at end of file
diff --git a/src/app/pages/home/index.js b/src/app/pages/home/index.js
index 22232a333..bd7f2254c 100644
--- a/src/app/pages/home/index.js
+++ b/src/app/pages/home/index.js
@@ -1,6 +1,4 @@
-import './stylesheet.scss';
-import { Page } from 'App/components/page';
-import { SectionContainer, SectionContent } from 'App/components/section';
+import { Container, Page } from '@newfold/ui-component-library';
import WebinarsBanner from 'App/components/webinars-banner';
import AccountCard from './accountCard';
import HelpCard from './helpCard';
@@ -11,14 +9,14 @@ const Home = () => {
-
-
+
+
-
-
+
+
);
};
diff --git a/src/app/pages/home/stylesheet.scss b/src/app/pages/home/stylesheet.scss
deleted file mode 100644
index ace83d4b9..000000000
--- a/src/app/pages/home/stylesheet.scss
+++ /dev/null
@@ -1,123 +0,0 @@
-.wppbh-section {
- margin: 0 0 2rem;
- position: relative;
-
- .components-card__header {
- background: var(--color-off-white);
- border: 1px solid var(--color-border);
- flex-direction: column;
- @media screen and (min-width: 1132px) {
- flex-direction: row;
- }
- .heading {
- color: var(--color-title);
- font-size: 1.5rem;
- margin-bottom: 0 !important; // wp core override
- @media screen and (min-width: 1132px) {
- margin-bottom: 24px !important;
- }
- }
- p {
- color: var(--color-text);
- font-weight: 700;
- margin-left: 0;
- }
- }
- .components-card__footer {
- .heading {
- display: flex;
- align-items: center;
- svg,
- .dashicons {
- margin-right: 4px;
- }
- }
- }
-
-
- &.wppbh-section-coming-soon {
-
- .wppbh-section-graphic {
- top: -3rem;
- right: -6rem;
- }
- }
-
- &:first-of-type { // allows for better reordering and injection
- margin-top: 1rem;
- }
-}
-
-.section-graphic {
- position: absolute;
- right: 0;
- top: 2rem;
- transition: all .5s ease;
- z-index: 0;
- display: none;
- @media screen and (min-width: 882px) {
- display: block;
- max-width: 260px;
- }
- @media screen and (min-width: 1190px) {
- max-width: 330px;
- }
- @media screen and (min-width: 1399px) {
- max-width: 400px;
- }
-
- &.reverse {
- transform: rotateY(180deg);
- @media(prefers-reduced-motion) {
- transform: none;
- }
- }
-}
-
-.wppbh-section-card {
- position: relative;
- z-index: 1;
-
- @media screen and (min-width: 882px) {
- max-width: 66%;
- }
-
- .components-card__footer {
- flex-direction: column;
-
- .wppbh-cardlist-content {
- width: 100%;
- .components-heading {
- display: flex;
- align-items: center;
- .dashicons, svg {
- margin-right: 8px;
- color: var(--color-primary);
- fill: var(--color-primary);
- }
- }
- @media screen and (max-width: 700px) {
- text-align: center;
- .components-heading {
- justify-content: center;
- }
- }
- }
-
- .components-button {
- margin: 1rem auto;
- }
-
- @media screen and (min-width: 700px) {
- flex-direction: row;
-
- .wppbh-cardlist-content {
- max-width: 60%;
- }
-
- .components-button {
- margin: 0;
- }
- }
- }
-}
\ No newline at end of file
diff --git a/src/app/pages/marketplace/index.js b/src/app/pages/marketplace/index.js
index ec617adcc..02e8cf6f6 100644
--- a/src/app/pages/marketplace/index.js
+++ b/src/app/pages/marketplace/index.js
@@ -2,12 +2,7 @@ import apiFetch from '@wordpress/api-fetch';
import { useState, useEffect } from '@wordpress/element';
import { useLocation } from 'react-router-dom';
import classnames from 'classnames';
-import { Page } from 'App/components/page';
-import {
- SectionContainer,
- SectionHeader,
- SectionContent,
-} from 'App/components/section';
+import { Container, Page } from '@newfold/ui-component-library';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
// component sourced from marketplace module
import { default as NewfoldMarketplace } from '@modules/wp-module-marketplace/components/marketplace/';
@@ -44,20 +39,14 @@ const MarketplacePage = () => {
NewfoldRuntime,
};
- const moduleComponents = {
- SectionHeader,
- SectionContent,
- };
-
return (
-
+
-
+
);
};
diff --git a/src/app/pages/performance/index.js b/src/app/pages/performance/index.js
index b5afd1e6f..d1b4e3b32 100644
--- a/src/app/pages/performance/index.js
+++ b/src/app/pages/performance/index.js
@@ -1,21 +1,15 @@
-import AppStore from '../../data/store';
-import { Page } from '../../components/page';
-import { useState, useEffect, useContext, Fragment } from '@wordpress/element';
import apiFetch from '@wordpress/api-fetch';
-import classnames from 'classnames';
+import { useState, useEffect, useContext, Fragment } from '@wordpress/element';
import { useUpdateEffect } from 'react-use';
+import classnames from 'classnames';
+import { Container, Page } from '@newfold/ui-component-library';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
-import {
- SectionContainer,
- SectionHeader,
- SectionContent,
- SectionSettings,
-} from 'App/components/section';
-import { useNotification } from 'App/components/notifications';
+import AppStore from '../../data/store';
import {
bluehostSettingsApiFetch as newfoldSettingsApiFetch,
bluehostPurgeCacheApiFetch as newfoldPurgeCacheApiFetch,
} from 'App/util/helpers';
+import { useNotification } from 'App/components/notifications';
import { default as NewfoldPerformance } from '@modules/wp-module-performance/components/performance/';
@@ -39,20 +33,15 @@ const PerformancePage = () => {
};
const moduleComponents = {
- Page,
- SectionHeader,
- SectionContent,
- SectionSettings,
- SectionContainer,
Fragment,
};
return (
-
-
+ {
methods={ moduleMethods }
Components={ moduleComponents }
/>
-
+
);
};
diff --git a/src/app/pages/settings/automaticUpdates.js b/src/app/pages/settings/automaticUpdates.js
index 0758c2fa2..0d67ee273 100644
--- a/src/app/pages/settings/automaticUpdates.js
+++ b/src/app/pages/settings/automaticUpdates.js
@@ -1,9 +1,8 @@
import { useState } from '@wordpress/element';
import { useUpdateEffect } from 'react-use';
-import { Alert, ToggleField } from '@newfold/ui-component-library';
+import { Alert, Container, ToggleField } from '@newfold/ui-component-library';
import AppStore from '../../data/store';
import { bluehostSettingsApiFetch } from '../../util/helpers';
-import { SectionSettings } from 'App/components/section';
import { useNotification } from 'App/components/notifications';
const AutomaticUpdatesAll = ( { setError, notify } ) => {
@@ -89,7 +88,10 @@ const AutomaticUpdatesAll = ( { setError, notify } ) => {
return (
@@ -286,7 +288,7 @@ const AutomaticUpdates = () => {
const notify = useNotification();
return (
- {
) }
-
+
);
};
diff --git a/src/app/pages/settings/comingSoon.js b/src/app/pages/settings/comingSoon.js
index de0d710cd..9243541ba 100644
--- a/src/app/pages/settings/comingSoon.js
+++ b/src/app/pages/settings/comingSoon.js
@@ -1,12 +1,11 @@
import { useState } from '@wordpress/element';
import { useUpdateEffect } from 'react-use';
-import { Alert, ToggleField } from '@newfold/ui-component-library';
+import { Alert, Container, ToggleField } from '@newfold/ui-component-library';
import AppStore from '../../data/store';
import {
bluehostSettingsApiFetch,
comingSoonAdminbarToggle,
} from '../../util/helpers';
-import { SectionSettings } from 'App/components/section';
import { useNotification } from 'App/components/notifications';
const ComingSoon = () => {
@@ -67,11 +66,11 @@ const ComingSoon = () => {
const getComingSoonSectionTitle = () => {
const getStatus = () => {
return comingSoon ? (
-
- { __( 'Coming Soon', 'wp-plugin-bluehost' ) }
+
+ { __( 'Not Live', 'wp-plugin-bluehost' ) }
) : (
-
+
{ __( 'Live', 'wp-plugin-bluehost' ) }
);
@@ -84,18 +83,27 @@ const ComingSoon = () => {
);
};
+ const getComingSoonSectionDescription = () => {
+ return comingSoon
+ ? __(
+ 'Turn off your "Coming Soon" page when you are ready to launch your website.',
+ 'wp-plugin-bluehost'
+ )
+ : __(
+ 'Turn on your "Coming Soon" page when you need to make major changes to your website.',
+ 'wp-plugin-bluehost'
+ );
+ };
+
return (
-
{
) }
-
+
);
};
diff --git a/src/app/pages/settings/commentSettings.js b/src/app/pages/settings/commentSettings.js
index fdd66e3a5..947542532 100644
--- a/src/app/pages/settings/commentSettings.js
+++ b/src/app/pages/settings/commentSettings.js
@@ -1,9 +1,13 @@
import { useState } from '@wordpress/element';
import { useUpdateEffect } from 'react-use';
-import { Alert, SelectField, ToggleField } from '@newfold/ui-component-library';
+import {
+ Alert,
+ Container,
+ SelectField,
+ ToggleField,
+} from '@newfold/ui-component-library';
import AppStore from '../../data/store';
import { bluehostSettingsApiFetch } from '../../util/helpers';
-import { SectionSettings } from 'App/components/section';
import { useNotification } from 'App/components/notifications';
const OldPostsComments = ( { setError, notify } ) => {
@@ -219,11 +223,7 @@ const CommentsPerPage = ( { setError, notify } ) => {
return (
-
+
);
};
diff --git a/src/app/pages/settings/contentSettings.js b/src/app/pages/settings/contentSettings.js
index 7beb8548a..ce63f8323 100644
--- a/src/app/pages/settings/contentSettings.js
+++ b/src/app/pages/settings/contentSettings.js
@@ -1,9 +1,8 @@
import { useState } from '@wordpress/element';
import { useUpdateEffect } from 'react-use';
-import { Alert, SelectField } from '@newfold/ui-component-library';
+import { Alert, Container, SelectField } from '@newfold/ui-component-library';
import AppStore from 'App/data/store';
import { bluehostSettingsApiFetch } from 'App/util/helpers';
-import { SectionSettings } from 'App/components/section';
import { useNotification } from 'App/components/notifications';
const ContentRevisions = ( { setError, notify } ) => {
@@ -78,7 +77,7 @@ const ContentRevisions = ( { setError, notify } ) => {
{
return (
{
const notify = useNotification();
return (
- {
) }
-
+
);
};
diff --git a/src/app/pages/settings/index.js b/src/app/pages/settings/index.js
index 2316d1e86..7609e234e 100644
--- a/src/app/pages/settings/index.js
+++ b/src/app/pages/settings/index.js
@@ -1,53 +1,54 @@
+import classNames from 'classnames';
+import { Container, Page } from '@newfold/ui-component-library';
+import useContainerBlockIsTarget from 'App/util/hooks/useContainerBlockTarget';
import AutomaticUpdates from './automaticUpdates';
-import ComingSoon from './comingSoon';
import CommentSettings from './commentSettings';
+import ComingSoon from './comingSoon';
import ContentSettings from './contentSettings';
-import { Page } from 'App/components/page';
-import {
- SectionContainer,
- SectionHeader,
- SectionContent,
-} from 'App/components/section';
const Settings = () => {
return (
-
-
+
-
-
+
-
-
+
-
-
+
-
+
-
-
+
+
);
};
diff --git a/src/app/pages/staging/index.js b/src/app/pages/staging/index.js
index f2f470699..f6ecbd651 100644
--- a/src/app/pages/staging/index.js
+++ b/src/app/pages/staging/index.js
@@ -3,13 +3,6 @@ import { useState, useEffect } from '@wordpress/element';
import apiFetch from '@wordpress/api-fetch';
import classnames from 'classnames';
import { NewfoldRuntime } from '@newfold-labs/wp-module-runtime';
-import { Page } from 'App/components/page';
-import {
- SectionContainer,
- SectionHeader,
- SectionContent,
- SectionSettings,
-} from 'App/components/section';
import { useNotification } from 'App/components/notifications';
// component sourced from staging module
import { default as NewfoldStaging } from '@modules/wp-module-staging/components/staging/';
@@ -32,17 +25,8 @@ const Staging = () => {
useNotification,
};
- const moduleComponents = {
- Page,
- SectionHeader,
- SectionContent,
- SectionSettings,
- SectionContainer,
- };
-
return (
diff --git a/src/app/stylesheet.scss b/src/app/stylesheet.scss
index 3eba336ab..7306fd98c 100644
--- a/src/app/stylesheet.scss
+++ b/src/app/stylesheet.scss
@@ -278,3 +278,7 @@ body.toplevel_page_bluehost {
background-color: #e9f1fd;
}
}
+
+.coming-soon-status {
+ text-transform: uppercase;
+}
\ No newline at end of file
diff --git a/src/app/util/helpers.js b/src/app/util/helpers.js
index 566ffebee..4d01f34d2 100644
--- a/src/app/util/helpers.js
+++ b/src/app/util/helpers.js
@@ -74,19 +74,7 @@ export const bluehostPurgeCacheApiFetch = ( data, passError, thenCallback ) => {
* @param {boolean} comingSoon Whether or not the site is coming soon.
*/
export const comingSoonAdminbarToggle = ( comingSoon ) => {
- const comingsoonadminbar = document.getElementById(
- 'nfd-site-status-text'
- );
- if ( ! comingsoonadminbar ) {
- return;
- }
- if ( ! comingSoon ) {
- comingsoonadminbar.style.color = '#048200';
- comingsoonadminbar.textContent = 'Live';
- } else {
- comingsoonadminbar.style.color = '#E01C1C';
- comingsoonadminbar.textContent = 'Coming Soon';
- }
+ window.NewfoldRuntime.comingSoon.toggleAdminBarSiteStatus( comingSoon );
};
/**
diff --git a/src/app/util/hooks/useContainerBlockTarget.js b/src/app/util/hooks/useContainerBlockTarget.js
new file mode 100644
index 000000000..2c7c2bcc0
--- /dev/null
+++ b/src/app/util/hooks/useContainerBlockTarget.js
@@ -0,0 +1,43 @@
+import { useEffect, useState } from '@wordpress/element';
+
+/**
+ * Checks if the container block is the target element based on the query param.
+ * If true, the hook will return that boolean value for a few seconds.
+ * The hook will set the value to false and remove the query param.
+ *
+ * @param {string} id - the container block id, used to check if it's the target.
+ * @return {boolean} - true if the container block is the target.
+ */
+const useContainerBlockIsTarget = ( id ) => {
+ const [ isTarget, setIsTarget ] = useState( false );
+ const searchParams = new URLSearchParams( window.location.search );
+
+ useEffect( () => {
+ if (
+ searchParams.has( 'nfd-target' ) &&
+ searchParams.get( 'nfd-target' ) === id
+ ) {
+ setIsTarget( true );
+
+ setTimeout( () => {
+ setIsTarget( false );
+ removeTargetQueryParam();
+ }, 9500 );
+ }
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, [ searchParams ] );
+
+ /*
+ * Remove the 'nfd-target={id}' query param from the URL
+ */
+ const removeTargetQueryParam = () => {
+ searchParams.delete( 'nfd-target' );
+ const currentURL = window.location.href;
+ const updatedURL = currentURL.replace( `&nfd-target=${ id }`, '' );
+ window.history.replaceState( null, null, updatedURL );
+ };
+
+ return isTarget;
+};
+
+export default useContainerBlockIsTarget;
diff --git a/src/app/util/hooks/useHandlePageLoad.js b/src/app/util/hooks/useHandlePageLoad.js
index ff64f706a..d90843fff 100644
--- a/src/app/util/hooks/useHandlePageLoad.js
+++ b/src/app/util/hooks/useHandlePageLoad.js
@@ -1,5 +1,9 @@
import { useLocation } from 'react-router-dom';
+/**
+ * Scrolls to top of page on route change.
+ * @return {boolean} - true
+ */
const useHandlePageLoad = () => {
const location = useLocation();
const routeContents = document.querySelector( '.wppbh-app-body-inner' );
diff --git a/tests/cypress/fixtures/notifications.json b/tests/cypress/fixtures/plugin-notifications.json
similarity index 100%
rename from tests/cypress/fixtures/notifications.json
rename to tests/cypress/fixtures/plugin-notifications.json
diff --git a/tests/cypress/fixtures/products.json b/tests/cypress/fixtures/plugin-products.json
similarity index 100%
rename from tests/cypress/fixtures/products.json
rename to tests/cypress/fixtures/plugin-products.json
diff --git a/tests/cypress/integration/help.cy.js b/tests/cypress/integration/help.cy.js
index aecfab265..90fb39024 100644
--- a/tests/cypress/integration/help.cy.js
+++ b/tests/cypress/integration/help.cy.js
@@ -1,63 +1,87 @@
//
+const pluginNotificationsFixture = require( '../fixtures/plugin-notifications.json' );
+const pluginProductsFixture = require( '../fixtures/plugin-products.json' );
-describe('Help Page', function () {
-
- before(() => {
- cy.visit('/wp-admin/admin.php?page=' + Cypress.env('pluginId') + '#/help');
- });
-
- it('Is Accessible', () => {
+describe( 'Help Page', function () {
+ before( () => {
+ cy.intercept(
+ {
+ method: 'GET',
+ url: /newfold-marketplace(\/|%2F)v1(\/|%2F)marketplace/,
+ },
+ pluginProductsFixture
+ ).as( 'pluginProductsFixture' );
+ cy.intercept(
+ {
+ method: 'GET',
+ url: /newfold-notifications(\/|%2F)v1(\/|%2F)notifications/,
+ },
+ pluginNotificationsFixture
+ ).as( 'pluginNotificationsFixture' );
+ cy.visit(
+ '/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) + '#/help',
+ { timeout: 30000 }
+ );
cy.injectAxe();
- cy.wait(500);
- cy.checkA11y('.wppbh-app-body');
- });
+ } );
- it('Phone Card Exists', () => {
- cy.get('.card-help-phone').contains('h3', 'Phone')
- .scrollIntoView()
- .should('be.visible');
- });
+ it( 'Is Accessible', () => {
+ cy.checkA11y( '.wppbh-app-body' );
+ } );
- it('Chat Card Exists', () => {
- cy.get('.card-help-chat').contains('h3', 'Chat')
+ it( 'Phone Card Exists', () => {
+ cy.get( '.card-help-phone' )
+ .contains( 'h3', 'Phone' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Tweet Card Exists', () => {
- cy.get('.card-help-twitter').contains('h3', 'Tweet')
+ it( 'Chat Card Exists', () => {
+ cy.get( '.card-help-chat' )
+ .contains( 'h3', 'Chat' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Youtube Card Exists', () => {
- cy.get('.card-help-youtube').contains('h3', 'YouTube')
+ it( 'Tweet Card Exists', () => {
+ cy.get( '.card-help-twitter' )
+ .contains( 'h3', 'Tweet' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Online Support Card Exists', () => {
- cy.get('.card-help-kb').contains('h3', 'Knowledge Base')
+ it( 'Youtube Card Exists', () => {
+ cy.get( '.card-help-youtube' )
+ .contains( 'h3', 'YouTube' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Resources Card Exists', () => {
- cy.get('.card-help-resources').contains('h3', 'Resources')
+ it( 'Online Support Card Exists', () => {
+ cy.get( '.card-help-kb' )
+ .contains( 'h3', 'Knowledge Base' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Events Card Exists', () => {
- cy.get('.card-help-events').contains('h3', 'Events and Webinars')
+ it( 'Resources Card Exists', () => {
+ cy.get( '.card-help-resources' )
+ .contains( 'h3', 'Resources' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Website Card Exists', () => {
- cy.get('.card-help-website').contains('h3', 'Bluehost Website')
+ it( 'Events Card Exists', () => {
+ cy.get( '.card-help-events' )
+ .contains( 'h3', 'Events and Webinars' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
-});
+ it( 'Website Card Exists', () => {
+ cy.get( '.card-help-website' )
+ .contains( 'h3', 'Bluehost Website' )
+ .scrollIntoView()
+ .should( 'be.visible' );
+ } );
+} );
diff --git a/tests/cypress/integration/home.cy.js b/tests/cypress/integration/home.cy.js
index 429dee3d7..a1a924c9f 100644
--- a/tests/cypress/integration/home.cy.js
+++ b/tests/cypress/integration/home.cy.js
@@ -1,133 +1,138 @@
//
-describe('Home Page', function () {
+describe( 'Home Page', function () {
let NewfoldRuntime;
- before(() => {
- cy.visit('/wp-admin/admin.php?page=' + Cypress.env('pluginId') + '#/home');
- cy.window().its('NewfoldRuntime').then(data => {
- NewfoldRuntime = data;
- });
+ before( () => {
+ cy.visit(
+ '/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) + '#/home'
+ );
+ cy.window()
+ .its( 'NewfoldRuntime' )
+ .then( ( data ) => {
+ NewfoldRuntime = data;
+ } );
cy.injectAxe();
- });
+ } );
- it('Site Info Exists', () => {
- cy
- .get('.wppbh-app-site-info').contains('h3', NewfoldRuntime.site.title)
+ it( 'Site Info Exists', () => {
+ cy.get( '.wppbh-app-site-info' )
+ .contains( 'h3', NewfoldRuntime.site.title )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Is Accessible', () => {
- cy.wait(500);
- cy.checkA11y('.wppbh-app-body');
- });
+ it( 'Is Accessible', () => {
+ cy.wait( 500 );
+ cy.checkA11y( '.wppbh-app-body' );
+ } );
- it('Welcome Section Exists', () => {
- cy
- .get('.nfd-app-section-container').contains('h2', 'Home')
+ it( 'Welcome Section Exists', () => {
+ cy.get( '.nfd-app-section-container' )
+ .contains( 'h2', 'Home' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it.skip('Additional Features Section Exists', () => {
- cy
- .get('.nfd-app-section-container').contains('h2', 'Additional Features')
+ it.skip( 'Additional Features Section Exists', () => {
+ cy.get( '.nfd-app-section-container' )
+ .contains( 'h2', 'Additional Features' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Account Section Exists', () => {
- cy
- .get('.wppbh-account-help-section').contains('h1', 'Bluehost Account')
+ it( 'Account Section Exists', () => {
+ cy.get( '.wppbh-account-help-section' )
+ .contains( 'h1', 'Bluehost Account' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Help Section Exists', () => {
- cy
- .get('.wppbh-account-help-section').contains('h1', 'Need some help?')
+ it( 'Help Section Exists', () => {
+ cy.get( '.wppbh-account-help-section' )
+ .contains( 'h1', 'Need some help?' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Webinars Section Exists', () => {
+ it( 'Webinars Section Exists', () => {
cy.intercept(
- 'https://cdn.hiive.space/resources/bluehost-webinars.json',
+ 'https://cdn.hiive.space/resources/bluehost-webinars.json',
{ fixture: 'webinars.json' }
);
cy.reload();
- cy
- .get('.wppbh-webinars-banner-section').contains('h2', 'FREE Monthly Webinar: Build your brand with WordPress')
+ cy.get( '.wppbh-webinars-banner-section' )
+ .contains(
+ 'h2',
+ 'FREE Monthly Webinar: Build your brand with WordPress'
+ )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Webinars Section Renders Correctly', () => {
+ it( 'Webinars Section Renders Correctly', () => {
// Title
- cy
- .get('.wppbh-webinars-banner-section')
- .contains('h2', 'FREE Monthly Webinar: Build your brand with WordPress')
+ cy.get( '.wppbh-webinars-banner-section' )
+ .contains(
+ 'h2',
+ 'FREE Monthly Webinar: Build your brand with WordPress'
+ )
.scrollIntoView()
- .should('be.visible');
-
+ .should( 'be.visible' );
+
// Description
- cy
- .get('.wppbh-webinars-banner-section p:first-of-type')
- .contains('Join us for a free webinar on how to build your brand with WordPress.')
+ cy.get( '.wppbh-webinars-banner-section p:first-of-type' )
+ .contains(
+ 'Join us for a free webinar on how to build your brand with WordPress.'
+ )
.scrollIntoView()
- .should('be.visible');
+ .should( 'be.visible' );
// Topics
- cy
- .get('.wppbh-webinars-banner-section h3')
- .contains('Topics:')
+ cy.get( '.wppbh-webinars-banner-section h3' )
+ .contains( 'Topics:' )
.scrollIntoView()
- .should('be.visible');
+ .should( 'be.visible' );
// Date
- cy
- .get('.wppbh-webinars-banner-section')
- .contains('August 31, 2040')
+ cy.get( '.wppbh-webinars-banner-section' )
+ .contains( 'August 31, 2040' )
.scrollIntoView()
- .should('be.visible');
+ .should( 'be.visible' );
// Time
- cy
- .get('.wppbh-webinars-banner-section')
- .contains('1pm - 2pm EST')
+ cy.get( '.wppbh-webinars-banner-section' )
+ .contains( '1pm - 2pm EST' )
.scrollIntoView()
- .should('be.visible');
+ .should( 'be.visible' );
// CTA
- cy
- .get('.wppbh-webinars-banner-section a:first-of-type')
- .contains('Register Now')
+ cy.get( '.wppbh-webinars-banner-section a:first-of-type' )
+ .contains( 'Register Now' )
.scrollIntoView()
- .should('be.visible')
- .should('have.attr', 'href')
- .and('include', 'https://www.bluehost.com/blog/events/next-event-post');
- });
-
- it('Webinars Section Doesn\'t Render When Active Propety is False', () => {
+ .should( 'be.visible' )
+ .should( 'have.attr', 'href' )
+ .and(
+ 'include',
+ 'https://www.bluehost.com/blog/events/next-event-post'
+ );
+ } );
+
+ it( "Webinars Section Doesn't Render When Active Propety is False", () => {
cy.intercept(
- 'https://cdn.hiive.space/resources/bluehost-webinars.json',
+ 'https://cdn.hiive.space/resources/bluehost-webinars.json',
{ fixture: 'webinars-inactive.json' }
);
cy.reload();
- cy
- .get('.wppbh-webinars-banner-section')
- .should('not.exist');
- });
+ cy.get( '.wppbh-webinars-banner-section' ).should( 'not.exist' );
+ } );
- it('Webinars Section Doesn\'t Render Items Are in the Past', () => {
+ it( "Webinars Section Doesn't Render Items Are in the Past", () => {
cy.intercept(
- 'https://cdn.hiive.space/resources/bluehost-webinars.json',
+ 'https://cdn.hiive.space/resources/bluehost-webinars.json',
{ fixture: 'webinars-past.json' }
);
cy.reload();
- cy
- .get('.wppbh-webinars-banner-section')
- .should('not.exist');
- });
-});
+ cy.get( '.wppbh-webinars-banner-section' ).should( 'not.exist' );
+ } );
+} );
diff --git a/tests/cypress/integration/navigation.cy.js b/tests/cypress/integration/navigation.cy.js
index c34e1c580..5a689f456 100644
--- a/tests/cypress/integration/navigation.cy.js
+++ b/tests/cypress/integration/navigation.cy.js
@@ -1,175 +1,166 @@
//
-describe('Navigation', function () {
-
- before(() => {
- cy.visit('/wp-admin/admin.php?page=' + Cypress.env('pluginId') );
- cy.injectAxe();
-
- });
-
- it('Admin submenu shouldn\'t exist inside app', () => {
- cy
- .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu')
- .should('not.exist');
- });
-
- it('Logo Links to home', () => {
- cy.get('.wppbh-logo-wrap').click();
- cy.wait(500);
- cy.hash().should('eq', '#/home');
- });
+describe( 'Navigation', function () {
+ before( () => {
+ cy.visit( '/wp-admin/admin.php?page=' + Cypress.env( 'pluginId' ) );
+ } );
+
+ it( "Admin submenu shouldn't exist inside app", () => {
+ cy.get( '#adminmenu #toplevel_page_bluehost ul.wp-submenu' ).should(
+ 'not.exist'
+ );
+ } );
+
+ it( 'Logo Links to home', () => {
+ cy.get( '.wppbh-logo-wrap' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/home' );
+ } );
// test main nav
- it('Main nav links properly navigates', () => {
- cy
- .get('.wppbh-app-navitem-Marketplace').
- should('not.have.class', 'active');
- cy.get('.wppbh-app-navitem-Marketplace').click();
- cy.wait(500);
- cy.hash().should('eq', '#/marketplace');
- cy
- .get('.wppbh-app-navitem-Marketplace')
- .should('have.class', 'active');
-
- cy.get('.wppbh-app-navitem-Performance').click();
- cy.wait(500);
- cy.hash().should('eq', '#/performance');
- cy
- .get('.wppbh-app-navitem-Performance')
- .should('have.class', 'active');
- cy
- .get('.wppbh-app-navitem-Marketplace')
- .should('not.have.class', 'active');
-
- cy.get('.wppbh-app-navitem-Settings').click();
- cy.wait(500);
- cy.hash().should('eq', '#/settings');
- });
-
- it('Subnav links properly navigates', () => {
-
- cy
- .get('.wppbh-app-navitem-Marketplace')
+ it( 'Main nav links properly navigates', () => {
+ cy.get( '.wppbh-app-navitem-Marketplace' ).should(
+ 'not.have.class',
+ 'active'
+ );
+ cy.get( '.wppbh-app-navitem-Marketplace' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/marketplace' );
+ cy.get( '.wppbh-app-navitem-Marketplace' ).should(
+ 'have.class',
+ 'active'
+ );
+
+ cy.get( '.wppbh-app-navitem-Performance' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/performance' );
+ cy.get( '.wppbh-app-navitem-Performance' ).should(
+ 'have.class',
+ 'active'
+ );
+ cy.get( '.wppbh-app-navitem-Marketplace' ).should(
+ 'not.have.class',
+ 'active'
+ );
+
+ cy.get( '.wppbh-app-navitem-Settings' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/settings' );
+ } );
+
+ it( 'Subnav links properly navigates', () => {
+ cy.get( '.wppbh-app-navitem-Marketplace' )
.scrollIntoView()
- .should('not.have.class', 'active');
- cy.get('.wppbh-app-navitem-Marketplace').click();
-
- cy.wait(500);
- cy.hash().should('eq', '#/marketplace');
- cy
- .get('.wppbh-app-navitem-Marketplace')
- .should('have.class', 'active');
-
- cy.get('.wppbh-app-subnavitem-Services').click();
- cy.wait(500);
- cy.hash().should('eq', '#/marketplace/services');
- cy
- .get('.wppbh-app-subnavitem-Services')
- .should('have.class', 'active');
- cy
- .get('.wppbh-app-navitem-Marketplace')
- .should('have.class', 'active');
-
-
- cy.get('.wppbh-app-subnavitem-SEO').click();
- cy.wait(500);
- cy.hash().should('eq', '#/marketplace/seo');
- cy
- .get('.wppbh-app-subnavitem-SEO')
- .should('have.class', 'active');
- cy
- .get('.wppbh-app-subnavitem-Services')
- .should('not.have.class', 'active');
- cy
- .get('.wppbh-app-navitem-Marketplace')
- .should('have.class', 'active');
-
- cy.get('.wppbh-app-navitem-Performance').click();
- cy.wait(500);
- cy
- .get('.wppbh-app-subnavitem-Services')
- .should('not.have.class', 'active');
- cy
- .get('.wppbh-app-subnavitem-SEO')
- .should('not.have.class', 'active');
- cy
- .get('.wppbh-app-navitem-Marketplace')
- .should('not.have.class', 'active');
- });
-
- it('Admin submenu exist outside the app', () => {
- cy.visit('/wp-admin/index.php');
- cy
- .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu')
- .should('exist');
- cy
- .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/home"]')
- .should('exist');
- cy
- .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/marketplace"]')
- .should('exist');
- cy
- .get('#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/settings"]')
- .should('exist');
- });
+ .should( 'not.have.class', 'active' );
+ cy.get( '.wppbh-app-navitem-Marketplace' ).click();
+
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/marketplace' );
+ cy.get( '.wppbh-app-navitem-Marketplace' ).should(
+ 'have.class',
+ 'active'
+ );
+
+ cy.get( '.wppbh-app-subnavitem-Services' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/marketplace/services' );
+ cy.get( '.wppbh-app-subnavitem-Services' ).should(
+ 'have.class',
+ 'active'
+ );
+ cy.get( '.wppbh-app-navitem-Marketplace' ).should(
+ 'have.class',
+ 'active'
+ );
+
+ cy.get( '.wppbh-app-subnavitem-SEO' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/marketplace/seo' );
+ cy.get( '.wppbh-app-subnavitem-SEO' ).should( 'have.class', 'active' );
+ cy.get( '.wppbh-app-subnavitem-Services' ).should(
+ 'not.have.class',
+ 'active'
+ );
+ cy.get( '.wppbh-app-navitem-Marketplace' ).should(
+ 'have.class',
+ 'active'
+ );
+
+ cy.get( '.wppbh-app-navitem-Performance' ).click();
+ cy.wait( 500 );
+ cy.get( '.wppbh-app-subnavitem-Services' ).should(
+ 'not.have.class',
+ 'active'
+ );
+ cy.get( '.wppbh-app-subnavitem-SEO' ).should(
+ 'not.have.class',
+ 'active'
+ );
+ cy.get( '.wppbh-app-navitem-Marketplace' ).should(
+ 'not.have.class',
+ 'active'
+ );
+ } );
+
+ it( 'Admin submenu exist outside the app', () => {
+ cy.visit( '/wp-admin/index.php' );
+ cy.get( '#adminmenu #toplevel_page_bluehost ul.wp-submenu' ).should(
+ 'exist'
+ );
+ cy.get(
+ '#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/home"]'
+ ).should( 'exist' );
+ cy.get(
+ '#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/marketplace"]'
+ ).should( 'exist' );
+ cy.get(
+ '#adminmenu #toplevel_page_bluehost ul.wp-submenu li a[href="admin.php?page=bluehost#/settings"]'
+ ).should( 'exist' );
+ } );
// utility nav is no more, leaving this in place un case we bring it back anytime soon.
- it.skip('Utility nav links properly navigates', () => {
- cy
- .get('.utility-link-Performance')
- .should('not.have.class', 'active');
- cy
- .get('.utility-link-Performance').click();
- cy.wait(500);
- cy.hash().should('eq', '#/performance');
- cy
- .get('.utility-link-Performance')
- .should('have.class', 'active');
-
- cy
- .get('.utility-link-Settings').click();
- cy.wait(500);
- cy.hash().should('eq', '#/settings');
- cy
- .get('.utility-link-Settings')
- .should('have.class', 'active');
- cy
- .get('.utility-link-Performance')
- .should('not.have.class', 'active');
-
- cy
- .get('.utility-link-Help').click();
- cy.wait(500);
- cy.hash().should('eq', '#/help');
- cy
- .get('.utility-link-Help')
- .should('have.class', 'active');
- cy
- .get('.utility-link-Settings')
- .should('not.have.class', 'active');
- });
+ it.skip( 'Utility nav links properly navigates', () => {
+ cy.get( '.utility-link-Performance' ).should(
+ 'not.have.class',
+ 'active'
+ );
+ cy.get( '.utility-link-Performance' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/performance' );
+ cy.get( '.utility-link-Performance' ).should( 'have.class', 'active' );
+
+ cy.get( '.utility-link-Settings' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/settings' );
+ cy.get( '.utility-link-Settings' ).should( 'have.class', 'active' );
+ cy.get( '.utility-link-Performance' ).should(
+ 'not.have.class',
+ 'active'
+ );
+
+ cy.get( '.utility-link-Help' ).click();
+ cy.wait( 500 );
+ cy.hash().should( 'eq', '#/help' );
+ cy.get( '.utility-link-Help' ).should( 'have.class', 'active' );
+ cy.get( '.utility-link-Settings' ).should( 'not.have.class', 'active' );
+ } );
// no mobile nav, but should probably add
- it.skip('Mobile nav links dispaly for mobile', () => {
- cy
- .get('.mobile-toggle')
- .should('not.exist');
-
- cy.viewport('iphone-x');
- cy
- .get('.mobile-toggle')
- .should('be.visible');
- });
-
- it.skip('Mobile nav links properly navigates', () => {
- cy.get('.mobile-link-Home').should('not.exist');
- cy.viewport('iphone-x');
- cy.get('.mobile-toggle').click();
- cy.wait(500);
- cy.get('.mobile-link-Home').should('be.visible');
- cy.get('button[aria-label="Close"]').should('be.visible')
- cy.get('button[aria-label="Close"]').click();
- cy.get('.mobile-link-Home').should('not.exist');
- });
-});
+ it.skip( 'Mobile nav links dispaly for mobile', () => {
+ cy.get( '.mobile-toggle' ).should( 'not.exist' );
+
+ cy.viewport( 'iphone-x' );
+ cy.get( '.mobile-toggle' ).should( 'be.visible' );
+ } );
+
+ it.skip( 'Mobile nav links properly navigates', () => {
+ cy.get( '.mobile-link-Home' ).should( 'not.exist' );
+ cy.viewport( 'iphone-x' );
+ cy.get( '.mobile-toggle' ).click();
+ cy.wait( 500 );
+ cy.get( '.mobile-link-Home' ).should( 'be.visible' );
+ cy.get( 'button[aria-label="Close"]' ).should( 'be.visible' );
+ cy.get( 'button[aria-label="Close"]' ).click();
+ cy.get( '.mobile-link-Home' ).should( 'not.exist' );
+ } );
+} );
diff --git a/tests/cypress/integration/settings.cy.js b/tests/cypress/integration/settings.cy.js
index 65ac8f85a..83174fdfb 100644
--- a/tests/cypress/integration/settings.cy.js
+++ b/tests/cypress/integration/settings.cy.js
@@ -1,243 +1,327 @@
//
-describe('Settings Page', function () {
+describe( 'Settings Page', function () {
+ before( () => {
+ cy.visit(
+ '/wp-admin/admin.php?page=' +
+ Cypress.env( 'pluginId' ) +
+ '#/settings'
+ );
+ } );
- before(() => {
- cy.visit('/wp-admin/admin.php?page=' + Cypress.env('pluginId') + '#/settings');
-
- });
-
- it('Is Accessible', () => {
+ it( 'Is Accessible', () => {
cy.injectAxe();
- cy.wait(500);
- cy.checkA11y('.wppbh-app-body');
- });
+ cy.wait( 500 );
+ cy.checkA11y( '.wppbh-app-body' );
+ } );
- it('Has Coming Soon', () => {
- cy
- .get('.wppbh-app-settings-coming-soon')
+ it( 'Has Coming Soon', () => {
+ cy.get( '.wppbh-app-settings-coming-soon' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Has Auto Updates Settings', () => {
- cy
- .get('.wppbh-app-settings-update')
+ it( 'Has Auto Updates Settings', () => {
+ cy.get( '.wppbh-app-settings-update' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Has Content Settings', () => {
- cy
- .get('.wppbh-app-settings-content')
+ it( 'Has Content Settings', () => {
+ cy.get( '.wppbh-app-settings-content' )
.scrollIntoView()
- .should('be.visible');
- });
+ .should( 'be.visible' );
+ } );
- it('Has Comments Settings', () => {
- cy
- .get('.wppbh-app-settings-comments')
+ it( 'Has Comments Settings', () => {
+ cy.get( '.wppbh-app-settings-comments' )
.scrollIntoView()
- .should('be.visible');
- });
-
- it('On load update all is checked, which forces other updates to check and disabled state', () => {
- cy.get('[data-id="autoupdate-all-toggle"]').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-core-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-plugins-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-themes-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- });
-
- it('Disable ALL toggle, leaves everything checked, but enables them', () => {
- cy.get('[data-id="autoupdate-all-toggle"]').click();
- cy.wait(100);
- cy.get('.nfd-notifications')
- .contains('p', 'Disabled All auto-updates')
- .should('be.visible');
- cy.get('[data-id="autoupdate-all-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('[data-id="autoupdate-core-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-plugins-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-themes-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- });
-
- it('Core toggle works', () => {
- cy.get('[data-id="autoupdate-core-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-core-toggle"]').click();
- cy.wait(100);
- cy.get('[data-id="autoupdate-core-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('.nfd-notifications')
- .contains('p', 'Disabled Core auto-updates')
- .should('be.visible');
- cy.get('[data-id="autoupdate-all-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- });
-
- it('Plugins toggle works', () => {
- cy.get('[data-id="autoupdate-plugins-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-plugins-toggle"]').click();
- cy.wait(100);
- cy.get('[data-id="autoupdate-plugins-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('.nfd-notifications')
- .contains('p', 'Disabled Plugins auto-update')
- .should('be.visible');
- cy.get('[data-id="autoupdate-all-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- });
-
- it('Themes toggle works', () => {
- cy.get('[data-id="autoupdate-themes-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-themes-toggle"]').click();
- cy.wait(100);
- cy.get('[data-id="autoupdate-themes-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('.nfd-notifications')
- .contains('p', 'Disabled Themes auto-update')
- .should('be.visible');
- cy.get('[data-id="autoupdate-all-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- });
-
- it('All toggle activates all', () => {
- cy.get('[data-id="autoupdate-all-toggle"]').click();
- cy.wait(100);
- cy.get('[data-id="autoupdate-all-toggle"]').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-core-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-plugins-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-themes-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- });
-
- it('Disabling All toggle returns to previous state', () => {
- cy.get('[data-id="autoupdate-all-toggle"]').click();
- cy.wait(100);
- cy.get('.nfd-notifications')
- .contains('p', 'Disabled All auto-updates')
- .should('be.visible');
- cy.get('[data-id="autoupdate-all-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('[data-id="autoupdate-core-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('[data-id="autoupdate-plugins-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('[data-id="autoupdate-themes-toggle"]').should('not.be.disabled').should('have.attr', 'aria-checked').and('include', 'false');
- });
-
- it('All Toggle takes over again when all are enabled', () => {
- cy.get('[data-id="autoupdate-core-toggle"]').click();
- cy.get('[data-id="autoupdate-plugins-toggle"]').click();
- cy.get('[data-id="autoupdate-themes-toggle"]').click();
- cy.wait(100);
- cy.get('[data-id="autoupdate-all-toggle"]').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-core-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-plugins-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="autoupdate-themes-toggle"]').should('be.disabled').should('have.attr', 'aria-checked').and('include', 'true');
- });
-
- it('Content Settings Work', () => {
- cy.get('[data-id="content-revisions-select"]').click();
- cy.wait(100);
- cy.get('[data-id="content-revisions-select"]')
+ .should( 'be.visible' );
+ } );
+
+ it( 'On load update all is checked, which forces other updates to check and disabled state', () => {
+ cy.get( '[data-id="autoupdate-all-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-core-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-themes-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ } );
+
+ it( 'Disable ALL toggle, leaves everything checked, but enables them', () => {
+ cy.get( '[data-id="autoupdate-all-toggle"]' ).click();
+ cy.wait( 100 );
+ cy.get( '.nfd-notifications' )
+ .contains( 'p', 'Disabled All auto-updates' )
+ .should( 'be.visible' );
+ cy.get( '[data-id="autoupdate-all-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '[data-id="autoupdate-core-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-themes-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ } );
+
+ it( 'Core toggle works', () => {
+ cy.get( '[data-id="autoupdate-core-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-core-toggle"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="autoupdate-core-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '.nfd-notifications' )
+ .contains( 'p', 'Disabled Core auto-updates' )
+ .should( 'be.visible' );
+ cy.get( '[data-id="autoupdate-all-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ } );
+
+ it( 'Plugins toggle works', () => {
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '.nfd-notifications' )
+ .contains( 'p', 'Disabled Plugins auto-update' )
+ .should( 'be.visible' );
+ cy.get( '[data-id="autoupdate-all-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ } );
+
+ it( 'Themes toggle works', () => {
+ cy.get( '[data-id="autoupdate-themes-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-themes-toggle"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="autoupdate-themes-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '.nfd-notifications' )
+ .contains( 'p', 'Disabled Themes auto-update' )
+ .should( 'be.visible' );
+ cy.get( '[data-id="autoupdate-all-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ } );
+
+ it( 'All toggle activates all', () => {
+ cy.get( '[data-id="autoupdate-all-toggle"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="autoupdate-all-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-core-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-themes-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ } );
+
+ it( 'Disabling All toggle returns to previous state', () => {
+ cy.get( '[data-id="autoupdate-all-toggle"]' ).click();
+ cy.wait( 100 );
+ cy.get( '.nfd-notifications' )
+ .contains( 'p', 'Disabled All auto-updates' )
+ .should( 'be.visible' );
+ cy.get( '[data-id="autoupdate-all-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '[data-id="autoupdate-core-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '[data-id="autoupdate-themes-toggle"]' )
+ .should( 'not.be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ } );
+
+ it( 'All Toggle takes over again when all are enabled', () => {
+ cy.get( '[data-id="autoupdate-core-toggle"]' ).click();
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' ).click();
+ cy.get( '[data-id="autoupdate-themes-toggle"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="autoupdate-all-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-core-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-plugins-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="autoupdate-themes-toggle"]' )
+ .should( 'be.disabled' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ } );
+
+ it( 'Content Settings Work', () => {
+ cy.get( '[data-id="content-revisions-select"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="content-revisions-select"]' )
.parent()
- .next('ul.nfd-select__options')
- .find('li:first')
+ .next( 'ul.nfd-select__options' )
+ .find( 'li:first' )
.click(); // 1
- cy.wait(100);
- cy.get('#content-revisions-select__description')
- .contains('you can take 1 step back.')
- .should('be.visible');
-
- cy.get('[data-id="content-revisions-select"]').click();
- cy.wait(1000);
- cy.get('[data-id="content-revisions-select"]')
+ cy.wait( 100 );
+ cy.get( '#content-revisions-select__description' )
+ .contains( 'you can take 1 step back.' )
+ .should( 'be.visible' );
+
+ cy.get( '[data-id="content-revisions-select"]' ).click();
+ cy.wait( 1000 );
+ cy.get( '[data-id="content-revisions-select"]' )
.parent()
- .next('ul.nfd-select__options')
- .find('li:last')
+ .next( 'ul.nfd-select__options' )
+ .find( 'li:last' )
.click(); // 40
- cy.wait(100);
- cy.get('#content-revisions-select__description')
- .contains('you can take 40 steps back.')
- .should('be.visible');
-
- cy.get('[data-id="content-revisions-select"]').click();
- cy.wait(500);
- cy.get('[data-id="content-revisions-select"]')
+ cy.wait( 100 );
+ cy.get( '#content-revisions-select__description' )
+ .contains( 'you can take 40 steps back.' )
+ .should( 'be.visible' );
+
+ cy.get( '[data-id="content-revisions-select"]' ).click();
+ cy.wait( 500 );
+ cy.get( '[data-id="content-revisions-select"]' )
.parent()
- .next('ul.nfd-select__options')
- .find('li:nth-child(2)')
+ .next( 'ul.nfd-select__options' )
+ .find( 'li:nth-child(2)' )
.click(); // 5
- cy.get('#content-revisions-select__description')
- .contains('you can take 5 steps back.')
- .should('be.visible');
-
+ cy.get( '#content-revisions-select__description' )
+ .contains( 'you can take 5 steps back.' )
+ .should( 'be.visible' );
+
// Empty Trash Setting
- cy.get('[data-id="empty-trash-select"]').click();
- cy.wait(500);
- cy.get('[data-id="empty-trash-select"]')
+ cy.get( '[data-id="empty-trash-select"]' ).click();
+ cy.wait( 500 );
+ cy.get( '[data-id="empty-trash-select"]' )
.parent()
- .next('ul.nfd-select__options')
- .find('li:nth-child(2)')
+ .next( 'ul.nfd-select__options' )
+ .find( 'li:nth-child(2)' )
.click(); // 2
- cy.wait(100);
- cy.get('#empty-trash-select__description')
- .contains('The trash will automatically empty every 2 weeks.')
- .should('be.visible');
-
- cy.get('[data-id="empty-trash-select"]').click();
- cy.wait(500);
- cy.get('[data-id="empty-trash-select"]')
+ cy.wait( 100 );
+ cy.get( '#empty-trash-select__description' )
+ .contains( 'The trash will automatically empty every 2 weeks.' )
+ .should( 'be.visible' );
+
+ cy.get( '[data-id="empty-trash-select"]' ).click();
+ cy.wait( 500 );
+ cy.get( '[data-id="empty-trash-select"]' )
.parent()
- .next('ul.nfd-select__options')
- .find('li:last')
+ .next( 'ul.nfd-select__options' )
+ .find( 'li:last' )
.click(); // 4
- cy.wait(100);
- cy.get('#empty-trash-select__description')
- .contains('The trash will automatically empty every 4 weeks.')
- .should('be.visible');
- });
-
- it('Comment Settings Work', () => {
- cy.get('[data-id="comments-per-page-select"]').click();
- cy.wait(500);
- cy.get('[data-id="comments-per-page-select"]')
+ cy.wait( 100 );
+ cy.get( '#empty-trash-select__description' )
+ .contains( 'The trash will automatically empty every 4 weeks.' )
+ .should( 'be.visible' );
+ } );
+
+ it( 'Comment Settings Work', () => {
+ cy.get( '[data-id="comments-per-page-select"]' ).click();
+ cy.wait( 500 );
+ cy.get( '[data-id="comments-per-page-select"]' )
.parent()
- .next('ul.nfd-select__options')
- .find('li:first')
+ .next( 'ul.nfd-select__options' )
+ .find( 'li:first' )
.click(); // 10
- cy.wait(100);
- cy.get('.wppbh-app-settings-comments')
- .contains('label', 'Display 10 comments per page.')
- .should('be.visible');
-
- cy.get('[data-id="disable-comments-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('[data-id="close-comments-days-select"]').should('be.disabled');
- cy.get('[data-id="disable-comments-toggle"]').click();
- cy.wait(100);
-
- cy.get('[data-id="disable-comments-toggle"]').should('have.attr', 'aria-checked').and('include', 'true');
- cy.get('[data-id="close-comments-days-select"]').should('not.be.disabled');
+ cy.wait( 100 );
+ cy.get( '.wppbh-app-settings-comments' )
+ .contains( 'label', 'Comments to display per page' )
+ .should( 'be.visible' );
+
+ cy.get( '[data-id="disable-comments-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '[data-id="close-comments-days-select"]' ).should(
+ 'be.disabled'
+ );
+ cy.get( '[data-id="disable-comments-toggle"]' ).click();
+ cy.wait( 100 );
+
+ cy.get( '[data-id="disable-comments-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'true' );
+ cy.get( '[data-id="close-comments-days-select"]' ).should(
+ 'not.be.disabled'
+ );
// Close comments after days
- cy.get('[data-id="close-comments-days-select"]').click();
- cy.wait(100);
- cy.get('[data-id="close-comments-days-select"]')
+ cy.get( '[data-id="close-comments-days-select"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="close-comments-days-select"]' )
.parent()
- .next('ul.nfd-select__options')
- .find('li:last')
+ .next( 'ul.nfd-select__options' )
+ .find( 'li:last' )
.click(); // 100
- cy.wait(100);
- cy.get('.wppbh-app-settings-comments')
- .contains('label', 'Close comments after 100 days.')
- .should('be.visible');
-
- cy.get('[data-id="close-comments-days-select"]').click();
- cy.wait(100);
- cy.get('[data-id="close-comments-days-select"]')
+ cy.wait( 100 );
+ cy.get( '.wppbh-app-settings-comments' )
+ .contains( 'label', 'Comments to display per page' )
+ .should( 'be.visible' );
+
+ cy.get( '[data-id="close-comments-days-select"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="close-comments-days-select"]' )
.parent()
- .next('ul.nfd-select__options')
- .find('li:nth-child(6)')
+ .next( 'ul.nfd-select__options' )
+ .find( 'li:nth-child(6)' )
.click(); // 14
- cy.wait(100);
- cy.get('.wppbh-app-settings-comments')
- .contains('label', 'Close comments after 14 days.')
- .should('be.visible');
-
- cy.get('[data-id="disable-comments-toggle"]').click();
- cy.wait(100);
- cy.get('[data-id="disable-comments-toggle"]').should('have.attr', 'aria-checked').and('include', 'false');
- cy.get('[data-id="close-comments-days-select"]').should('be.disabled');
-
- });
-
-});
+ cy.wait( 100 );
+ cy.get( '.wppbh-app-settings-comments' )
+ .contains( 'label', 'Close comments after 14 days.' )
+ .should( 'be.visible' );
+
+ cy.get( '[data-id="disable-comments-toggle"]' ).click();
+ cy.wait( 100 );
+ cy.get( '[data-id="disable-comments-toggle"]' )
+ .should( 'have.attr', 'aria-checked' )
+ .and( 'include', 'false' );
+ cy.get( '[data-id="close-comments-days-select"]' ).should(
+ 'be.disabled'
+ );
+ } );
+} );
diff --git a/tests/cypress/integration/version-check.cy.js b/tests/cypress/integration/version-check.cy.js
index 1d94dbda8..3952716a2 100644
--- a/tests/cypress/integration/version-check.cy.js
+++ b/tests/cypress/integration/version-check.cy.js
@@ -1,24 +1,28 @@
//
-describe('Page', () => {
-
- before(() => {
+describe( 'Page', () => {
+ before( () => {
cy.login();
- cy.visit('/wp-admin/site-health.php?tab=debug');
- })
-
- it('Is running the correct WP version', () => {
-
- cy.get('#health-check-accordion-block-wp-core').prev().click();
- cy.get('#health-check-accordion-block-wp-core').find('tr').first().find('td').last().contains(new RegExp(`^${Cypress.env('wpVersion')}`));
-
- })
-
- it('Is running the correct PHP versions', () => {
-
- cy.get('#health-check-accordion-block-wp-server').prev().click();
- cy.get('#health-check-accordion-block-wp-server').find('tr').eq(2).find('td').last().contains(Cypress.env('phpVersion'));
-
- })
-
-})
\ No newline at end of file
+ cy.visit( '/wp-admin/site-health.php?tab=debug' );
+ } );
+
+ it( 'Is running the correct WP version', () => {
+ cy.get( '#health-check-accordion-block-wp-core' ).prev().click();
+ cy.get( '#health-check-accordion-block-wp-core' )
+ .find( 'tr' )
+ .first()
+ .find( 'td' )
+ .last()
+ .contains( new RegExp( `^${ Cypress.env( 'wpVersion' ) }` ) );
+ } );
+
+ it( 'Is running the correct PHP versions', () => {
+ cy.get( '#health-check-accordion-block-wp-server' ).prev().click();
+ cy.get( '#health-check-accordion-block-wp-server' )
+ .find( 'tr' )
+ .eq( 2 )
+ .find( 'td' )
+ .last()
+ .contains( Cypress.env( 'phpVersion' ) );
+ } );
+} );
diff --git a/tests/cypress/support/commands.js b/tests/cypress/support/commands.js
index 84540dcbc..cb276606d 100644
--- a/tests/cypress/support/commands.js
+++ b/tests/cypress/support/commands.js
@@ -28,62 +28,75 @@
import '@testing-library/cypress/add-commands';
-Cypress.Commands.add('login', (username, password) => {
- cy
- .getCookies()
- .then(cookies => {
- let hasMatch = false;
- cookies.forEach((cookie) => {
- if (cookie.name.substr(0, 20) === 'wordpress_logged_in_') {
- hasMatch = true;
- }
- });
- if (!hasMatch) {
- cy.visit('/wp-login.php').wait(1000);
- cy.get('#user_login').type(username);
- cy.get('#user_pass').type(`${ password }{enter}`);
-
- // Speed up tests by setting permalink structure once
- cy.setPermalinkStructure();
+Cypress.Commands.add( 'login', ( username, password ) => {
+ cy.getCookies().then( ( cookies ) => {
+ let hasMatch = false;
+ cookies.forEach( ( cookie ) => {
+ if ( cookie.name.substr( 0, 20 ) === 'wordpress_logged_in_' ) {
+ hasMatch = true;
}
- });
-});
+ } );
+ if ( ! hasMatch ) {
+ cy.visit( '/wp-login.php' ).wait( 1000 );
+ cy.get( '#user_login' ).type( username );
+ cy.get( '#user_pass' ).type( `${ password }{enter}` );
-Cypress.Commands.add('logout', () => {
- cy
- .getCookies()
- .then(
- cookies => {
- cookies.forEach(
- cookie => {
- cy.clearCookie(cookie.name);
- }
- )
- }
- );
-});
+ // Speed up tests by setting permalink structure once
+ // cy.setPermalinkStructure();
+ }
+ } );
+} );
-Cypress.Commands.add('setPermalinkStructure', ((structure = '/%postname%/') => {
- cy.exec(`npx wp-env run cli wp rewrite structure "${structure}"`);
-}));
+Cypress.Commands.add( 'logout', () => {
+ cy.getCookies().then( ( cookies ) => {
+ cookies.forEach( ( cookie ) => {
+ cy.clearCookie( cookie.name );
+ } );
+ } );
+} );
-Cypress.Commands.add('deletePages', () => {
- cy.visit('/wp-admin/edit.php?post_type=page').wait(1000);
- cy.get('body').then(($body) => {
- // synchronously ask for the body's text
- // and do something based on whether it includes
- // another string
- if ($body.text().includes('No pages found.')) {
- // nothing needed
- } else {
- cy.get('#cb-select-all-1').check();
- cy.get('#bulk-action-selector-top').select('trash');
- cy.get('#doaction').click();
- cy.wait(2000);
- cy.get('.subsubsub .trash').click();
- cy.wait(2000);
- cy.get('#delete_all').click();
+Cypress.Commands.add(
+ 'setPermalinkStructure',
+ ( structure = '/%postname%/' ) => {
+ cy.request({
+ method: 'GET',
+ url: '/wp-json/',
+ failOnStatusCode: false,
+ }).then(result => {
+ if(result.isOkStatusCode) {
+ return;
+ }
+ const permalinkWpCliCommand = `wp rewrite structure "${structure}" --hard;`;
+ const permalinkWpEnvCommand = `npx wp-env run cli ${permalinkWpCliCommand}`;
+ const permalinkWpEnvTestCommand = `npx wp-env run tests-cli ${permalinkWpCliCommand}`;
+ cy.exec( permalinkWpEnvCommand, {failOnNonZeroExit: true})
+ .then((result) => {
+ cy.request('/wp-json/');
+ });
+ cy.exec( permalinkWpEnvTestCommand, {failOnNonZeroExit: true})
+ .then((result) => {
+ cy.request('/wp-json/');
+ });
+ });
+ }
+);
- }
- });
-});
+Cypress.Commands.add( 'deletePages', () => {
+ cy.visit( '/wp-admin/edit.php?post_type=page' ).wait( 1000 );
+ cy.get( 'body' ).then( ( $body ) => {
+ // synchronously ask for the body's text
+ // and do something based on whether it includes
+ // another string
+ if ( $body.text().includes( 'No pages found.' ) ) {
+ // nothing needed
+ } else {
+ cy.get( '#cb-select-all-1' ).check();
+ cy.get( '#bulk-action-selector-top' ).select( 'trash' );
+ cy.get( '#doaction' ).click();
+ cy.wait( 2000 );
+ cy.get( '.subsubsub .trash' ).click();
+ cy.wait( 2000 );
+ cy.get( '#delete_all' ).click();
+ }
+ } );
+} );
diff --git a/tests/cypress/support/index.js b/tests/cypress/support/index.js
index ddca7e733..1615106ce 100644
--- a/tests/cypress/support/index.js
+++ b/tests/cypress/support/index.js
@@ -16,14 +16,14 @@
import 'cypress-axe';
import './commands';
-const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/
-Cypress.on('uncaught:exception', (err) => {
+const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
+Cypress.on( 'uncaught:exception', ( err ) => {
/* returning false here prevents Cypress from failing the test */
- if (resizeObserverLoopErrRe.test(err.message)) {
- return false
+ if ( resizeObserverLoopErrRe.test( err.message ) ) {
+ return false;
}
-})
+} );
-before(() => {
- cy.login(Cypress.env('wpUsername'), Cypress.env('wpPassword'));
-});
+before( () => {
+ cy.login( Cypress.env( 'wpUsername' ), Cypress.env( 'wpPassword' ) );
+} );