From a7cd22bb5151c370eb383247b29b077a6e105c8a Mon Sep 17 00:00:00 2001 From: damiendesvent Date: Mon, 6 Nov 2023 14:35:19 -0500 Subject: [PATCH] add docker support for selenium microservice --- docker-compose.yml | 10 +++++++ selenium/src/main/java/ca/etsmtl/Main.java | 34 ---------------------- testapi/Dockerfile | 2 +- 3 files changed, 11 insertions(+), 35 deletions(-) delete mode 100644 selenium/src/main/java/ca/etsmtl/Main.java diff --git a/docker-compose.yml b/docker-compose.yml index 4755ec9..bb7f919 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,6 +8,7 @@ services: ports: # TEST_API_SERVICE_PORT is defined as env variable in .docker_config.env - "${TEST_API_SERVICE_PORT}:${TEST_API_SERVICE_PORT}" + backend: image: back container_name: back @@ -19,6 +20,7 @@ services: env_file: # Specifying the env file with necessaries values - .docker_config.env + frontend: image: front container_name: front @@ -28,3 +30,11 @@ services: - "4200:80" depends_on: - backend + + selenium: + image: selenium + container_name: selenium + build: + context: ./selenium + ports: + - "8090:8090" diff --git a/selenium/src/main/java/ca/etsmtl/Main.java b/selenium/src/main/java/ca/etsmtl/Main.java deleted file mode 100644 index 5d41389..0000000 --- a/selenium/src/main/java/ca/etsmtl/Main.java +++ /dev/null @@ -1,34 +0,0 @@ -package ca.etsmtl; - -import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; -import org.openqa.selenium.WebElement; -import org.openqa.selenium.chrome.ChromeDriver; - -import java.util.concurrent.TimeUnit; - - -public class Main { - String website_url = "https://www.selenium.dev/selenium/web/web-form.html"; - - public static void main(String[] args) { - WebDriver driver = new ChromeDriver(website_url); - - driver.get(); - - driver.getTitle(); - - driver.manage().timeouts().implicitlyWait(1,TimeUnit.SECONDS); - - WebElement textBox = driver.findElement(By.name("my-text")); - WebElement submitButton = driver.findElement(By.cssSelector("button")); - - textBox.sendKeys("Selenium"); - submitButton.click(); - - WebElement message = driver.findElement(By.id("message")); - message.getText(); - - driver.quit(); - } -} \ No newline at end of file diff --git a/testapi/Dockerfile b/testapi/Dockerfile index 6077536..60a5b26 100644 --- a/testapi/Dockerfile +++ b/testapi/Dockerfile @@ -3,5 +3,5 @@ WORKDIR /testapi COPY pom.xml ./ COPY ./src ./src RUN mvn clean install -EXPOSE 8082 +EXPOSE 8090 ENTRYPOINT ["mvn", "spring-boot:run" ] \ No newline at end of file