626: refactor to use beforeEach and afterEach
This commit is contained in:
parent
cd9bc5f54d
commit
fdbecf3638
1 changed files with 16 additions and 20 deletions
|
@ -4,49 +4,45 @@ import com.provectus.kafka.ui.base.BaseTest;
|
|||
import com.provectus.kafka.ui.pages.MainPage;
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class TopicTests extends BaseTest {
|
||||
|
||||
|
||||
public static final String NEW_TOPIC = "new-topic";
|
||||
public static final String TOPIC_FOR_UPDATE = "topic-for-update";
|
||||
public static final String SECOND_LOCAL = "secondLocal";
|
||||
|
||||
@BeforeEach
|
||||
@SneakyThrows
|
||||
void beforeEach() {
|
||||
helpers.apiHelper.createTopic(SECOND_LOCAL, NEW_TOPIC);
|
||||
}
|
||||
|
||||
@AfterEach
|
||||
@SneakyThrows
|
||||
void afterEach() {
|
||||
helpers.apiHelper.deleteTopic(SECOND_LOCAL, NEW_TOPIC);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@DisplayName("should create a topic")
|
||||
@Test
|
||||
void createTopic(){
|
||||
try {
|
||||
helpers.apiHelper.createTopic("secondLocal", "new-topic");
|
||||
pages.open()
|
||||
.shouldBeOnPage()
|
||||
.goToSideMenu("secondLocal", MainPage.SideMenuOptions.TOPICS)
|
||||
.shouldBeTopic(NEW_TOPIC);
|
||||
} finally {
|
||||
helpers.apiHelper.deleteTopic("secondLocal","new-topic");
|
||||
}
|
||||
pages.open()
|
||||
.shouldBeOnPage()
|
||||
.goToSideMenu("secondLocal", MainPage.SideMenuOptions.TOPICS)
|
||||
.shouldBeTopic(NEW_TOPIC);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
@DisplayName("should update a topic")
|
||||
@Test
|
||||
void updateTopic(){
|
||||
try {
|
||||
helpers.apiHelper.createTopic(SECOND_LOCAL, TOPIC_FOR_UPDATE);
|
||||
pages.openTopicPage()
|
||||
.shouldBeOnPage()
|
||||
.openTopic(TOPIC_FOR_UPDATE)
|
||||
.openEditSettings();
|
||||
} finally {
|
||||
helpers.apiHelper.deleteTopic(SECOND_LOCAL,TOPIC_FOR_UPDATE);
|
||||
}
|
||||
pages.openTopicPage()
|
||||
.shouldBeOnPage()
|
||||
.openTopic(NEW_TOPIC)
|
||||
.openEditSettings();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue