Skip to content

Commit

Permalink
added more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glena committed Feb 3, 2017
1 parent 3121fa3 commit b735192
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 39 deletions.
8 changes: 4 additions & 4 deletions example/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
</head>
<body class="container">

<input class="login-username" value="johnfoo@gmail.com" />
<input type="password" class="login-password" value="1234" />
<input class="login-scope" value="openid" />
<input class="login-response-type" value="token" />
<input id="login-username" value="" />
<input id="login-password" type="password" value="" />
<input id="login-scope" value="" />
<input id="login-response-type" value="" />
<input type="button" class="login-redirect-usernamepassword" value="redirect usernamepassword" />
<input type="button" class="login-redirect-authorize" value="redirect authorize" />

Expand Down
96 changes: 95 additions & 1 deletion integration/redirect_authorize.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,105 @@ describe('redirect authorize', function () {
var By = webdriver.By;
var until = webdriver.until;

it('should result in a successful transaction ' + browser, function () {
it('[token] should result in a successful transaction ' + browser, function () {
var driver = clientFactory();

driver.get('https://auth0.github.io/auth0.js/example/test.html');
driver.wait(until.elementLocated(By.id('loaded')), 10000);
driver.findElement(By.id('login-response-type')).sendKeys('token');
driver.findElement(By.className('login-redirect-authorize')).click();
driver.wait(until.elementLocated(By.id('hlploaded')), 30000);
driver.findElement(By.id('email')).sendKeys('johnfoo@gmail.com');
driver.findElement(By.id('password')).sendKeys('1234');
driver.findElement(By.id('upLogin')).click();
driver.wait(until.elementLocated(By.id('parsed')), 10000);

driver.findElement(By.id('err')).getText().then(function(value) {
expect(value).to.equal('');
});

driver.findElement(By.id('result')).getText().then(function(value) {
expect(value).to.not.equal('');
});

return driver.quit();
});

it('[code] should result in a successful transaction ' + browser, function () {
var driver = clientFactory();

driver.get('https://auth0.github.io/auth0.js/example/test.html');
driver.wait(until.elementLocated(By.id('loaded')), 10000);
driver.findElement(By.id('login-response-type')).sendKeys('code');
driver.findElement(By.className('login-redirect-authorize')).click();
driver.wait(until.elementLocated(By.id('hlploaded')), 30000);
driver.findElement(By.id('email')).sendKeys('johnfoo@gmail.com');
driver.findElement(By.id('password')).sendKeys('1234');
driver.findElement(By.id('upLogin')).click();
driver.wait(until.elementLocated(By.id('parsed')), 10000);

driver.getTitle().then(function(url) {
expect(value).to.contain('code=');
});

return driver.quit();
});

it('[token openid] should result in a successful transaction ' + browser, function () {
var driver = clientFactory();

driver.get('https://auth0.github.io/auth0.js/example/test.html');
driver.wait(until.elementLocated(By.id('loaded')), 10000);
driver.findElement(By.id('login-scope')).sendKeys('openid');
driver.findElement(By.id('login-response-type')).sendKeys('token');
driver.findElement(By.className('login-redirect-authorize')).click();
driver.wait(until.elementLocated(By.id('hlploaded')), 30000);
driver.findElement(By.id('email')).sendKeys('johnfoo@gmail.com');
driver.findElement(By.id('password')).sendKeys('1234');
driver.findElement(By.id('upLogin')).click();
driver.wait(until.elementLocated(By.id('parsed')), 10000);

driver.findElement(By.id('err')).getText().then(function(value) {
expect(value).to.equal('');
});

driver.findElement(By.id('result')).getText().then(function(value) {
expect(value).to.not.equal('');
});

return driver.quit();
});

it('[id_token] should result in a successful transaction ' + browser, function () {
var driver = clientFactory();

driver.get('https://auth0.github.io/auth0.js/example/test.html');
driver.wait(until.elementLocated(By.id('loaded')), 10000);
driver.findElement(By.id('login-response-type')).sendKeys('id_token');
driver.findElement(By.className('login-redirect-authorize')).click();
driver.wait(until.elementLocated(By.id('hlploaded')), 30000);
driver.findElement(By.id('email')).sendKeys('johnfoo@gmail.com');
driver.findElement(By.id('password')).sendKeys('1234');
driver.findElement(By.id('upLogin')).click();
driver.wait(until.elementLocated(By.id('parsed')), 10000);

driver.findElement(By.id('err')).getText().then(function(value) {
expect(value).to.equal('');
});

driver.findElement(By.id('result')).getText().then(function(value) {
expect(value).to.not.equal('');
});

return driver.quit();
});

it('[token id_token] should result in a successful transaction ' + browser, function () {
var driver = clientFactory();

driver.get('https://auth0.github.io/auth0.js/example/test.html');
driver.wait(until.elementLocated(By.id('loaded')), 10000);
driver.findElement(By.id('login-response-type')).sendKeys('token id_token');
driver.findElement(By.className('login-redirect-authorize')).click();
driver.wait(until.elementLocated(By.id('hlploaded')), 30000);
driver.findElement(By.id('email')).sendKeys('johnfoo@gmail.com');
Expand Down
5 changes: 4 additions & 1 deletion integration/redirect_usernamepassword.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ describe('redirect usernamepassword', function () {

driver.get('https://auth0.github.io/auth0.js/example/test.html');
driver.wait(until.elementLocated(By.id('loaded')), 10000);
driver.findElement(By.id('login-response-type')).sendKeys('token');
driver.findElement(By.id('login-scope')).sendKeys('openid');
driver.findElement(By.id('login-username')).sendKeys('johnfoo@gmail.com');
driver.findElement(By.id('login-password')).sendKeys('1234');
driver.findElement(By.className('login-redirect-usernamepassword')).click();
driver.wait(until.elementLocated(By.id('parsed')), 10000);

driver.findElement(By.id('err')).getText().then(function(value) {
expect(value).to.equal('');
});


driver.findElement(By.id('result')).getText().then(function(value) {
expect(value).to.not.equal('');
});
Expand Down
66 changes: 33 additions & 33 deletions integration/selenium.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,42 @@ var capabilities = [
'browserName': 'chrome',
'platform': 'Windows 10',
'version': '55.0'
},
{
'browserName': 'chrome',
'platform': 'Windows 10',
'version': 'beta'
},
{
'browserName': 'firefox',
'platform': 'Windows 10',
'version': '50.0'
},
{
'browserName': 'firefox',
'platform': 'Windows 10',
'version': 'beta'
},
{
'browserName': 'internet explorer',
'platform': 'Windows 7',
'version': '11.0'
},
{
'browserName': 'internet explorer',
'platform': 'Windows 7',
'version': '10.0'
},
}//,
// {
// 'browserName': 'MicrosoftEdge',
// 'browserName': 'chrome',
// 'platform': 'Windows 10',
// 'version': '13.10586'
// 'version': 'beta'
// },
{
'browserName': 'safari',
'platform': 'macOS 10.12',
'version': '10.0'
}
// {
// 'browserName': 'firefox',
// 'platform': 'Windows 10',
// 'version': '50.0'
// },
// {
// 'browserName': 'firefox',
// 'platform': 'Windows 10',
// 'version': 'beta'
// },
// {
// 'browserName': 'internet explorer',
// 'platform': 'Windows 7',
// 'version': '11.0'
// },
// {
// 'browserName': 'internet explorer',
// 'platform': 'Windows 7',
// 'version': '10.0'
// },
// // {
// // 'browserName': 'MicrosoftEdge',
// // 'platform': 'Windows 10',
// // 'version': '13.10586'
// // },
// {
// 'browserName': 'safari',
// 'platform': 'macOS 10.12',
// 'version': '10.0'
// }
];

module.exports = {
Expand Down

0 comments on commit b735192

Please sign in to comment.