import EditDashboardPage from "./EditDashboard" ; import DashboardListingPage from "./DashboardListing" ; class CreateDashboardPage { visit ( ) { const dashboardListingPage = new DashboardListingPage ( ) ; dashboardListingPage . visit ( ) ; dashboardListingPage . goToCreateDashboard ( ) ; } fillName ( name ) { cy . findByLabelText ( "Dashboard Name*" ) . type ( name ) ; } fillDescription ( description ) { cy . findByLabelText ( "Description (optional)" ) . type ( description ) ; } submit ( ) { cy . intercept ( { method : "POST" , url : "/prod/dashboard" , } ) . as ( "createDashboardRequest" ) ; cy . intercept ( { method : "GET" , url : new RegExp ( /\/prod\/dashboard\/.+/ ) , } ) . as ( "viewDashboardRequest" ) ; cy . intercept ( { method : "GET" , url : new RegExp ( /\/prod\/dashboard\/.+\/versions/ ) , } ) . as ( "viewDashboardVersionsRequest" ) ; cy . get ( "form" ) . submit ( ) ; cy . wait ( [ "@createDashboardRequest" , "@viewDashboardRequest" , "@viewDashboardVersionsRequest" , ] ) ; return new EditDashboardPage ( ) ; } } export default CreateDashboardPage ;