-
Notifications
You must be signed in to change notification settings - Fork 8
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 #403 from newfold-labs/add-initial-tests
PRESS2-1481- The Fork Step Cypress Test
- Loading branch information
Showing
2 changed files
with
110 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
tests/cypress/integration/5-AI-SiteGen-onboarding-flow/fork.cy.js
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// <reference types="Cypress" /> | ||
|
||
import { AdminBarCheck, DarkBGCheck, LightBGChcek, OptionsDetails } from "../wp-module-support/siteGen.cy"; | ||
|
||
describe( 'SiteGen Fork Step', function () { | ||
before( () => { | ||
cy.visit( | ||
'wp-admin/?page=nfd-onboarding#/wp-setup/step/fork' | ||
); | ||
} ); | ||
|
||
it( 'Check for the header admin bar', () => { | ||
AdminBarCheck(); | ||
} ); | ||
|
||
it( 'Check for the existing dark background', () => { | ||
DarkBGCheck(); | ||
} ); | ||
|
||
it( 'Check for the light background', () => { | ||
LightBGChcek(); | ||
} ); | ||
|
||
it( 'Check for the heading and the title', () => { | ||
cy.get( '.nfd-onboarding-step__heading__title' ) | ||
.should('be.visible') | ||
.should('have.text', 'Welcome to WordPress'); | ||
} ); | ||
|
||
it ( 'Check for the subheading', () => { | ||
cy.get( '.nfd-onboarding-step__heading__subtitle' ).should('be.visible'); | ||
} ); | ||
|
||
it ( 'Check the number of container options available', () => { | ||
cy.get( '.nfd-onboarding-sitegen-options__container__options' ) | ||
.should( 'be.visible' ) | ||
.should('have.length', 3); | ||
} ); | ||
|
||
it( 'Check for selection of different container options', () => { | ||
let options = 0; | ||
const className = '.nfd-onboarding-sitegen-options__container__options'; | ||
const arr = cy.get( className ); | ||
arr.each( () => { | ||
if(options == 0){ | ||
OptionsDetails(className,'Build it myself',options); | ||
cy.url().should('include', 'get-started/welcome',{ | ||
timeout: 10000, | ||
} ); | ||
cy.go('back'); | ||
}; | ||
if(options == 1){ | ||
OptionsDetails(className,'AI Website Creator',options); | ||
cy.url().should('include', 'sitegen/step/welcome',{ | ||
timeout: 10000, | ||
} ); | ||
cy.go('back'); | ||
}; | ||
if(options == 2){ | ||
OptionsDetails(className, 'Hire a Pro',options); | ||
}; | ||
options+=1; | ||
|
||
}); | ||
}); | ||
|
||
it( 'Check for the import your WP account link at the bottom', () => { | ||
cy.get( '.nfd-onboarding-step--site-gen__fork__importsite' ) | ||
.scrollIntoView() | ||
.should('exist') | ||
.should('contain', 'Already have a WordPress site') | ||
.should('have.attr', 'href', 'https://my.bluehost.com/cgi/services/migration'); | ||
} ); | ||
}); |
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// <reference types="Cypress" /> | ||
|
||
export const AdminBarCheck = () => { | ||
cy.get( '.nfd-onboarding-header__admin-bar' ).should('be.visible'); | ||
}; | ||
|
||
export const DarkBGCheck = () => { | ||
cy.wait( 2000 ); | ||
// When the page loads, it should have dark background by default | ||
cy.get('.nfd-onboarding-sitegen-dark').should('be.visible'); | ||
}; | ||
|
||
export const LightBGChcek = () => { | ||
cy.get( '.nfd-onboarding-toggle__theme__button__dark' ) | ||
.should( 'exist' ) | ||
.click(); | ||
cy.get( '.nfd-onboarding-sitegen-light' ).should('be.visible'); | ||
// Now changing the background back to dark | ||
cy.get( '.nfd-onboarding-toggle__theme__button__light' ) | ||
.should( 'exist' ) | ||
.click(); | ||
cy.get('.nfd-onboarding-sitegen-dark').should('be.visible'); | ||
}; | ||
|
||
export const OptionsDetails = (className,textValue,optionsValue) => { | ||
cy.get(className) | ||
.eq(optionsValue) | ||
.find('.nfd-onboarding-sitegen-options__container__heading__title') | ||
.invoke( 'text' ) | ||
.should('contain', textValue); | ||
if(optionsValue!=2){ // Excluding the Last Option as it takes to new tab, just validating the title text | ||
cy.get(className) | ||
.eq(optionsValue) | ||
.click(); | ||
}; | ||
}; |