-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AYS-448 | Login Functionality Automation (#48)
- Loading branch information
Showing
19 changed files
with
683 additions
and
80 deletions.
There are no files selected for viewing
This file contains 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 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 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 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,31 @@ | ||
package org.ays.enums; | ||
|
||
import lombok.Getter; | ||
import lombok.RequiredArgsConstructor; | ||
|
||
import java.util.List; | ||
import java.util.Locale; | ||
import java.util.Optional; | ||
|
||
@Getter | ||
@RequiredArgsConstructor | ||
public enum AysLanguage { | ||
|
||
TR(new Locale("tr", "TR")), | ||
EN(new Locale("en", "US")); | ||
|
||
private final Locale locale; | ||
|
||
public static List<AysLanguage> getLanguages() { | ||
return List.of(AysLanguage.values()); | ||
} | ||
|
||
public static AysLanguage valueOfCode(final Object languageCode) { | ||
return Optional.ofNullable(languageCode) | ||
.map(Object::toString) | ||
.map(String::toUpperCase) | ||
.map(AysLanguage::valueOf) | ||
.orElse(EN); | ||
} | ||
|
||
} |
This file contains 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 |
---|---|---|
@@ -1,8 +1,113 @@ | ||
@Regression @Smoke | ||
@Regression | ||
Feature: Login Functionality | ||
|
||
Scenario: Login with a valid username and password | ||
Background: | ||
Given Open the institution login page | ||
When Enter the username and password | ||
And Click the Login button | ||
Then The user should be able to successfully log in | ||
|
||
@Smoke | ||
Scenario: Login with valid email address and password | ||
When Enter the email address and password | ||
And Click on the Login button | ||
Then The username should be displayed on the homepage after successful login | ||
And accessToken and refreshToken should be stored in localStorage | ||
|
||
Scenario Outline: Login with unauthorized user | ||
When Enter unauthorized "<emailAddress>" and "<password>" | ||
And Click on the Login button | ||
Then Error pop-up message should be displayed | ||
Examples: | ||
| emailAddress | password | | ||
| unauthorized@email.us | password | | ||
|
||
Scenario Outline: Login with invalid emailAddress | ||
When Enter invalid "<emailAddress>" and "<password>" | ||
And Click on the Login button | ||
Then User should be able to see invalid email error message | ||
Examples: | ||
| emailAddress | password | | ||
| user | password | | ||
| 123 | password | | ||
| ..... | password | | ||
| !'^+%&/*# | password | | ||
| user@ays.o | password | | ||
| user@aysorg | password | | ||
| userays.org | password | | ||
| @user.org | password | | ||
|
||
Scenario: Login with a blank email address | ||
When Sets the email address to " " and enters "password" | ||
And Click on the Login button | ||
Then User should be able to see invalid email error message | ||
|
||
Scenario Outline: Login with invalid password | ||
When Enter invalid "<emailAddress>" and "<password>" | ||
And Click on the Login button | ||
Then User should be able to see password errorMessage | ||
Examples: | ||
| emailAddress | password | | ||
| user@email.us | pass | | ||
|
||
Scenario: Login with valid email address invalid password | ||
When Enter valid emailAddress and invalid password | ||
And Click on the Login button | ||
Then Error pop-up message should be displayed | ||
|
||
Scenario: Login with invalid email address valid password | ||
When Enter invalid emailAddress and valid password | ||
And Click on the Login button | ||
Then Error pop-up message should be displayed | ||
|
||
Scenario: Login with blank email address and password | ||
And Click on the Login button | ||
Then User should be able to see errorMessage under email and password input box | ||
|
||
@Smoke | ||
Scenario: Password hiding checking | ||
When Enter hiding password | ||
And Click on the eye icon | ||
Then The password should be displayed without being hidden | ||
And Click on the eye icon | ||
Then The password should be displayed hidden | ||
|
||
@Smoke | ||
Scenario: Theme checking | ||
When Click on the theme icon | ||
Then User should be able to see dark theme | ||
And Click on the theme icon | ||
Then User should be able to see light theme | ||
|
||
@Smoke | ||
Scenario: Language selection checking | ||
When Click on the language button | ||
And Select the "Turkish" option | ||
Then The user should be able to see all texts compatible with the Turkish language | ||
And Click on the language button | ||
And Select the "İngilizce" option | ||
Then The user should be able to see all texts compatible with the English language | ||
|
||
Scenario: Logged-in user visits login URL | ||
|
||
As a logged-in user, I should not see the login page again when I navigate to the login URL | ||
Instead, I should be redirected to the dashboard page. | ||
|
||
When Enter the email address and password | ||
And Click on the Login button | ||
Then The username should be displayed on the homepage after successful login | ||
And The user navigates to the login URL in a new tab | ||
Then The user should be able to see dashboard page | ||
|
||
Scenario: Dashboard page access without login | ||
|
||
As a user, I should not be able to access the dashboard page without logging in | ||
Instead, I should be redirected to the login page. | ||
|
||
When The user navigates to the dashboard page | ||
Then The user should see the login page | ||
|
||
Scenario: Refresh Token expiration triggers logout | ||
When Enter the email address and password | ||
And Click on the Login button | ||
And accessToken and refreshToken should be stored in localStorage | ||
And The "refreshToken" expires using mock expiration | ||
Then The user should see the login page | ||
|
This file contains 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 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,24 @@ | ||
package org.ays.pages; | ||
|
||
import org.ays.browser.AysBrowser; | ||
import org.ays.browser.AysPageActions; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.PageFactory; | ||
|
||
public class BasePage { | ||
|
||
private final AysPageActions actions = new AysPageActions(); | ||
|
||
public BasePage() { | ||
PageFactory.initElements(AysBrowser.getWebDriver(), this); | ||
} | ||
|
||
public void selectLanguage(String language) { | ||
String locator = "//span[text()='" + language + "']"; | ||
WebElement element = AysBrowser.getWebDriver().findElement(By.xpath(locator)); | ||
actions.clickMethod(element); | ||
|
||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains 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,54 @@ | ||
package org.ays.pages; | ||
|
||
import lombok.Getter; | ||
import org.openqa.selenium.WebElement; | ||
import org.openqa.selenium.support.FindBy; | ||
|
||
@Getter | ||
public class LoginPage extends BasePage { | ||
|
||
|
||
@FindBy(name = "emailAddress") | ||
private WebElement loginEmailAddress; | ||
|
||
@FindBy(name = "password") | ||
private WebElement loginPassword; | ||
|
||
@FindBy(xpath = "//button[@type='submit']") | ||
private WebElement loginButton; | ||
|
||
@FindBy(xpath = "//div[contains(@class, 'ml-3')]") | ||
private WebElement username; | ||
|
||
@FindBy(id = ":r1:-form-item-message") | ||
private WebElement emailAddressErrorMessage; | ||
|
||
@FindBy(id = ":r2:-form-item-message") | ||
private WebElement passwordErrorMessage; | ||
|
||
@FindBy(xpath = "//div[contains(@class,'text-sm opacity-90')]") | ||
private WebElement popupErrorMessage; | ||
|
||
@FindBy(xpath = "//div[@class= 'relative']/button") | ||
private WebElement hiddenPasswordIcon; | ||
|
||
@FindBy(css = "button") | ||
private WebElement themeIcon; | ||
|
||
@FindBy(css = "html.light") | ||
private WebElement lightTheme; | ||
|
||
@FindBy(css = "html.dark") | ||
private WebElement darkTheme; | ||
|
||
@FindBy(css = "button[role='combobox']") | ||
private WebElement languageButton; | ||
|
||
@FindBy(xpath = "//h3") | ||
private WebElement welcomeHeader; | ||
|
||
@FindBy(xpath = "//div[@class='container']") | ||
private WebElement allLoginText; | ||
|
||
|
||
} |
8 changes: 1 addition & 7 deletions
8
src/test/java/org/ays/pages/LogoutPOM.java → src/test/java/org/ays/pages/LogoutPage.java
This file contains 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 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
Oops, something went wrong.