mirror of
https://github.com/microsoft/playwright-java.git
synced 2025-12-28 02:15:15 +00:00
test: remove per-context proxy hacks for Windows/Chromium (#1668)
This commit is contained in:
parent
7d2066693b
commit
8fd8f1c831
@ -218,7 +218,7 @@ public class TestBrowserContextFetch extends TestBase {
|
||||
writer.write("<title>Served by the proxy</title>");
|
||||
}
|
||||
});
|
||||
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<Server.Request> request = server.futureRequest("/target.html");
|
||||
APIResponse response = context.request().get("http://non-existent.com/target.html");
|
||||
|
||||
@ -29,31 +29,6 @@ import java.util.List;
|
||||
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
|
||||
}
|
||||
|
||||
@ -57,13 +57,6 @@ public class TestClientCertificates extends TestBase {
|
||||
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(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user