Merge pull request #429 from provectus/hotfix/e2e-run
fixing e2e-checks run
This commit is contained in:
commit
5ae73948a3
8 changed files with 18 additions and 5 deletions
|
@ -3,12 +3,13 @@ package com.provectus.kafka.ui;
|
|||
import com.provectus.kafka.ui.base.BaseTest;
|
||||
import io.qameta.allure.Issue;
|
||||
import lombok.SneakyThrows;
|
||||
import org.junit.jupiter.api.Disabled;
|
||||
import org.junit.jupiter.api.DisplayName;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
public class SmokeTests extends BaseTest {
|
||||
|
||||
@Test
|
||||
@Disabled("till we get tests in ci run")
|
||||
@SneakyThrows
|
||||
@DisplayName("main page should load")
|
||||
@Issue("380")
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.openqa.selenium.remote.DesiredCapabilities;
|
|||
import org.testcontainers.containers.BindMode;
|
||||
import org.testcontainers.containers.GenericContainer;
|
||||
import org.testcontainers.utility.DockerImageName;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
|
||||
|
@ -47,7 +48,9 @@ public class BaseTest {
|
|||
"-conf", "/etc/selenoid/browsers.json", "-log-output-dir", "/opt/selenoid/logs");
|
||||
|
||||
static {
|
||||
Dotenv.load().entries().forEach(env -> System.setProperty(env.getKey(), env.getValue()));
|
||||
if (new File("./.env").exists()) {
|
||||
Dotenv.load().entries().forEach(env -> System.setProperty(env.getKey(), env.getValue()));
|
||||
}
|
||||
if (TestConfiguration.CLEAR_REPORTS_DIR) {
|
||||
clearReports();
|
||||
}
|
||||
|
@ -73,7 +76,8 @@ public class BaseTest {
|
|||
Configuration.reportsFolder = TestConfiguration.REPORTS_FOLDER;
|
||||
if (!TestConfiguration.USE_LOCAL_BROWSER) {
|
||||
Configuration.remote = remote;
|
||||
TestConfiguration.BASE_URL = TestConfiguration.BASE_URL.replace("localhost", "host.docker.internal");
|
||||
TestConfiguration.BASE_URL =
|
||||
TestConfiguration.BASE_URL.replace("localhost", "host.docker.internal");
|
||||
}
|
||||
Configuration.screenshots = TestConfiguration.SCREENSHOTS;
|
||||
Configuration.savePageSource = TestConfiguration.SAVE_PAGE_SOURCE;
|
|
@ -0,0 +1,7 @@
|
|||
package com.provectus.kafka.ui.screenshots;
|
||||
|
||||
public class NoReferenceScreenshotFoundException extends Throwable {
|
||||
public NoReferenceScreenshotFoundException(String name) {
|
||||
super(("no reference screenshot found for %s".formatted(name)));
|
||||
}
|
||||
}
|
|
@ -56,6 +56,7 @@ public class Screenshooter {
|
|||
compareScreenshots(name, false);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void compareScreenshots(String name, boolean shouldUpdateScreenshotIfDiffer) {
|
||||
if (TURN_OFF_SCREENSHOTS) {
|
||||
return;
|
||||
|
@ -64,7 +65,7 @@ public class Screenshooter {
|
|||
if (SHOULD_SAVE_SCREENSHOTS_IF_NOT_EXIST) {
|
||||
updateActualScreenshot(name);
|
||||
} else {
|
||||
fail("no reference screenshot found for %s".formatted(name));
|
||||
throw new NoReferenceScreenshotFoundException(name);
|
||||
}
|
||||
} else {
|
||||
makeImageDiff(name, shouldUpdateScreenshotIfDiffer);
|
||||
|
@ -124,7 +125,7 @@ public class Screenshooter {
|
|||
@SneakyThrows
|
||||
private byte[] imgToBytes(String filename) {
|
||||
BufferedImage bImage2 = ImageIO.read(new File(filename));
|
||||
ByteArrayOutputStream bos2 = new ByteArrayOutputStream();
|
||||
var bos2 = new ByteArrayOutputStream();
|
||||
ImageIO.write(bImage2, "png", bos2);
|
||||
return bos2.toByteArray();
|
||||
}
|
Loading…
Add table
Reference in a new issue