Jelajahi Sumber

[e2e] Build local image upon e2e + fix tests (#2598)

* Build local image upon e2e

* Pull the appropriate image

* Fix e2e tests on master (#2600)

Co-authored-by: Vlad Senyuta <66071557+VladSenyuta@users.noreply.github.com>
Roman Zabaluev 2 tahun lalu
induk
melakukan
e300aa7d19

+ 2 - 2
.github/workflows/e2e-checks.yaml

@@ -29,7 +29,7 @@ jobs:
       - name: pull docker
         id: pull_chrome
         run: |
-          docker pull selenium/standalone-chrome
+          docker pull selenium/standalone-chrome:103.0
       - name: Set up JDK 1.13
         uses: actions/setup-java@v1
         with:
@@ -38,7 +38,7 @@ jobs:
         id: build_app
         run: |
           mvn versions:set -DnewVersion=${{ github.event.pull_request.head.sha }}
-          mvn clean package -Dmaven.test.skip=true ${{ github.event.inputs.extraMavenOptions }}
+          mvn clean package -Pprod -Dmaven.test.skip=true ${{ github.event.inputs.extraMavenOptions }}
       - name: compose app
         id: compose_app
         # use the following command until #819 will be fixed

+ 6 - 3
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/connector/ConnectorsView.java

@@ -2,6 +2,7 @@ package com.provectus.kafka.ui.pages.connector;
 
 import com.codeborne.selenide.Condition;
 import com.codeborne.selenide.Selenide;
+import com.codeborne.selenide.SelenideElement;
 import com.provectus.kafka.ui.helpers.TestConfiguration;
 import com.provectus.kafka.ui.extensions.WaitUtils;
 import com.provectus.kafka.ui.utils.BrowserUtils;
@@ -24,14 +25,16 @@ public class ConnectorsView {
 
     @Step("Open 'Edit Config' of connector")
     public ConnectorUpdateView openEditConfig() {
-        BrowserUtils.javaExecutorClick($x("//button[@type='button']/span[.='Edit Config']"));
+        BrowserUtils.javaExecutorClick($x("//button[text()='Edit Config']"));
         return new ConnectorUpdateView();
     }
 
     @Step("Click 'Delete' button")
     public void clickDeleteButton() {
-        BrowserUtils.javaExecutorClick($x("//span[text()='Delete']"));
-        $(By.xpath("//button[text()='Submit']")).shouldBe(Condition.visible).click();
+        BrowserUtils.javaExecutorClick($x("//button[text()='Delete']"));
+        SelenideElement confirmButton = $x("//div[@role=\"dialog\"]//button[text()='Confirm']");
+        confirmButton.shouldBe(Condition.enabled).click();
+        confirmButton.shouldBe(Condition.disappear);
     }
 
     @Step

+ 8 - 4
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/schema/SchemaView.java

@@ -1,16 +1,18 @@
 package com.provectus.kafka.ui.pages.schema;
 
 import com.codeborne.selenide.Condition;
+import com.codeborne.selenide.SelenideElement;
 import com.provectus.kafka.ui.api.model.CompatibilityLevel;
 import com.provectus.kafka.ui.utils.BrowserUtils;
 import io.qameta.allure.Step;
 import org.openqa.selenium.By;
 
-import static com.codeborne.selenide.Selenide.$;
-import static com.codeborne.selenide.Selenide.$x;
+import static com.codeborne.selenide.Selenide.*;
 
 public class SchemaView {
 
+    protected SelenideElement dotMenuBtn = $$x("//button[@aria-label='Dropdown Toggle']").first();
+
     @Step
     public SchemaView waitUntilScreenReady() {
         $("div#schema").shouldBe(Condition.visible);
@@ -30,9 +32,11 @@ public class SchemaView {
     }
     @Step
     public SchemaRegistryList removeSchema() {
-        BrowserUtils.javaExecutorClick($(".dropdown.is-right button"));
+        BrowserUtils.javaExecutorClick(dotMenuBtn);
         $(By.xpath("//*[contains(text(),'Remove')]")).click();
-        $(By.xpath("//*[text()='Submit']")).shouldBe(Condition.visible).click();
+        SelenideElement confirmButton = $x("//div[@role=\"dialog\"]//button[text()='Confirm']");
+        confirmButton.shouldBe(Condition.enabled).click();
+        confirmButton.shouldBe(Condition.disappear);
         return new SchemaRegistryList();
     }
 }

+ 9 - 8
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicView.java

@@ -17,13 +17,12 @@ import static com.codeborne.selenide.Selenide.*;
 @ExtensionMethod({WaitUtils.class})
 public class TopicView {
 
-    private static final String path = "/ui/clusters/%s/topics/%s";
-    private final SelenideElement dotMenuHeader = $$(".dropdown.is-right button").first();
-    private final SelenideElement dotMenuFooter = $$(".dropdown.is-right button").get(1);
+    private static final String URL_PATH = "/ui/clusters/%s/topics/%s";
+    protected SelenideElement dotMenuBtn = $$x("//button[@aria-label='Dropdown Toggle']").first();
 
     @Step
     public TopicView goTo(String cluster, String topic) {
-        Selenide.open(TestConfiguration.BASE_WEB_URL + String.format(path, cluster, topic));
+        Selenide.open(TestConfiguration.BASE_WEB_URL + String.format(URL_PATH, cluster, topic));
         return this;
     }
 
@@ -35,7 +34,7 @@ public class TopicView {
 
     @Step
     public TopicCreateEditSettingsView openEditSettings() {
-        BrowserUtils.javaExecutorClick(dotMenuHeader);
+        BrowserUtils.javaExecutorClick(dotMenuBtn);
         $x("//a[text()= '" + DotMenuHeaderItems.EDIT_SETTINGS.getValue() + "']").click();
         return new TopicCreateEditSettingsView();
     }
@@ -48,9 +47,11 @@ public class TopicView {
 
     @Step
     public TopicsList deleteTopic() {
-        BrowserUtils.javaExecutorClick(dotMenuHeader);
-        $("#dropdown-menu").$(byLinkText(DotMenuHeaderItems.REMOVE_TOPIC.getValue())).click();
-        $$("div[role=\"dialog\"] button").find(Condition.exactText("Submit")).click();
+        BrowserUtils.javaExecutorClick(dotMenuBtn);
+        $x("//ul[@role='menu']//div[text()='Remove Topic']").click();
+        SelenideElement confirmButton = $x("//div[@role=\"dialog\"]//button[text()='Confirm']");
+        confirmButton.shouldBe(Condition.enabled).click();
+        confirmButton.shouldBe(Condition.disappear);
         return new TopicsList();
     }
 

+ 2 - 2
kafka-ui-e2e-checks/src/main/java/com/provectus/kafka/ui/pages/topic/TopicsList.java

@@ -15,7 +15,7 @@ import static com.codeborne.selenide.Selenide.*;
 @ExtensionMethod(WaitUtils.class)
 public class TopicsList {
 
-    private static final String path = "/ui/clusters/%s/topics";
+    private static final String path = "/ui/clusters/%s/all-topics";
 
     @Step
     public TopicsList goTo(String cluster) {
@@ -26,7 +26,7 @@ public class TopicsList {
     @Step
     public TopicsList waitUntilScreenReady() {
         $(By.xpath("//*[contains(text(),'Loading')]")).shouldBe(Condition.disappear);
-        $(By.xpath("//h1[text()='All Topics']")).shouldBe(Condition.visible);
+        $(By.xpath("//h1[text()='Topics']")).shouldBe(Condition.visible);
         return this;
     }
 

+ 1 - 1
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/base/BaseTest.java

@@ -41,7 +41,7 @@ public class BaseTest {
   protected Pages pages = Pages.INSTANCE;
   protected Helpers helpers = Helpers.INSTANCE;
 
-  private Screenshooter screenshooter = new Screenshooter();
+  private final Screenshooter screenshooter = new Screenshooter();
 
   protected static BrowserWebDriverContainer<?> webDriverContainer = null;
 

+ 2 - 1
kafka-ui-e2e-checks/src/test/java/com/provectus/kafka/ui/tests/TopicTests.java

@@ -101,7 +101,8 @@ public class TopicTests extends BaseTest {
                 .waitUntilScreenReady()
                 .openTopic(TOPIC_TO_DELETE)
                 .waitUntilScreenReady()
-                .deleteTopic()
+                .deleteTopic();
+        pages.openTopicsList(CLUSTER_NAME)
                 .waitUntilScreenReady()
                 .isTopicNotVisible(TOPIC_TO_DELETE);
     }