Skip to content

Commit

Permalink
fix(test): prevent geckodriver from updating to latest on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ashleygwilliams committed Jan 25, 2020
1 parent 846b989 commit 7af794b
Showing 1 changed file with 23 additions and 18 deletions.
41 changes: 23 additions & 18 deletions src/test/webdriver/geckodriver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ use target;

// Keep it up to date with each `wasm-pack` release.
// https://github.com/mozilla/geckodriver/releases/latest
const DEFAULT_GECKODRIVER_VERSION: &str = "v0.24.0";
const DEFAULT_GECKODRIVER_VERSION: &str = "v0.26.0";
const DEFAULT_WINDOWS_GECKODRIVER_VERSION: &str = "v0.24.0";

const GECKODRIVER_LAST_UPDATED_STAMP: &str = "geckodriver_last_updated";
const GECKODRIVER_VERSION_STAMP: &str = "geckodriver_version";
Expand Down Expand Up @@ -78,25 +79,29 @@ fn get_geckodriver_url(target: &str, ext: &str) -> String {
.and_then(save_geckodriver_version)
};

let geckodriver_version = match stamps::read_stamps_file_to_json() {
Ok(json) => {
if should_load_geckodriver_version_from_stamp(&json) {
stamps::get_stamp_value(GECKODRIVER_VERSION_STAMP, &json)
} else {
fetch_and_save_version()
let geckodriver_version = if target::WINDOWS {
DEFAULT_WINDOWS_GECKODRIVER_VERSION.to_owned()
} else {
match stamps::read_stamps_file_to_json() {
Ok(json) => {
if should_load_geckodriver_version_from_stamp(&json) {
stamps::get_stamp_value(GECKODRIVER_VERSION_STAMP, &json)
} else {
fetch_and_save_version()
}
}
Err(_) => fetch_and_save_version(),
}
Err(_) => fetch_and_save_version(),
}
.unwrap_or_else(|error| {
log::warn!(
"Cannot load or fetch geckodriver's latest version data, \
the default version {} will be used. Error: {}",
DEFAULT_GECKODRIVER_VERSION,
error
);
DEFAULT_GECKODRIVER_VERSION.to_owned()
});
.unwrap_or_else(|error| {
log::warn!(
"Cannot load or fetch geckodriver's latest version data, \
the default version {} will be used. Error: {}",
DEFAULT_GECKODRIVER_VERSION,
error
);
DEFAULT_GECKODRIVER_VERSION.to_owned()
})
};
assemble_geckodriver_url(&geckodriver_version, target, ext)
}

Expand Down

0 comments on commit 7af794b

Please sign in to comment.