Skip to content

Commit

Permalink
test: unflake cookie roundtrip (#1388)
Browse files Browse the repository at this point in the history
  • Loading branch information
yury-s authored Sep 19, 2023
1 parent f629f91 commit 4312a98
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ void shouldWork() {
assertEquals("password=123456", page.evaluate("document.cookie"));
}

// Slightly different rounding on chromium win.
private static List<Cookie> normalizeExpires(List<Cookie> cookies) {
for (Cookie cookie: cookies) {
cookie.expires = (double) Math.round(cookie.expires);
}
return cookies;
}

@Test
void shouldRoundtripCookie() {
page.navigate(server.EMPTY_PAGE);
Expand All @@ -53,7 +61,7 @@ void shouldRoundtripCookie() {
context.clearCookies();
assertEquals(0, context.cookies().size());
context.addCookies(cookies);
assertJsonEquals(cookies, context.cookies());
assertJsonEquals(normalizeExpires(cookies), normalizeExpires(context.cookies()));
}

@Test
Expand Down

0 comments on commit 4312a98

Please sign in to comment.