class PublishedSitePage { startEditNavBar ( ) { cy . get ( "button" ) . contains ( "Edit" ) . click ( ) ; } updateNavBarTitle ( title ) { cy . findByLabelText ( "Title*" ) . clear ( ) . type ( title ) ; } updateNavBarEmail ( email ) { cy . findByLabelText ( "Contact email address" ) . clear ( ) . type ( email ) ; } submitNavBar ( ) { cy . intercept ( { method : "PUT" , url : "/prod/settings" , } ) . as ( "updateNavBarRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings" , } ) . as ( "settingsRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings/homepage" , } ) . as ( "homepageSettingsRequest" ) ; cy . get ( "form" ) . submit ( ) ; cy . wait ( [ "@updateNavBarRequest" , "@updateNavBarRequest" , "@settingsRequest" , "@homepageSettingsRequest" , ] ) ; } verifyTitleEmail ( title , email ) { cy . get ( "div.Markdown.undefined" ) . eq ( 0 ) . contains ( title ) ; cy . get ( "div.usa-nav-container" ) . contains ( title ) ; cy . get ( "div.Markdown.undefined" ) . eq ( 1 ) . contains ( email ) ; } startEditHomepage ( ) { cy . intercept ( { method : "GET" , url : "/prod/settings/homepage" , } ) . as ( "homepageSettingsRequest" ) ; cy . get ( "button" ) . last ( ) . click ( ) ; cy . wait ( [ "@homepageSettingsRequest" ] ) ; } updateHomepageHeadline ( headline ) { cy . findByLabelText ( "Headline*" ) . clear ( ) . type ( headline ) ; } updateHomepageDescription ( description ) { cy . get ( "textarea#description" ) . clear ( ) . type ( description ) ; } submitHomepage ( ) { cy . intercept ( { method : "PUT" , url : "/prod/settings/homepage" , } ) . as ( "updateHomepageSettingsRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings/homepage" , } ) . as ( "homepageSettingsRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings" , } ) . as ( "settingsRequest" ) ; cy . get ( "form" ) . submit ( ) ; cy . wait ( [ "@updateHomepageSettingsRequest" , "@homepageSettingsRequest" , "@settingsRequest" , ] ) ; } verifyHeadlineAndDescription ( headline , description ) { cy . get ( "[data-testid='published-site-headline'] .Markdown" ) . contains ( headline ) ; cy . get ( "div.Markdown.undefined" ) . eq ( 3 ) . contains ( description ) ; cy . intercept ( { method : "GET" , url : "/prod/public/homepage" , } ) . as ( "publicHomepageRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings" , } ) . as ( "settingsRequest" ) ; cy . intercept ( { method : "GET" , url : "/prod/settings/homepage" , } ) . as ( "homepageSettingsRequest" ) ; cy . visit ( "/" ) ; cy . wait ( [ "@publicHomepageRequest" , "@settingsRequest" ] ) ; cy . get ( "h1" ) . contains ( headline ) ; cy . contains ( description ) ; cy . visit ( "/admin/settings/publishedsite" ) ; cy . wait ( [ "@settingsRequest" , "@settingsRequest" , "@homepageSettingsRequest" , ] ) ; cy . contains ( headline ) ; cy . contains ( description ) ; } } export default PublishedSitePage ;