Skip to content

Commit

Permalink
Merge pull request #74 from newfold-labs/fix/product-page-test-for-ot…
Browse files Browse the repository at this point in the history
…her-brands

use appId for selector
  • Loading branch information
circlecube authored Jun 26, 2024
2 parents 2d5064b + f5ea089 commit 4f236a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion components/marketplaceItem/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const MarketplaceItem = ( { item, methods, constants } ) => {

const generateSecondaryUrl = () => {
if ( isInternal ) {
return `${ window.NewfoldRuntime.admin_url }admin.php?page=bluehost#/marketplace/product/${ item.secondaryUrl }`;
return `${ window.NewfoldRuntime.admin_url }admin.php?page=${ window.NewfoldRuntime.plugin.brand }#/marketplace/product/${ item.secondaryUrl }`;
}

return item.secondaryUrl;
Expand Down
7 changes: 5 additions & 2 deletions tests/cypress/integration/product-page.cy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
const productPageFixtures = require( '../fixtures/product-page.json' );

describe( 'Product Page', function () {
const appClass = '.' + Cypress.env( 'appId' );

beforeEach( () => {
cy.intercept(
{
Expand All @@ -22,7 +24,8 @@ describe( 'Product Page', function () {

it( 'Show loading state while fetching', () => {
cy.get(
'.wppbh-app-marketplace-container div[aria-label="Fetching product details"]'
appClass +
'-app-marketplace-container div[aria-label="Fetching product details"]'
).should( 'be.visible' );
} );

Expand All @@ -45,7 +48,7 @@ describe( 'Product Page', function () {
}
).as( 'productPageError' );
cy.wait( '@productPageError' );
cy.get( '.wppbh-app-marketplace-container div[role="alert"]' )
cy.get( appClass + '-app-marketplace-container div[role="alert"]' )
.find( 'img[alt="Dog walking with a leash"]' )
.should( 'exist' )
.and( 'be.visible' );
Expand Down

0 comments on commit 4f236a7

Please sign in to comment.