From 8fd8f1c8317c4597953aed4535915046f65fcc00 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 9 Sep 2024 10:09:00 +0200 Subject: [PATCH] test: remove per-context proxy hacks for Windows/Chromium (#1668) --- .../playwright/TestBrowserContextFetch.java | 2 +- .../playwright/TestBrowserContextProxy.java | 25 ------------------- .../playwright/TestClientCertificates.java | 7 ------ 3 files changed, 1 insertion(+), 33 deletions(-) diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextFetch.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextFetch.java index 3737129c7..0e9e9acc7 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextFetch.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextFetch.java @@ -218,7 +218,7 @@ void shouldWorkWithContextLevelProxy() throws ExecutionException, InterruptedExc writer.write("Served by the proxy"); } }); - try (Browser browser = browserType.launch(new BrowserType.LaunchOptions().setProxy("http://per-context"))) { + try (Browser browser = browserType.launch()) { BrowserContext context = browser.newContext(new Browser.NewContextOptions().setProxy("localhost:" + server.PORT)); Future request = server.futureRequest("/target.html"); APIResponse response = context.request().get("http://non-existent.com/target.html"); diff --git a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextProxy.java b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextProxy.java index a054cb9a7..877661b99 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextProxy.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestBrowserContextProxy.java @@ -29,31 +29,6 @@ import static org.junit.jupiter.api.Assertions.*; public class TestBrowserContextProxy extends TestBase { - - @Override - @BeforeAll - // Hide base class method to provide extra option. - void launchBrowser() { - BrowserType.LaunchOptions options = createLaunchOptions(); - options.setProxy(new Proxy("per-context")); - launchBrowser(options); - } - - static boolean isChromiumWindows() { - return isChromium() && isWindows; - } - - @Test - @EnabledIf(value="isChromiumWindows", disabledReason="Platform-specific") - void shouldThrowForMissingGlobalProxyOnChromiumWindows() { - try (Browser browser = browserType.launch(createLaunchOptions())) { - PlaywrightException e = assertThrows(PlaywrightException.class, () -> { - browser.newContext(new Browser.NewContextOptions().setProxy("localhost:" + server.PORT)); - }); - assertTrue(e.getMessage().contains("Browser needs to be launched with the global proxy")); - } - } - void shouldThrowForBadServerValue() { // Enforced by compiler in Java } diff --git a/playwright/src/test/java/com/microsoft/playwright/TestClientCertificates.java b/playwright/src/test/java/com/microsoft/playwright/TestClientCertificates.java index e372d9680..eac2e7398 100644 --- a/playwright/src/test/java/com/microsoft/playwright/TestClientCertificates.java +++ b/playwright/src/test/java/com/microsoft/playwright/TestClientCertificates.java @@ -57,13 +57,6 @@ void stopServer() { super.stopServer(); } - @BeforeAll - @Override - void launchBrowser() { - // TODO: remove once Chromium Stable tests pass without it on Windows. - launchBrowser(createLaunchOptions().setProxy(new Proxy("per-context"))); - } - @Test public void shouldFailWithNoClientCertificatesProvided() { APIRequestContext request = playwright.request().newContext(