Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions src/test/java/school/redrover/FreestyleProjectTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package school.redrover;

import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.Assert;
import org.testng.annotations.Test;
import school.redrover.common.BaseTest;
Expand Down Expand Up @@ -299,10 +297,12 @@ public void testAddParameterForParameterizationOfBuilds() {
Assert.assertTrue(selectedParameterList.contains(parameterName));
}

@Test(dependsOnMethods = "testCreate")
@Test
public void testNavigationToWorkspaceAfterBuild() {
final String expectedHeadingText = "Workspace of " + PROJECT_NAME + " on Built-In Node";

createFreestyleProject(PROJECT_NAME);

String actualHeadingText = new HomePage(getDriver())
.openProject(PROJECT_NAME, new FreestyleProjectStatusPage(getDriver()))
.getSidebarComponent()
Expand All @@ -313,4 +313,27 @@ public void testNavigationToWorkspaceAfterBuild() {

Assert.assertEquals(actualHeadingText, expectedHeadingText);
}

@Test
public void testErrorMessageForProjectWithNoWorkspace() {
final String expectedHeadingText = "Error: no workspace";

createFreestyleProject(PROJECT_NAME);

String actualHeadingText = new HomePage(getDriver())
.openProject(PROJECT_NAME, new FreestyleProjectStatusPage(getDriver()))
.getSidebarComponent()
.clickSidebarWorkspace()
.getHeaderText();

Assert.assertEquals(actualHeadingText, expectedHeadingText);
}

private void createFreestyleProject(String name) {
Copy link
Collaborator

@1user11 1user11 Jan 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Привет @Elena-Galina! Я бы перенесла метод createFreestyleProject() из тестового класса в Page (Home Page) в этом PR. А позже надо будет подумать как написать этот метод более универсально, для create любого проекта, передавая ему два параметра - тип проекта, и имя. Что ты думаешь по этому поводу?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Привет, да, были мысли по поводу необходимости базового метода для создания любого проекта. Об этом надо отдельно подумать. Сейчас, считаю, переносить createFreestyleProject() в HomePage особо ничего не даст, т.к. он используется только в текущем тестовом классе. И на данный момент в других классах тоже существует метод create....(). Надо это сделать сразу для всех страниц. Там тоже скорее всего придется использовать дженерик.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ок, тогда пока оставляем как есть.

new HomePage(getDriver())
.clickCreateJob()
.sendName(name)
.selectFreestyleProjectAndSubmit()
.gotoHomePage();
}
}