Adjust TestFormPostHTML to work on Linux chromedriver.
For some reason our headless Chrome test setup behaves slightly differently on Linux and macOS hosts. On Linux, the emoji characters are not recognized as valid text, so they are URL encoded. This change updates the test to cope with both cases correctly. Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
parent
5029495fdb
commit
d0b37a7c90
@ -185,7 +185,14 @@ func formpostExpectFavicon(t *testing.T, page *agouti.Page, expected string) {
|
||||
iconURL, err := page.First("#favicon").Attribute("href")
|
||||
require.NoError(t, err)
|
||||
require.True(t, strings.HasPrefix(iconURL, "data:image/svg+xml,<svg"))
|
||||
require.Contains(t, iconURL, expected)
|
||||
|
||||
// For some reason chromedriver on Linux returns this attribute urlencoded, but on macOS it contains the
|
||||
// original emoji bytes (unescaped). To check correctly in both cases we allow either version here.
|
||||
expectedEscaped := url.QueryEscape(expected)
|
||||
require.Truef(t,
|
||||
strings.Contains(iconURL, expected) || strings.Contains(iconURL, expectedEscaped),
|
||||
"expected %q to contain %q or %q", iconURL, expected, expectedEscaped,
|
||||
)
|
||||
}
|
||||
|
||||
// formpostInitiate navigates to the template server endpoint and expects the
|
||||
|
Loading…
Reference in New Issue
Block a user