Skip to content

Commit

Permalink
Merge pull request #334 from newfold-labs/PRESS0-1673
Browse files Browse the repository at this point in the history
Fix multiple tests failing in all brand release PRs cypress tests and matrix workflows.
  • Loading branch information
ramyakrishnai authored Jul 5, 2024
2 parents 3478b6e + 8e87894 commit edf5a3b
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
3 changes: 0 additions & 3 deletions tests/cypress/integration/Home/ecommerce-coming-soon.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,16 @@ import {
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' );
} );
Expand Down
2 changes: 0 additions & 2 deletions tests/cypress/integration/Home/ecommerce-live.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { GetPluginId } from '../wp-module-support/pluginID.cy';
import {
wpLogin,
comingSoon,
uninstallPlugins,
} from '../wp-module-support/utils.cy';

const customCommandTimeout = 20000;
Expand All @@ -11,7 +10,6 @@ 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' );
} );
Expand Down
15 changes: 4 additions & 11 deletions tests/cypress/integration/Home/ecommerce-next-steps.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { GetPluginId } from '../wp-module-support/pluginID.cy';
import {
wpLogin,
comingSoon,
viewCompletedTasks,
viewRemainingTasks,
} from '../wp-module-support/utils.cy';
Expand Down Expand Up @@ -155,17 +154,11 @@ describe( 'e-commerce Home Page- Next Steps', () => {
.scrollIntoView()
.invoke( 'removeAttr', 'target' )
.click();
if ( pluginId == 'crazy-domains' ) {
cy.url().should(
'equal',
`https://my.yoast.com/signup?redirect_to=https://academy.yoast.com/courses/?utm_medium=crazydomains_plugin&utm_source=wp-home`
);
} else {
cy.url().should(
'equal',
`https://my.yoast.com/signup?redirect_to=https://academy.yoast.com/courses/?utm_medium=${ pluginId }_plugin&utm_source=wp-home`
cy.url()
.should(
'contain',
'https://my.yoast.com/signup?redirect_to=https://academy.yoast.com/courses/'
);
}
cy.go( 'back' );
EventsAPI( APIList.yoast_seo_academy, pluginId );

Expand Down
13 changes: 10 additions & 3 deletions tests/cypress/integration/Home/homePageWithWoo.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@ describe(
'e-commerce Home Page - When WooCommerce is installed',
{ testIsolation: true },
() => {
before(() => {
installWoo();
});

beforeEach( () => {
wpLogin();
uninstallPlugins();
installWoo();
cy.visit( '/wp-admin/admin.php?page=' + pluginId + '#/home' );
} );

Expand All @@ -28,6 +30,7 @@ describe(
} );

it( 'Verify next steps "Add your store info"', () => {
cy.reload();
waitForNextSteps();
cy.get( '#add-your-store-info a', {
timeout: customCommandTimeout,
Expand Down Expand Up @@ -86,7 +89,11 @@ describe(
viewRemainingTasks();
} );

it( 'Verify next step "Connect a payment processor"', () => {
it( 'Verify next step "Connect a payment processor"', function () {
// Razorpay is not enabled for crazy-domains, hense skipping
if (pluginId == 'crazy-domains') {
this.skip();
}
cy.reload();
waitForNextSteps();
cy.get( '#connect-a-payment-processor a', {
Expand Down
4 changes: 2 additions & 2 deletions tests/cypress/integration/Home/migration.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe(
.should( 'exist' )
.click();
EventsAPI( APIList.update_nameserver, pluginId );
cy.get( '.nfd-help-center', {
cy.get( '.help-container', {
timeout: customCommandTimeout,
} ).should( 'be.visible' );
cy.get( '.close-button' ).click();
Expand All @@ -57,7 +57,7 @@ describe(
.should( 'exist' )
.click();
EventsAPI( APIList.connect_domain, pluginId );
cy.get( '.nfd-help-center', {
cy.get( '.help-container', {
timeout: customCommandTimeout,
} ).should( 'be.visible' );
cy.get( '.close-button' ).click();
Expand Down
3 changes: 2 additions & 1 deletion tests/cypress/integration/Store/storePage.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ describe(
() => {
before( () => {
wpLogin();
uninstallPlugins();
cy.exec( `npx wp-env run cli wp plugin deactivate woocommerce`,
{ failOnNonZeroExit: false });
cy.visit( '/wp-admin/admin.php?page=' + pluginId + '#/store' );
} );

Expand Down

0 comments on commit edf5a3b

Please sign in to comment.