Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Tests for Experience & Site Building Step #430

Merged
merged 2 commits into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// <reference types="Cypress" />

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

describe( 'SiteGen Experience & Site Building Step', function () {
before( () => {
cy.visit(
'wp-admin/index.php?page=nfd-onboarding#/sitegen/step/experience'
);
} );

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 the Progress Bar Value', () => {
ProgressBarCheck('50%');
});

it( 'Check for back button and go back', () => {
BackButtonCheck('sitegen/step/experience');
} );

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');
} );
});
18 changes: 17 additions & 1 deletion tests/cypress/integration/wp-module-support/siteGen.cy.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// <reference types="Cypress" />

export const AdminBarCheck = () => {
cy.get( '.nfd-onboarding-header__admin-bar' ).should('be.visible');
cy.get( '.nfd-onboarding-header__admin-bar', {timeout:15000} ).should('be.visible');
};

export const DarkBGCheck = () => {
Expand Down 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);
};