Skip to content

Instantly share code, notes, and snippets.

@alastairs
Created May 6, 2017 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alastairs/6c3b1ce626d5bbeee6f0757be1a36a4c to your computer and use it in GitHub Desktop.
Save alastairs/6c3b1ce626d5bbeee6f0757be1a36a4c to your computer and use it in GitHub Desktop.
Failing GitHub authorisation
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