11package school .redrover ;
22
3- import org .openqa .selenium .By ;
4- import org .openqa .selenium .WebElement ;
53import org .testng .Assert ;
64import org .testng .annotations .Test ;
75import school .redrover .common .BaseTest ;
@@ -299,10 +297,12 @@ public void testAddParameterForParameterizationOfBuilds() {
299297 Assert .assertTrue (selectedParameterList .contains (parameterName ));
300298 }
301299
302- @ Test ( dependsOnMethods = "testCreate" )
300+ @ Test
303301 public void testNavigationToWorkspaceAfterBuild () {
304302 final String expectedHeadingText = "Workspace of " + PROJECT_NAME + " on Built-In Node" ;
305303
304+ createFreestyleProject (PROJECT_NAME );
305+
306306 String actualHeadingText = new HomePage (getDriver ())
307307 .openProject (PROJECT_NAME , new FreestyleProjectStatusPage (getDriver ()))
308308 .getSidebarComponent ()
@@ -313,4 +313,27 @@ public void testNavigationToWorkspaceAfterBuild() {
313313
314314 Assert .assertEquals (actualHeadingText , expectedHeadingText );
315315 }
316+
317+ @ Test
318+ public void testErrorMessageForProjectWithNoWorkspace () {
319+ final String expectedHeadingText = "Error: no workspace" ;
320+
321+ createFreestyleProject (PROJECT_NAME );
322+
323+ String actualHeadingText = new HomePage (getDriver ())
324+ .openProject (PROJECT_NAME , new FreestyleProjectStatusPage (getDriver ()))
325+ .getSidebarComponent ()
326+ .clickSidebarWorkspace ()
327+ .getHeaderText ();
328+
329+ Assert .assertEquals (actualHeadingText , expectedHeadingText );
330+ }
331+
332+ private void createFreestyleProject (String name ) {
333+ new HomePage (getDriver ())
334+ .clickCreateJob ()
335+ .sendName (name )
336+ .selectFreestyleProjectAndSubmit ()
337+ .gotoHomePage ();
338+ }
316339}
0 commit comments