-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #800 from newfold-labs/update/test-isolation
test updates and adding testIsolation
- Loading branch information
Showing
11 changed files
with
181 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,159 +1,113 @@ | ||
// <reference types="Cypress" /> | ||
|
||
describe('Navigation', function () { | ||
const appId = Cypress.env( 'appId' ); | ||
const pluginId = Cypress.env( 'pluginId' ) | ||
describe('Navigation', { testIsolation: true }, () => { | ||
const appClass = '.' + Cypress.env( 'appId' ); | ||
|
||
before(() => { | ||
beforeEach(() => { | ||
cy.wpLogin(); | ||
cy.exec( 'npx wp-env run cli wp transient delete newfold_marketplace' ); | ||
cy.visit('/wp-admin/admin.php?page=' + pluginId ); | ||
cy.visit( `/wp-admin/admin.php?page=${ Cypress.env( 'pluginId' ) }` ); | ||
}); | ||
|
||
it( "Admin submenu shouldn't exist inside app", () => { | ||
cy.get( '#adminmenu #toplevel_page_' + pluginId + ' ul.wp-submenu' ).should( | ||
cy.get( `#adminmenu #toplevel_page_${ Cypress.env( 'pluginId' ) } ul.wp-submenu` ).should( | ||
'not.exist' | ||
); | ||
} ); | ||
|
||
it('Logo Links to home', () => { | ||
cy.get('.' + appId + '-logo-wrap').click(); | ||
cy.get( appClass + '-logo-wrap').click(); | ||
cy.wait(500); | ||
cy.hash().should('eq', '#/home'); | ||
}); | ||
|
||
// test main nav | ||
it('Main nav links properly navigates', () => { | ||
cy | ||
.get('.' + appId + '-app-navitem-Marketplace'). | ||
.get( appClass + '-app-navitem-Marketplace'). | ||
should('not.have.class', 'active'); | ||
cy.get('.' + appId + '-app-navitem-Marketplace').click(); | ||
cy.get( appClass + '-app-navitem-Marketplace').click(); | ||
cy.wait(500); | ||
cy.hash().should('eq', '#/marketplace'); | ||
cy | ||
.get('.' + appId + '-app-navitem-Marketplace') | ||
.get( appClass + '-app-navitem-Marketplace') | ||
.should('have.class', 'active'); | ||
|
||
cy.get('.' + appId + '-app-navitem-Performance').click(); | ||
cy.get( appClass + '-app-navitem-Performance').click(); | ||
cy.wait(500); | ||
cy.hash().should('eq', '#/performance'); | ||
cy | ||
.get('.' + appId + '-app-navitem-Performance') | ||
.get( appClass + '-app-navitem-Performance') | ||
.should('have.class', 'active'); | ||
cy | ||
.get('.' + appId + '-app-navitem-Marketplace') | ||
.get( appClass + '-app-navitem-Marketplace') | ||
.should('not.have.class', 'active'); | ||
|
||
cy.get('.' + appId + '-app-navitem-Settings').click(); | ||
cy.get( appClass + '-app-navitem-Settings').click(); | ||
cy.wait(500); | ||
cy.hash().should('eq', '#/settings'); | ||
}); | ||
|
||
it('Subnav links properly navigates', () => { | ||
cy | ||
.get('.' + appId + '-app-navitem-Marketplace') | ||
.get( appClass + '-app-navitem-Marketplace') | ||
.scrollIntoView() | ||
.should('not.have.class', 'active'); | ||
cy.get('.' + appId + '-app-navitem-Marketplace').click(); | ||
cy.get( appClass + '-app-navitem-Marketplace').click(); | ||
|
||
cy.wait(500); | ||
cy.hash().should('eq', '#/marketplace'); | ||
cy | ||
.get('.' + appId + '-app-navitem-Marketplace') | ||
.get( appClass + '-app-navitem-Marketplace') | ||
.should('have.class', 'active'); | ||
|
||
cy.get('.' + appId + '-app-subnavitem-Services').click(); | ||
cy.get( appClass + '-app-subnavitem-Services').click(); | ||
cy.wait(500); | ||
cy.hash().should('eq', '#/marketplace/services'); | ||
cy | ||
.get('.' + appId + '-app-subnavitem-Services') | ||
.get( appClass + '-app-subnavitem-Services') | ||
.should('have.class', 'active'); | ||
cy | ||
.get('.' + appId + '-app-navitem-Marketplace') | ||
.get( appClass + '-app-navitem-Marketplace') | ||
.should('have.class', 'active'); | ||
|
||
|
||
cy.get('.' + appId + '-app-subnavitem-SEO').click(); | ||
cy.get( appClass + '-app-subnavitem-SEO').click(); | ||
cy.wait(500); | ||
cy.hash().should('eq', '#/marketplace/seo'); | ||
cy | ||
.get('.' + appId + '-app-subnavitem-SEO') | ||
.get( appClass + '-app-subnavitem-SEO') | ||
.should('have.class', 'active'); | ||
cy | ||
.get('.' + appId + '-app-subnavitem-Services') | ||
.get( appClass + '-app-subnavitem-Services') | ||
.should('not.have.class', 'active'); | ||
cy | ||
.get('.' + appId + '-app-navitem-Marketplace') | ||
.get( appClass + '-app-navitem-Marketplace') | ||
.should('have.class', 'active'); | ||
|
||
cy.get('.' + appId + '-app-navitem-Performance').click(); | ||
cy.get( appClass + '-app-navitem-Performance').click(); | ||
cy.wait(500); | ||
cy | ||
.get('.' + appId + '-app-subnavitem-Services') | ||
.get( appClass + '-app-subnavitem-Services') | ||
.should('not.have.class', 'active'); | ||
cy | ||
.get('.' + appId + '-app-subnavitem-SEO') | ||
.get( appClass + '-app-subnavitem-SEO') | ||
.should('not.have.class', 'active'); | ||
cy | ||
.get('.' + appId + '-app-navitem-Marketplace') | ||
.get( appClass + '-app-navitem-Marketplace') | ||
.should('not.have.class', 'active'); | ||
}); | ||
|
||
// utility nav is no more, leaving this in place in 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( 'Mobile nav links dispaly and link properly on mobile', () => { | ||
cy.viewport( 'iphone-x' ); | ||
cy.get( '#nfd-app-mobile-nav' ).should( 'be.visible' ); | ||
|
||
// no mobile nav, but should probably add | ||
it.skip('Mobile nav links dispaly for mobile', () => { | ||
cy | ||
.get('.mobile-toggle') | ||
.should('not.exist'); | ||
cy.get( appClass + '-app-navitem-Home' ).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'); | ||
cy.get( '#nfd-app-mobile-nav' ).click(); | ||
cy.wait( 500 ); | ||
cy.get( appClass + '-app-navitem-Home' ).should( 'be.visible' ); | ||
cy.get( 'button.nfd-modal__close-button' ).should( 'be.visible' ); | ||
cy.get( 'button.nfd-modal__close-button' ).click(); | ||
cy.get( appClass + '-app-navitem-Home' ).should( 'not.exist' ); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.