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 SiteDetails step #446

Merged
merged 2 commits into from
Feb 6, 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
@@ -1,6 +1,6 @@
// <reference types="Cypress" />

import { AdminBarCheck, DarkBGCheck, LightBGChcek, OptionsDetails } from "../wp-module-support/siteGen.cy";
import { AdminBarCheck, DarkBGCheck, LightBGCheck, OptionsDetails } from "../wp-module-support/siteGen.cy";

describe( 'SiteGen Fork Step', function () {
before( () => {
Expand All @@ -18,7 +18,7 @@ describe( 'SiteGen Fork Step', function () {
} );

it( 'Check for the light background', () => {
LightBGChcek();
LightBGCheck();
} );

it( 'Check for the heading and the title', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
// <reference types="Cypress" />

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

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

it( 'Check for the header admin bar', () => {
AdminBarCheck();
} );

it( 'Check for the existing dark background', () => {
DarkBGCheck();
} );

it( 'Check for the light background', () => {
LightBGCheck();
} );

it( 'Check the Progress Bar Value', () => {
ProgressBarCheck('12.5%');
});

it( 'Check if the Next Button is disabled when no prompt is entered', () => {
cy.get( '.nfd-onboarding-button--site-gen-next--disabled' ).should('be.visible');
} );

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

it( 'Check for the header to be visible', () => {
cy.get( '.ai-heading' ).should('be.visible');
} );

it( 'Check for the placeholder text & input box hint to be visible before the prompt', () => {
cy.get('.nfd-sg-input-box__field')
.should('have.attr', 'placeholder', 'I want a site for my company that sells…');
cy.get( '.nfd-sg-input-box__hint' ).should('be.visible');
} );

it( 'Enter the prompt and see the box-info progress', () => {
cy.get('.nfd-sg-input-box__field').type('I have a Yoga Studio called Asana,located in Cocoa Beach, Florida. We prioritize sustainibility ');
cy.get('.nfd-sg-input-box__info-icon')
.should('be.visible')
.should('have.length',3);
cy.get( '.nfd-onboarding-button--site-gen-next--disabled' ).should('be.visible');
cy.get('.nfd-sg-input-box__field').type('and source our yoga mats from co-consious suppliers here in the USA. ');
cy.get('.nfd-sg-input-box__info-icon--selected')
.should('be.visible')
.should('have.length', 2);
cy.get('.nfd-sg-input-box__field').type('In addition to our classes, we also provide a curated selection of yoga attire and access');
cy.get('.nfd-sg-input-box__info-icon--selected')
.should('be.visible')
.should('have.length', 3);
cy.get('.nfd-sg-site-details--next-btn')
.should('be.visible')
.click();
cy.url().should('not.contain','sitegen/step/site-details');
} );
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// <reference types="Cypress" />

import { AdminBarCheck, BackButtonCheck, DarkBGCheck, DisabledNextButton, LightBGChcek, ProgressBarCheck, SkipButtonCheck } from '../wp-module-support/siteGen.cy';
import { AdminBarCheck, BackButtonCheck, DarkBGCheck, DisabledNextButton, LightBGCheck, ProgressBarCheck, SkipButtonCheck } from '../wp-module-support/siteGen.cy';

describe( 'SiteGen Site Logo Step', function() {
before( () => {
Expand All @@ -18,7 +18,7 @@ describe( 'SiteGen Site Logo Step', function() {
} );

it( 'Check for the light background', () => {
LightBGChcek();
LightBGCheck();
} );

it( 'Check the Progress Bar Value', () => {
Expand Down
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, LightBGCheck, ProgressBarCheck} from "../wp-module-support/siteGen.cy";

describe( 'SiteGen Welcome Step', function () {
before( () => {
Expand All @@ -18,7 +18,7 @@ describe( 'SiteGen Welcome Step', function () {
} );

it( 'Check for the light background', () => {
LightBGChcek();
LightBGCheck();
} );

it( 'Check the Progress Bar Value', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/cypress/integration/wp-module-support/siteGen.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const DarkBGCheck = () => {
cy.get('.nfd-onboarding-sitegen-dark').should('be.visible');
};

export const LightBGChcek = () => {
export const LightBGCheck = () => {
cy.get( '.nfd-onboarding-toggle__theme__button__dark' )
.should( 'exist' )
.click();
Expand Down
Loading