From 80d03528d5e13d0ffcbefd023ec798c960f1faff Mon Sep 17 00:00:00 2001 From: Vijet Mahabaleshwar Date: Tue, 16 Apr 2019 11:51:30 -0700 Subject: [PATCH] Debug session --- .../specs/okta-hosted-login-flow-spec.js | 21 ++++++++++++++++++- e2e-tests/page-objects/okta-signin-page.js | 8 +++++++ .../shared/authenticated-home-page.js | 5 +++++ .../page-objects/shared/login-home-page.js | 5 +++++ e2e-tests/tools/common-config/index.js | 7 +++++++ 5 files changed, 45 insertions(+), 1 deletion(-) diff --git a/e2e-tests/okta-hosted-login/specs/okta-hosted-login-flow-spec.js b/e2e-tests/okta-hosted-login/specs/okta-hosted-login-flow-spec.js index f475fd11..753c4416 100644 --- a/e2e-tests/okta-hosted-login/specs/okta-hosted-login-flow-spec.js +++ b/e2e-tests/okta-hosted-login/specs/okta-hosted-login-flow-spec.js @@ -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(); }); @@ -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(); }); }); diff --git a/e2e-tests/page-objects/okta-signin-page.js b/e2e-tests/page-objects/okta-signin-page.js index 9b4fdb93..23b0ca6b 100644 --- a/e2e-tests/page-objects/okta-signin-page.js +++ b/e2e-tests/page-objects/okta-signin-page.js @@ -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(); } diff --git a/e2e-tests/page-objects/shared/authenticated-home-page.js b/e2e-tests/page-objects/shared/authenticated-home-page.js index 93018d4e..f7e2922d 100644 --- a/e2e-tests/page-objects/shared/authenticated-home-page.js +++ b/e2e-tests/page-objects/shared/authenticated-home-page.js @@ -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'); } @@ -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); } diff --git a/e2e-tests/page-objects/shared/login-home-page.js b/e2e-tests/page-objects/shared/login-home-page.js index 7724e932..b0580411 100644 --- a/e2e-tests/page-objects/shared/login-home-page.js +++ b/e2e-tests/page-objects/shared/login-home-page.js @@ -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); } diff --git a/e2e-tests/tools/common-config/index.js b/e2e-tests/tools/common-config/index.js index 2759bfc6..b86838ff 100644 --- a/e2e-tests/tools/common-config/index.js +++ b/e2e-tests/tools/common-config/index.js @@ -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'] }; @@ -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; };