Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove per-context proxy hacks for Windows/Chromium #1668

Merged
merged 2 commits into from
Sep 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ void shouldWorkWithContextLevelProxy() throws ExecutionException, InterruptedExc
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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading