Created
May 6, 2017 14:26
-
-
Save alastairs/6c3b1ce626d5bbeee6f0757be1a36a4c to your computer and use it in GitHub Desktop.
Failing GitHub authorisation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ScreenCap } from "../../helpers/ScreenCap" | |
import { Casper } from "casperjs" | |
export class GitHubSignIn { | |
private readonly OAUTH_AUTHORISATION_FORM = '.oauth-review-permissions form[method=post]'; | |
constructor(private casper: Casper, private screencap: ScreenCap) { } | |
login(username: string, password: string): void { | |
this.casper | |
.then(() => { | |
this.casper.fill('form[method=post]', { | |
"login": username, | |
"password": password | |
}, true) | |
}) | |
.then(() => { | |
this.casper.waitFor(() => this.casper.evaluate(() => document.querySelectorAll(this.OAUTH_AUTHORISATION_FORM))) | |
}).then(() => { | |
this.casper.test.assertUrlMatch( | |
/github.com\/login\/oauth\/authorize/, | |
"GitHub application authorisation page is displayed"); | |
this.screencap.take("gitHubAuthorisation.png"); | |
this.casper.fill(this.OAUTH_AUTHORISATION_FORM, {}, true); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment