-
Notifications
You must be signed in to change notification settings - Fork 24
Added selfservice account unlock feature #421
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
karthikaselvaraj-okta
wants to merge
2
commits into
master
Choose a base branch
from
ks-OKTA-535393-EmailMagicLinkFromDifferentBrowserCode
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
111 changes: 111 additions & 0 deletions
111
...get/src/test/java/info/seleniumcucumber/userStepDefinitions/SelfServiceAccountUnlock.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,111 @@ | ||
| /* | ||
| * Copyright (c) 2021-Present, Okta, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package info.seleniumcucumber.userStepDefinitions; | ||
|
|
||
|
|
||
| import env.CucumberRoot; | ||
| import env.DriverUtil; | ||
| import io.cucumber.java.en.And; | ||
| import io.cucumber.java.en.Then; | ||
| import io.cucumber.java.en.When; | ||
| import org.apache.commons.lang3.StringUtils; | ||
| import org.junit.Assert; | ||
| import org.openqa.selenium.WebDriver; | ||
| import pages.*; | ||
|
|
||
| import java.util.ArrayList; | ||
|
|
||
| public class SelfServiceAccountUnlock extends CucumberRoot { | ||
|
|
||
| protected WebDriver driver = DriverUtil.getDefaultDriver(); | ||
| protected RootPage rootPage = new RootPage(driver); | ||
| protected LoginPage loginPage = new LoginPage(driver); | ||
| protected ProfilePage profilePage = new ProfilePage(driver); | ||
| protected Page page = new Page(driver); | ||
| protected PasswordResetPage passwordResetPage = new PasswordResetPage(driver); | ||
| protected AccountUnlockPage accountUnlockPage = new AccountUnlockPage(driver); | ||
|
|
||
| @When("^she sees a link to unlock her account$") | ||
| public void she_sees_a_link_to_unlock_her_account() { | ||
| page.waitForOneSec(); | ||
| accountUnlockPage.waitForWebElementDisplayed(accountUnlockPage.unlockAccountLink); | ||
| Assert.assertTrue(accountUnlockPage.unlockAccountLink.isDisplayed()); | ||
| } | ||
|
|
||
| @And("^she clicks the link to unlock her account$") | ||
| public void she_clicks_the_link_to_unlock_her_account() { | ||
| page.waitForOneSec(); | ||
| accountUnlockPage.waitForWebElementDisplayed(accountUnlockPage.unlockAccountLink); | ||
| accountUnlockPage.unlockAccountLink.click(); | ||
| } | ||
|
|
||
| @Then("^she sees a page to input her username and select Email or Phone to unlock her account$") | ||
| public void she_sees_a_page_to_input_her_username_and_select_email_or_phone_to_unlock_her_account() { | ||
| accountUnlockPage.waitForWebElementDisplayed(accountUnlockPage.unlockAccountPage); | ||
| Assert.assertTrue(accountUnlockPage.unlockAccountPage.isDisplayed()); | ||
| } | ||
|
|
||
| @Then("^she selects Email from the available options$") | ||
| public void she_selects_email_from_the_available_options() { | ||
| Assert.assertTrue(accountUnlockPage.emailSelectButton.isDisplayed()); | ||
| accountUnlockPage.emailSelectButton.click(); | ||
| } | ||
|
|
||
| @When("^she opens the magic link from her email inbox$") | ||
| public void she_opens_the_magic_link_from_her_email_inbox() { | ||
| String mailBody="email-activation-button"; | ||
| String emailContent = page.fetchSpecificEmailContent(mailBody); | ||
| String magicLink = page.fetchUnlockMagicLinkFromEmail(emailContent); | ||
| driver.get(magicLink); | ||
| } | ||
|
|
||
| @And("^she submits the verify form$") | ||
| public void she_submits_the_form() { | ||
| Assert.assertTrue(accountUnlockPage.verifyFormSubmitButton.isDisplayed()); | ||
| accountUnlockPage.verifyFormSubmitButton.click(); | ||
| } | ||
|
|
||
| @Then("^she sees a page that says \"Account Successfully Unlocked!\" and to enter the password for verification$") | ||
| public void she_sees_a_page_that_says_account_successfully_unlocked_and_to_enter_the_password_for_verification() { | ||
| accountUnlockPage.waitForWebElementDisplayed(accountUnlockPage.accountUnlockSuccessMessage); | ||
| Assert.assertTrue(accountUnlockPage.accountUnlockSuccessMessage.isDisplayed()); | ||
| Assert.assertTrue(accountUnlockPage.enterPasswordBox.isDisplayed()); | ||
| } | ||
| @Then("^she selects \"Phone\" from the available options$") | ||
| public void she_selects_phone_from_the_available_options() { | ||
| Assert.assertTrue(accountUnlockPage.phoneSelectButton.isDisplayed()); | ||
| accountUnlockPage.phoneSelectButton.click(); | ||
| } | ||
|
|
||
| @And("^she sees a page saying \"Verify with your phone\"$") | ||
| public void she_sees_a_page_saying_verify_with_your_phone() { | ||
| accountUnlockPage.waitForWebElementDisplayed(accountUnlockPage.receiveSMSButton); | ||
| Assert.assertTrue(accountUnlockPage.receiveSMSButton.isDisplayed()); | ||
| } | ||
|
|
||
| @Then("^she clicks the button saying \"Receive a code via SMS\"$") | ||
| public void she_clicks_the_button_saying_receive_a_code_via_sms() { | ||
| accountUnlockPage.receiveSMSButton.click(); | ||
| } | ||
|
|
||
| @When("^she fills in the correct code from SMS$") | ||
| public void she_fills_in_the_correct_code_from_sms() { | ||
| String code = page.fetchCodeFromSMS(); | ||
| Assert.assertTrue(StringUtils.isNotBlank(code)); | ||
| passwordResetPage.enterCodeBox.click(); | ||
| passwordResetPage.enterCodeBox.sendKeys(code); | ||
| } | ||
| } |
This file contains hidden or 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
55 changes: 55 additions & 0 deletions
55
samples/embedded-sign-in-widget/src/test/java/pages/AccountUnlockPage.java
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| /* | ||
| * Copyright (c) 2021-Present, Okta, Inc. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package pages; | ||
|
|
||
| import org.openqa.selenium.WebDriver; | ||
| import org.openqa.selenium.WebElement; | ||
| import org.openqa.selenium.support.FindBy; | ||
|
|
||
| public class AccountUnlockPage extends Page { | ||
|
|
||
| public AccountUnlockPage(WebDriver driver) { | ||
| super(driver); | ||
| } | ||
|
|
||
| @FindBy(css = "a[data-se = 'unlock']") | ||
| public static WebElement unlockAccountLink; | ||
|
|
||
| @FindBy(xpath = "//h2[text()= 'Unlock account?']") | ||
| public static WebElement unlockAccountPage; | ||
|
|
||
| @FindBy(css = "div[data-se = 'okta_email']") | ||
| public static WebElement emailSelectButton; | ||
|
|
||
| @FindBy(css = "input[type='submit'][value='Verify'][data-type='save']") | ||
| public static WebElement verifyFormSubmitButton; | ||
|
|
||
| @FindBy(className = "ion-messages-container") | ||
| public static WebElement accountUnlockSuccessMessage; | ||
|
|
||
| @FindBy(css = "input[type='password'][name='credentials.passcode']") | ||
| public static WebElement enterPasswordBox; | ||
|
|
||
| @FindBy(className = "otp-value") | ||
| public static WebElement otpValue; | ||
|
|
||
| @FindBy(css = "div[data-se = 'phone_number']") | ||
| public static WebElement phoneSelectButton; | ||
|
|
||
| @FindBy(css = "input[type='submit'][value='Receive a code via SMS']") | ||
| public static WebElement receiveSMSButton; | ||
| } | ||
|
|
This file contains hidden or 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
This file contains hidden or 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
79 changes: 79 additions & 0 deletions
79
...s/embedded-sign-in-widget/src/test/resources/features/self_service_account_unlock.feature
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| Feature: 8.3 Self service account unlock with with Single factor (Email, Phone, Okta Verify Push) | ||
|
|
||
| @requireA18NProfile | ||
| @requireExistingUser | ||
| @requireMFAGroupsForUser | ||
| Scenario: 8.3.1 Mary recovers from a locked account with Email Magic Link from a different Browser | ||
| Given Mary navigates to the Embedded Widget View | ||
| When she inputs her correct email address | ||
| And she fills in her incorrect password | ||
| And she submits the Login form and locks the account | ||
| When she sees a link to unlock her account | ||
| And she clicks the link to unlock her account | ||
| Then she sees a page to input her username and select Email or Phone to unlock her account | ||
| When she inputs her correct email address | ||
| Then she selects Email from the available options | ||
| And she sees a page saying "Verify with your email" | ||
| Then she clicks on "Send me an email" | ||
| And the page changes to waiting screen message for email verification | ||
| And she clicks on "Enter a code from the email instead" | ||
| Then she sees a page to input her code | ||
| When she opens the magic link from her email inbox | ||
| Then she sees a page that says "Account Successfully Unlocked!" and to enter the password for verification | ||
| Given Mary navigates to the Embedded Widget View | ||
| When she inputs her correct email address | ||
| And she fills in her account password | ||
| And she submits the Login form | ||
| Then she is redirected to the Root View | ||
| And she sees a table with her profile info | ||
|
|
||
| @requireA18NProfile | ||
| @requireExistingUser | ||
| @requireMFAGroupsForUser | ||
| Scenario: 8.3.2 Mary recovers from a locked account with Email OTP | ||
| Given Mary navigates to the Embedded Widget View | ||
| When she inputs her correct email address | ||
| And she fills in her incorrect password | ||
| And she submits the Login form and locks the account | ||
| When she sees a link to unlock her account | ||
| And she clicks the link to unlock her account | ||
| Then she sees a page to input her username and select Email or Phone to unlock her account | ||
| When she inputs her correct email address | ||
| Then she selects Email from the available options | ||
| And she sees a page saying "Verify with your email" | ||
| Then she clicks on "Send me an email" | ||
| And the page changes to waiting screen message for email verification | ||
| And she clicks on "Enter a code from the email instead" | ||
| Then she sees a page to input her code | ||
| When she fills in the correct code | ||
| And she submits the verify form | ||
| Then she sees a page that says "Account Successfully Unlocked!" and to enter the password for verification | ||
| And she fills in her account password | ||
| And she submits the verify form | ||
| Then she is redirected to the Root View | ||
| And she sees a table with her profile info | ||
|
|
||
| @requireA18NProfile | ||
| @requireExistingUser | ||
| @requireEnrolledPhone | ||
| @requireMFAGroupsForUser | ||
| Scenario: 8.3.3 Mary recovers from a locked account with SMS OTP | ||
| Given Mary navigates to the Embedded Widget View | ||
| When she inputs her correct email address | ||
| And she fills in her incorrect password | ||
| And she submits the Login form and locks the account | ||
| When she sees a link to unlock her account | ||
| And she clicks the link to unlock her account | ||
| Then she sees a page to input her username and select Email or Phone to unlock her account | ||
| When she inputs her correct email address | ||
| Then she selects "Phone" from the available options | ||
| And she sees a page saying "Verify with your phone" | ||
| Then she clicks the button saying "Receive a code via SMS" | ||
| Then she sees a page to input her code | ||
| When she fills in the correct code from SMS | ||
| And she submits the verify form | ||
| Then she sees a page that says "Account Successfully Unlocked!" and to enter the password for verification | ||
| And she fills in her account password | ||
| And she submits the verify form | ||
| Then she is redirected to the Root View | ||
| And she sees a table with her profile info |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.