Skip to content

Commit

Permalink
Mock APIs better
Browse files Browse the repository at this point in the history
  • Loading branch information
avneet-raj committed Apr 10, 2024
1 parent ffae6e5 commit f126901
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,15 @@ import {

describe( 'SiteGen Site Logo Step', function () {
before( () => {
cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/site-logo' );
cy.intercept( apiList.sitegen, ( req ) => {
siteGenMockAll( req );
} ).as( 'sitegenCalls' );

cy.intercept( apiList.homepages, ( req ) => {
homePagesMock( req );
} ).as( 'homePageCall' );

cy.visit( 'wp-admin/?page=nfd-onboarding#/sitegen/step/site-logo' );
cy.wait( '@sitegenCalls', { timeout: 60000 } );
cy.wait( '@homePageCall', { timeout: 60000 } );
cy.timeout(120000);
} );

it( 'Check for the header admin bar', () => {
Expand Down Expand Up @@ -62,7 +60,7 @@ describe( 'SiteGen Site Logo Step', function () {
DisabledNextButton();
} );

it.skip( 'Check if Image gets uploaded', () => {
it( 'Check if Image gets uploaded', () => {
const sampleLogoPath = `vendor/newfold-labs/wp-module-onboarding/tests/cypress/fixtures/image.png`;
const LogoPreviewClass =
'.nfd-onboarding-image-uploader--with-text__site_logo__preview';
Expand Down Expand Up @@ -92,7 +90,7 @@ describe( 'SiteGen Site Logo Step', function () {
);
} );

it.skip( 'Check if the Next Button is enabled and go next', () => {
it( 'Check if the Next Button is enabled and go next', () => {
cy.get( '.nfd-onboarding-button--site-gen-next' )
.should( 'not.be.disabled' )
.click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,26 @@ import {
LightBGCheck,
ProgressBarCheck,
} from '../wp-module-support/siteGen.cy';
import {
apiList,
siteGenMockAll,
homePagesMock,
} from '../wp-module-support/MockApi.cy';

describe( 'SiteGen Experience & Site Building Step', function () {
before( () => {
cy.visit(
'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/experience'
);
cy.intercept( apiList.sitegen, ( req ) => {
siteGenMockAll( req );
} ).as( 'sitegenCalls' );

cy.intercept( apiList.homepages, ( req ) => {
homePagesMock( req );
} ).as( 'homePageCall' );
cy.timeout(120000);
cy.wait(5000);
} );

it( 'Check for the header admin bar', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,26 @@ import {
LightBGCheck,
ProgressBarCheck,
} from '../wp-module-support/siteGen.cy';
import {
apiList,
siteGenMockAll,
homePagesMock,
} from '../wp-module-support/MockApi.cy';

describe( 'SiteGen Site Preview Step', function () {
before( () => {
cy.visit(
'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/preview'
);
cy.intercept( apiList.sitegen, ( req ) => {
siteGenMockAll( req );
} ).as( 'sitegenCalls' );

cy.intercept( apiList.homepages, ( req ) => {
homePagesMock( req );
} ).as( 'homePageCall' );
cy.timeout(120000);
cy.wait(5000);
cy.wait( 5000 );
} );

Expand Down

0 comments on commit f126901

Please sign in to comment.