From ca48a0518ec9e0a4ac99eff5645240835e663433 Mon Sep 17 00:00:00 2001 From: Pelayori <31128562+Pelayori@users.noreply.github.com> Date: Mon, 18 Mar 2024 23:07:42 +0100 Subject: [PATCH] Test unit tests --- .github/workflows/unit-tests-push.yml | 4 ++++ src/test/java/com/uniovi/Wiq_IntegrationTests.java | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unit-tests-push.yml b/.github/workflows/unit-tests-push.yml index 5845bc1d..17c7b776 100644 --- a/.github/workflows/unit-tests-push.yml +++ b/.github/workflows/unit-tests-push.yml @@ -28,6 +28,10 @@ jobs: uses: actions/setup-java@v1 with: java-version: '17' + - name: Install Firefox + run: | + sudo apt-get update + sudo apt-get install -y firefox - name: Add exec permission to mvnw run: chmod +x mvnw - name: Run all tests with sonar analysis diff --git a/src/test/java/com/uniovi/Wiq_IntegrationTests.java b/src/test/java/com/uniovi/Wiq_IntegrationTests.java index 9c07cca9..a723381a 100644 --- a/src/test/java/com/uniovi/Wiq_IntegrationTests.java +++ b/src/test/java/com/uniovi/Wiq_IntegrationTests.java @@ -5,6 +5,7 @@ import org.openqa.selenium.WebDriver; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.firefox.FirefoxDriver; +import org.openqa.selenium.firefox.FirefoxOptions; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.test.annotation.DirtiesContext; import org.springframework.test.context.ActiveProfiles; @@ -19,10 +20,13 @@ class Wiq_IntegrationTests { static WebDriver driver; + @BeforeAll static public void begin() { WebDriverManager.firefoxdriver().setup(); - driver = new FirefoxDriver(); + FirefoxOptions options = new FirefoxOptions(); + options.addArguments("--headless"); // Run Firefox in headless mode + driver = new FirefoxDriver(options); driver.navigate().to(URL); }