import LoginPage from "../pages/Login" ; import PublicHomepage from "../pages/PublicHomepage" ; describe ( "Admin user" , ( ) => { it ( "are taken to the admin homepage after login" , ( ) => { const loginPage = new LoginPage ( ) ; loginPage . visit ( ) ; loginPage . loginAsAdmin ( ) ; cy . contains ( "Welcome to the Performance Dashboard" ) ; cy . get ( "button" ) . contains ( "Create dashboard" ) ; cy . get ( "button" ) . contains ( "Manage users" ) ; cy . get ( "button" ) . contains ( "View settings" ) ; cy . get ( "button" ) . contains ( "View the published site" ) ; } ) ; } ) ; describe ( "Public users" , ( ) => { it ( "can see the homepage with dashboards grouped by topic area" , ( ) => { const publicHomepage = new PublicHomepage ( ) ; publicHomepage . visitWithDummyData ( "homepage.json" ) . then ( ( homepage ) => { cy . findByRole ( "searchbox" ) . should ( "exist" ) ; cy . findByRole ( "heading" , { name : "Performance Dashboard" , } ) . should ( "exist" ) ; cy . findByText ( "We make data open and accessible to provide " + "transparency and help improve digital services." ) . should ( "exist" ) ; cy . findByText ( "Gorgeous Cotton Gloves" ) . should ( "exist" ) ; cy . findByText ( "Ergonomic Wooden Soap" ) . should ( "exist" ) ; cy . findByText ( "Treutel Group" ) . should ( "exist" ) ; cy . findByText ( "Shoes and Sandals" ) . should ( "exist" ) ; cy . findByText ( "Hauck LLC" ) . should ( "exist" ) ; cy . findByText ( "Schaden and Sons" ) . should ( "exist" ) ; } ) ; } ) ; } ) ;