Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix headless test runner on macOS High Sierra #1298

Merged
merged 1 commit into from
Feb 27, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions crates/cli/src/bin/wasm-bindgen-test-runner/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,20 @@ impl Client {
Ok(x.value.session_id)
}
Driver::Safari(_) => {
#[derive(Deserialize)]
#[derive(Clone, Deserialize)]
struct Response {
// returned by `--legacy`
// returned by `--legacy` or by default on High Sierra and lower.
#[serde(rename = "sessionId")]
session_id: Option<String>,
// returned by the now-default `--w3c` mode
value: Option<Value>,
}
#[derive(Deserialize)]
#[derive(Clone, Deserialize)]
struct Value {
// This needs to be optional because both `--legacy` and High Sierra do not
// include a session id in the value entry.
#[serde(rename = "sessionId")]
session_id: String,
session_id: Option<String>,
}
let request = json!({
// this is needed for the now `--legacy` mode
Expand All @@ -303,7 +305,10 @@ impl Client {
}
});
let x: Response = self.post("/session", &request)?;
Ok(x.session_id.or(x.value.map(|v| v.session_id)).unwrap())
Ok(x.clone()
.session_id
.or_else(|| x.value.map(|v| v.session_id.unwrap()))
.unwrap())
}
Driver::Chrome(_) => {
#[derive(Deserialize)]
Expand Down