Skip to content

Commit

Permalink
Disable OIDC with remote server to make test stable
Browse files Browse the repository at this point in the history
  • Loading branch information
hoangdat committed Aug 6, 2024
1 parent 9cf25f5 commit 0895521
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 27 deletions.
4 changes: 2 additions & 2 deletions scripts/run-desktop-integration-tests.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

docker run -d -p 2023:80 --name tmail-web -v "$(pwd)/env.file:/usr/share/nginx/html/assets/env.file" tmail-web:integration-test
./mvnw test
# docker run -d -p 2023:80 --name tmail-web -v "$(pwd)/env.file:/usr/share/nginx/html/assets/env.file" tmail-web:integration-test
./mvnw test
15 changes: 13 additions & 2 deletions tmail_integration_test/src/main/java/com/tmail/base/TestBase.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.tmail.base;

import java.io.IOException;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Properties;
import java.util.stream.Stream;
Expand All @@ -15,10 +16,12 @@
import org.junit.jupiter.params.provider.MethodSource;

import com.microsoft.playwright.Browser;
import com.microsoft.playwright.Browser.NewContextOptions;
import com.microsoft.playwright.BrowserContext;
import com.microsoft.playwright.BrowserType;
import com.microsoft.playwright.Page;
import com.microsoft.playwright.Playwright;
import com.microsoft.playwright.Tracing;

@ExtendWith(CustomParameterResolver.class)
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
Expand Down Expand Up @@ -55,13 +58,21 @@ public void setUp(SupportedPlatform supportedPlatform) {
case FIREFOX -> playwright.firefox().launch(new BrowserType.LaunchOptions().setHeadless(runHeadlessTest));
default -> throw new UnsupportedPlatformException();
};
browserContext = browser.newContext(
new Browser.NewContextOptions().setViewportSize(1920, 1080));

NewContextOptions contextOptions = new Browser.NewContextOptions()
.setViewportSize(1920, 1080);
browserContext = browser.newContext(contextOptions);
browserContext.tracing().start(new Tracing.StartOptions()
.setScreenshots(true)
.setSnapshots(true));

page = browserContext.newPage();
}

@AfterEach
public void tearDown() {
browserContext.tracing().stop(new Tracing.StopOptions()
.setPath(Paths.get("trace.zip")));
page.close();
browserContext.close();
browser.close();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package com.tmail.preprod.oidc.composeEmail;
// package com.tmail.preprod.oidc.composeEmail;

import com.tmail.base.TestBase;
import com.tmail.scenarios.ComposeEmailScenario;
// import com.tmail.base.TestBase;
// import com.tmail.scenarios.ComposeEmailScenario;

public class ComposeEmailTest extends TestBase {
// public class ComposeEmailTest extends TestBase {

ComposeEmailTest() {
scenario = new ComposeEmailScenario(
properties.getProperty("app.hostUrl"),
properties.getProperty("user.name"),
properties.getProperty("user.password"),
properties.getProperty("user.additionalMailRecipent"));
}
// ComposeEmailTest() {
// scenario = new ComposeEmailScenario(
// properties.getProperty("app.hostUrl"),
// properties.getProperty("user.name"),
// properties.getProperty("user.password"),
// properties.getProperty("user.additionalMailRecipent"));
// }

}
// }
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.tmail.preprod.oidc.login;
// package com.tmail.preprod.oidc.login;

import com.tmail.base.TestBase;
import com.tmail.scenarios.OidcLoginScenario;
// import com.tmail.base.TestBase;
// import com.tmail.scenarios.OidcLoginScenario;

public class OidcLoginTest extends TestBase {
// public class OidcLoginTest extends TestBase {

OidcLoginTest() {
scenario = new OidcLoginScenario(
properties.getProperty("app.hostUrl"),
properties.getProperty("user.name"),
properties.getProperty("user.password"));
}
// OidcLoginTest() {
// scenario = new OidcLoginScenario(
// properties.getProperty("app.hostUrl"),
// properties.getProperty("user.name"),
// properties.getProperty("user.password"));
// }

}
// }

0 comments on commit 0895521

Please sign in to comment.