Skip to content

Commit

Permalink
Skip headed like
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s committed Nov 15, 2024
1 parent ee3fe47 commit 073ca16
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,15 @@

public class TestBrowserContextCredentials extends TestBase {

static boolean isChromiumHeadful() {
return isChromium() && isHeadful();
static boolean isChromiumHeadedLike() {
// --headless=new, the default in all Chromium channels, is like headless.
return isChromium() && (isHeadful() || getBrowserChannelFromEnv() != null);
}

static boolean isChromiumChannel() {
// net::ERR_INVALID_AUTH_CREDENTIALS is thrown in --headless=new which
// is the default in all Chromium channels.
return isChromium() && getBrowserChannelFromEnv() != null;
}


@Test
@DisabledIf(value="isChromiumHeadful", disabledReason="fail")
@DisabledIf(value="isChromiumHeadedLike", disabledReason="fail")
void shouldFailWithoutCredentials() {
System.out.println("channel2 " + getBrowserChannelFromEnv());
server.setAuth("/empty.html", "user", "pass");
Response response = page.navigate(server.EMPTY_PAGE);
assertEquals(401, response.status());
Expand Down Expand Up @@ -110,6 +105,7 @@ void shouldWorkWithCorrectCredentialsAndMatchingOriginCaseInsensitive() {
}

@Test
@DisabledIf(value="isChromiumHeadedLike", disabledReason="fail")
void shouldFailWithCorrectCredentialsAndWrongOriginScheme() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
Expand All @@ -122,6 +118,7 @@ void shouldFailWithCorrectCredentialsAndWrongOriginScheme() {
}

@Test
@DisabledIf(value="isChromiumHeadedLike", disabledReason="fail")
void shouldFailWithCorrectCredentialsAndWrongOriginHostname() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
Expand All @@ -134,6 +131,7 @@ void shouldFailWithCorrectCredentialsAndWrongOriginHostname() {
}

@Test
@DisabledIf(value="isChromiumHeadedLike", disabledReason="fail")
void shouldFailWithCorrectCredentialsAndWrongOriginPort() {
server.setAuth("/empty.html", "user", "pass");
final HttpCredentials httpCredentials = new HttpCredentials("user", "pass");
Expand Down

0 comments on commit 073ca16

Please sign in to comment.