Checks/fix e2e tests (#987)

* #626 fix delete topic test

* #626 increase waiting time for topic update

* #626 increase the waiting time for the topic update to 5 minutes

* #626 delete refreshing pages for update topic test
This commit is contained in:
Anna Antipova 2021-10-20 12:21:45 +03:00 committed by GitHub
parent 547863fdb2
commit 8a36af12b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 11 deletions

View file

@ -25,7 +25,7 @@ public class WaitUtils {
refresh();
i++;
sleep(2000);
} while (!selectedValue.equals(element.getSelectedValue()) && i != 40);
} while (!selectedValue.equals(element.getSelectedValue()) && i != 60);
Assertions.assertEquals(selectedValue, element.getSelectedValue()) ;
}
}

View file

@ -4,6 +4,7 @@ import com.provectus.kafka.ui.api.ApiClient;
import com.provectus.kafka.ui.api.api.TopicsApi;
import com.provectus.kafka.ui.api.model.TopicCreation;
import lombok.SneakyThrows;
import org.springframework.web.reactive.function.client.WebClientResponseException;
public class ApiHelper {
int partitions = 1;
@ -35,7 +36,12 @@ public class ApiHelper {
@SneakyThrows
public void deleteTopic(String clusterName, String topicName) {
topicApi().deleteTopic(clusterName,topicName).block();
try {
topicApi().deleteTopic(clusterName, topicName).block();
} catch (WebClientResponseException ex) {
if (ex.getRawStatusCode() != 404) // except already deleted
throw ex;
}
}
}

View file

@ -1,5 +1,6 @@
package com.provectus.kafka.ui.pages;
import com.codeborne.selenide.Condition;
import com.codeborne.selenide.Selenide;
import com.codeborne.selenide.SelenideElement;
import com.provectus.kafka.ui.base.TestConfiguration;
@ -25,6 +26,14 @@ public class TopicView {
Selenide.open(TestConfiguration.BASE_URL+path.formatted(cluster,topic));
return this;
}
@Step
public TopicsList isOnTopicListPage() {
$(By.xpath("//*[contains(text(),'Loading')]")).shouldBe(Condition.disappear);
$(By.xpath("//span[text()='All Topics']")).shouldBe(Condition.visible);
return new TopicsList();
}
@SneakyThrows
public TopicView openEditSettings() {
$(By.xpath("//a[@class=\"button\" and text()='Edit settings']")).click();
@ -32,9 +41,10 @@ public class TopicView {
}
@SneakyThrows
public void clickDeleteTopicButton() {
public TopicView clickDeleteTopicButton() {
$(By.xpath("//*[text()='Delete Topic']")).click();
$(By.xpath("//*[text()='Confirm']")).click();
return this;
}
@SneakyThrows

View file

@ -57,7 +57,6 @@ public class TopicTests extends BaseTest {
pages.openTopicsList(SECOND_LOCAL)
.isOnPage()
.openTopic(TOPIC_TO_UPDATE);
Selenide.refresh();
pages.openTopicView(SECOND_LOCAL, TOPIC_TO_UPDATE)
.openEditSettings()
.changeCleanupPolicy(COMPACT_POLICY_VALUE)
@ -65,7 +64,6 @@ public class TopicTests extends BaseTest {
.changeMaxSizeOnDisk(UPDATED_MAX_SIZE_ON_DISK)
.changeMaxMessageBytes(UPDATED_MAX_MESSAGE_BYTES)
.submitSettingChanges();
Selenide.refresh();
pages.openTopicView(SECOND_LOCAL, TOPIC_TO_UPDATE)
.openEditSettings()
// Assertions
@ -78,15 +76,13 @@ public class TopicTests extends BaseTest {
@SneakyThrows
@DisplayName("should delete topic")
@Test
@Disabled
void deleteTopic() {
pages.openTopicsList(SECOND_LOCAL)
.isOnPage()
.openTopic(TOPIC_TO_DELETE);
pages.openTopicView(SECOND_LOCAL, TOPIC_TO_DELETE).clickDeleteTopicButton();
pages.openTopicsList(SECOND_LOCAL).isNotVisible(TOPIC_TO_DELETE);
pages.openTopicView(SECOND_LOCAL, TOPIC_TO_DELETE)
.clickDeleteTopicButton()
.isOnTopicListPage()
.isNotVisible(TOPIC_TO_DELETE);
}
}