Skip to content

Commit

Permalink
Debug session
Browse files Browse the repository at this point in the history
  • Loading branch information
vijetmahabaleshwar-okta committed Apr 23, 2019
1 parent 9b61563 commit 80d0352
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 1 deletion.
21 changes: 20 additions & 1 deletion e2e-tests/okta-hosted-login/specs/okta-hosted-login-flow-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,33 @@ describe('Okta Hosted Login Flow', () => {

it('can login with Okta as the IDP', async () => {
browser.get(appRoot);
console.log(`Loading home page ${appRoot}...`);
loginHomePage.waitForPageLoad();
console.log(`Loaded home page ${appRoot}...`);

console.log('Clicking login button...');
loginHomePage.clickLoginButton();
console.log('Clicked login button...');
oktaSignInPage.waitForPageLoad();
console.log('Loaded login page...');

// Verify that current domain has changed to okta-hosted login page
const urlProperties = url.parse(process.env.ISSUER);
console.log(urlProperties.host);

expect(browser.getCurrentUrl()).toContain(urlProperties.host);
expect(browser.getCurrentUrl()).not.toContain(appRoot);

await oktaSignInPage.login(browser.params.login.username, browser.params.login.password);
console.log('Validated the current url...');

console.log(browser.params.login.username);
console.log(browser.params.login.password);
//await oktaSignInPage.login(browser.params.login.username, browser.params.login.password);
oktaSignInPage.login(browser.params.login.username, browser.params.login.password);
console.log('Clicking sign in button...');
oktaSignInPage.clickSignInButton();
console.log('Clicked sign in button...');
console.log('waiting for authenticated page...')
authenticatedHomePage.waitForPageLoad();
});

Expand All @@ -65,8 +81,11 @@ describe('Okta Hosted Login Flow', () => {

it('can log the user out', async () => {
browser.get(appRoot);
console.log('Waiting for home page...');
authenticatedHomePage.waitForPageLoad();
console.log('Loaded authenticated home page...');
authenticatedHomePage.logout();
console.log('After logout click...');
loginHomePage.waitForPageLoad();
});
});
8 changes: 8 additions & 0 deletions e2e-tests/page-objects/okta-signin-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,16 @@ class OktaSignInPage {
}

login(username, password) {
console.log('Filling username and password');
this.usernameInput.sendKeys(username);
this.passwordInput.sendKeys(password);
console.log('Filled username and password');

// console.log('Clicking submit button...');
// return this.submitButton.click();
}

clickSignInButton() {
return this.submitButton.click();
}

Expand Down
5 changes: 5 additions & 0 deletions e2e-tests/page-objects/shared/authenticated-home-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class AuthenticatedHomePage {
// For asp.net webforms you can't have ids with hyphens
// https://stackoverflow.com/questions/25919471/how-to-get-html-control-by-id-that-has-hyphens
if (__dirname.indexOf('samples-aspnet-webforms') > -1) {
console.log('Changing the buttons...');
this.$profileButton = $('#profileButton');
this.$logoutButton = $('#logoutButton');
}
Expand All @@ -31,6 +32,10 @@ class AuthenticatedHomePage {
}

waitForPageLoad() {
console.log('Waiting for logout button...');
// browser.getPageSource().then(function (res) {
// console.log('AFTER CLICKING LOGINS -' + res);
// });
return util.wait(this.$logoutButton);
}

Expand Down
5 changes: 5 additions & 0 deletions e2e-tests/page-objects/shared/login-home-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ class LoginHomePage {
// For asp.net webforms you can't have ids with hyphens
// https://stackoverflow.com/questions/25919471/how-to-get-html-control-by-id-that-has-hyphens
if (__dirname.indexOf('samples-aspnet-webforms') > -1) {
console.log('Changing login button selector...');
this.$loginButton = $('#loginButton');
}
}

waitForPageLoad() {
browser.sleep(1000);
browser.getPageSource().then(function (res) {
console.log('AFTER CLICKING LOGOUT -' + res);
});
return util.wait(this.$loginButton);
}

Expand Down
7 changes: 7 additions & 0 deletions e2e-tests/tools/common-config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,15 @@ commonConfig.configure = function (promises) {
config.capabilities.screenResolution = '1600x1200';
config.capabilities.extendedDebugging = true;
}
// otherwise just launch the browser locally
else if (process.env.CHROME) {
console.log('-- Using Chrome --');
config.capabilities.browserName = 'chrome'
}
// Run Chrome Headless
else if (process.env.CHROME_HEADLESS || process.env.TRAVIS) {
console.log('-- Using Chrome Headless --');
config.capabilities.browserName = 'chrome',
config.capabilities.chromeOptions = {
args: ['--headless','--disable-gpu','--window-size=1600x1200']
};
Expand All @@ -89,6 +95,7 @@ commonConfig.configure = function (promises) {
// otherwise just launch the browser locally
else {
console.log('-- Using Chrome --');
config.capabilities.browserName = 'chrome'
}
return config;
};

0 comments on commit 80d0352

Please sign in to comment.