import selectors from "../utils/selectors" ; import TopicAreaListingPage from "./TopicAreaListing" ; import PublishingGuidancePage from "./PublishingGuidance" ; import PublishedSitePage from "./PublishedSite" ; import DateTimeFormatPage from "./DateTimeFormat" ; class SettingsPage { visit ( ) { cy . intercept ( { method : "GET" , url : "/prod/topicarea" , } ) . as ( "listTopicAreasRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings" , } ) . as ( "settingsRequest" ) ; cy . get ( selectors . navBar ) . get ( "a" ) . contains ( "Settings" ) . click ( ) ; cy . wait ( [ "@settingsRequest" , "@listTopicAreasRequest" ] ) ; } goToTopicAreas ( ) { cy . intercept ( { method : "GET" , url : "/prod/topicarea" , } ) . as ( "listTopicAreasRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings" , } ) . as ( "settingsRequest" ) ; cy . get ( "a.usa-current[href='/admin/settings/topicarea']" ) . click ( ) ; cy . wait ( [ "@settingsRequest" , "@listTopicAreasRequest" ] ) ; return new TopicAreaListingPage ( ) ; } goToPublishingGuidance ( ) { cy . intercept ( { method : "GET" , url : "/prod/settings" , } ) . as ( "settingsRequest" ) ; cy . get ( "a" ) . contains ( "Publishing guidance" ) . click ( ) ; cy . wait ( [ "@settingsRequest" ] ) ; return new PublishingGuidancePage ( ) ; } goToPublishedSite ( ) { cy . intercept ( { method : "GET" , url : "/prod/settings" , } ) . as ( "settingsRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings/homepage" , } ) . as ( "homepageSettingsRequest" ) ; cy . get ( "a" ) . contains ( "Published site" ) . click ( ) ; cy . wait ( [ "@homepageSettingsRequest" , "@settingsRequest" ] ) ; return new PublishedSitePage ( ) ; } goToDateTimeFormat ( ) { cy . intercept ( { method : "GET" , url : "/prod/settings" , } ) . as ( "settingsRequest" ) ; cy . get ( "a" ) . contains ( "Date and time format" ) . click ( ) ; cy . wait ( [ "@settingsRequest" ] ) ; return new DateTimeFormatPage ( ) ; } } export default SettingsPage ;