@@ -20,6 +20,7 @@ import {CssAttr} from "../types/cssAttr";
2020import { StubTypes } from "../types/stubTypes" ;
2121import { RequestsTypes } from "../types/requestsTypes" ;
2222import { readFile , writeTofile } from "../helpers/file-actions-helper" ;
23+ import { CommonTestData } from "../fixtures/commonTestData" ;
2324
2425export class BaseMethods {
2526
@@ -897,6 +898,99 @@ export class BaseMethods {
897898 this . checkUrlText ( link , isInclude , true )
898899 }
899900
901+ public changeRootFile ( {
902+ changedContentFilePath,
903+ rootFilePath,
904+ originalContentFilePath,
905+ } : {
906+ changedContentFilePath : string ,
907+ rootFilePath : string ,
908+ originalContentFilePath : string
909+ } ) : void {
910+ cy . wait ( 2000 )
911+ this . checkElementWithTextPresence ( {
912+ selector : baseSelectors . tags . paragraph ,
913+ text : Constants . commonConstantsData . nextJsAppsCommonPhrases . messages . start ,
914+ visibilityState : 'be.visible'
915+ } )
916+ this . writeContentToFile ( {
917+ contentFilePath : changedContentFilePath ,
918+ filePath : rootFilePath ,
919+ wait : 1000
920+ } )
921+ this . reloadWindow ( )
922+ this . checkElementWithTextPresence ( {
923+ selector : baseSelectors . tags . paragraph ,
924+ text : Constants . commonConstantsData . nextJsAppsCommonPhrases . messages . start ,
925+ isVisible : false
926+ } )
927+ this . checkElementWithTextPresence ( {
928+ selector : baseSelectors . tags . paragraph ,
929+ text : Constants . commonConstantsData . nextJsAppsCommonPhrases . messages . start . replace ( 'started' , 'TESTED' ) ,
930+ visibilityState : 'be.visible'
931+ } )
932+ this . writeContentToFile ( {
933+ contentFilePath : originalContentFilePath ,
934+ filePath : rootFilePath ,
935+ wait : 1000
936+ } )
937+ this . reloadWindow ( )
938+ this . checkElementWithTextPresence ( {
939+ selector : baseSelectors . tags . paragraph ,
940+ text : Constants . commonConstantsData . nextJsAppsCommonPhrases . messages . start ,
941+ visibilityState : 'be.visible'
942+ } )
943+ }
944+
945+ public checkLinkedCardsFunctionality ( host : number ) : void {
946+ this . checkOutsideResourceUrl ( {
947+ parentSelector : baseSelectors . tags . headers . h1 ,
948+ selector : baseSelectors . tags . coreElements . link ,
949+ text : CommonTestData . nextJsAppsHeaderLinkName ,
950+ link : Constants . commonConstantsData . commonLinks . nextJs ,
951+ } )
952+ Constants . commonConstantsData . nextJsAppsCommonPhrases . linksCardsText . forEach ( ( text : string , index : number ) => {
953+ this . openLocalhost ( host )
954+ this . checkOutsideResourceUrl ( {
955+ selector : commonSelectors . nextJsAppsLinkCard ,
956+ text,
957+ link : Constants . commonConstantsData . commonLinks . nextJsAppsCardsLinks [ index ] ,
958+ } )
959+ } )
960+ // TODO: Failed for now due to dynamic animations loading on new page. Extra investigate required
961+ // this.openLocalhost(host)
962+ // this.checkOutsideResourceUrl({
963+ // parentSelector: baseSelectors.tags.footer,
964+ // selector: baseSelectors.tags.coreElements.link,
965+ // text: Constants.commonConstantsData.nextJsAppsCommonPhrases.messages.engine,
966+ // link: Constants.commonConstantsData.commonLinks.vercel,
967+ // })
968+ }
969+
970+ public checkLinkedCardsHoverAnimation ( ) : void {
971+ Constants . commonConstantsData . nextJsAppsCommonPhrases . linksCardsText . forEach ( ( text : string ) => {
972+ this . reloadWindow ( )
973+ this . checkElementHaveProperty ( {
974+ selector : commonSelectors . nextJsAppsLinkCard ,
975+ prop : CssAttr . color ,
976+ value : Constants . color . skyBlue ,
977+ text,
978+ isInclude : false ,
979+ } )
980+ this . hoverElement ( {
981+ selector : commonSelectors . nextJsAppsLinkCard ,
982+ text,
983+ wait : 2000
984+ } )
985+ this . checkElementHaveProperty ( {
986+ selector : commonSelectors . nextJsAppsLinkCard ,
987+ prop : CssAttr . color ,
988+ value : Constants . color . skyBlue ,
989+ text,
990+ } )
991+ } )
992+ }
993+
900994
901995 /*
902996*---------------------------------------------------
0 commit comments