Skip to content

Commit

Permalink
add remaining tests
Browse files Browse the repository at this point in the history
  • Loading branch information
avneet-raj committed Jan 25, 2024
1 parent e463580 commit b77d91e
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <reference types="Cypress" />

import { AdminBarCheck, BackButtonCheck, DarkBGCheck, LightBGChcek, ProgressBarCheck} from "../wp-module-support/siteGen.cy";
import { AdminBarCheck, BackButtonCheck, DarkBGCheck, ExperienceDetails, LightBGChcek, ProgressBarCheck} from "../wp-module-support/siteGen.cy";

describe( 'SiteGen Experience & Site Building Step', function () {
before( () => {
Expand Down Expand Up @@ -29,10 +29,36 @@ describe( 'SiteGen Experience & Site Building Step', function () {
BackButtonCheck('sitegen/step/experience');
} );

it( 'Check for existence of experience cards', () => {
it( 'Check for the existence & the count of experience level cards', () => {
cy.get( '.nfd-sg-experience-level' ).should('be.visible');
cy.get( '.nfd-sg-loader' ).should('be.visible');
cy.get( '.nfd-sg-card' ).should('be.visible');
cy.get( '.nfd-sg-card__data__option' ).should('have.length',3)
} );

it( 'Check and click each experience cards', () => {
const className = '.nfd-sg-card__data__option'
let options = 0;
const arr = cy.get( className );
arr.each( () => {
if(options == 0){
ExperienceDetails(className,'Beginner',options);
};
if(options == 1){
ExperienceDetails(className,'Used it some',options);
};
if(options == 2){
ExperienceDetails(className, 'Expert',options);
};
options+=1;
});
} );

it( 'Check for the existence of skip button and click', () => {
cy.get( '.nfd-sg-card__skip' )
.scrollIntoView()
.should('be.visible')
.click();
cy.url().should('not.contain', 'sitegen/step/experience');
} );

});
16 changes: 16 additions & 0 deletions tests/cypress/integration/wp-module-support/siteGen.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,19 @@ export const DisabledNextButton = () => {
.should('be.visible')
.contains( 'Next' );
};

export const ExperienceDetails = (classname,textValue,optionsValue) => {
cy.get(classname)
.eq(optionsValue)
.find('.nfd-sg-card__data__option__left_top')
.invoke( 'text' )
.should('contain', textValue);
cy.get(classname)
.eq(optionsValue)
.click();
cy.url().should('not.include', 'sitegen/step/experience',{
timeout: 10000,
} );
cy.go('back');
cy.wait(2000);
};

0 comments on commit b77d91e

Please sign in to comment.