jonhoo / fantoccini

A high-level API for programmatically interacting with web pages through WebDriver.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bug: Some tests fail in non-English speaking countries.

xmeta opened this issue · comments

commented

If you run the tests in a non-English speaking country, Some tests will fail.

thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `"https://ja.wikipedia.org/wiki/Foobar"`,
 right: `"https://en.wikipedia.org/wiki/Foobar"`', tests\remote.rs:62:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread '<unnamed>' panicked at 'assertion failed: `(left == right)`
  left: `"https://ja.wikipedia.org/wiki/Foobar"`,
 right: `"https://en.wikipedia.org/wiki/Foobar"`', tests\remote.rs:46:5
test chrome::it_finds_sub_elements ... ok
thread '<unnamed>' panicked at 'test panicked: JoinError::Panic(...)', tests\remote.rs:269:9
test chrome::it_clicks ... FAILED
thread '<unnamed>' panicked at 'test panicked: JoinError::Panic(...)', tests\remote.rs:274:9
test chrome::it_clicks_by_locator ... FAILED
failures:
    chrome::it_clicks
    chrome::it_clicks_by_locator
    firefox::it_clicks
    firefox::it_clicks_by_locator

c.goto("https://www.wikipedia.org/").await?;
// find, fill out, and submit the search form
let mut f = c.form(Locator::Css("#search-form")).await?;
let f = f
.set(Locator::Css("input[name='search']"), "foobar")
.await?;
f.submit().await?;
// we should now have ended up in the rigth place
let url = c.current_url().await?;
assert_eq!(url.as_ref(), "https://en.wikipedia.org/wiki/Foobar");

c.goto("https://www.wikipedia.org/").await?;
// find, fill out, and submit the search form
let mut f = c.form(Locator::Css("#search-form")).await?;
let f = f.set_by_name("search", "foobar").await?;
f.submit().await?;
// we should now have ended up in the rigth place
let url = c.current_url().await?;
assert_eq!(url.as_ref(), "https://en.wikipedia.org/wiki/Foobar");

Ah, that's a good point! We really should move all of these tests to use local HTML files instead of relying on wikipedia. If you're up to the task, then please do go for it! Otherwise, I suppose the simpler way to go about it is to change the tests to use en.wikipedia.org directly.

I think this should now be fixed. And testing using local HTML files is tracked in #76