This repository is a testament to my journey of self-learning, where I have applied the Selenium framework in conjunction with xUnit to perform a series of tests on the OLX website.
It serves as a practical demonstration of my acquired skills and understanding of the fundamentals of the automated testing.
The tests incorporated the Page Object Model (POM) pattern, a highly recommended approach for website testing. This design pattern improves test maintenance and code management.
Example: LandingPage.cs
The OLX website presented repeating web elements across various pages. To handle this efficiently and prevent code redundancy, the Page Component Object Model (PCOM) was implemented. This crucial feature allowed to prevent code duplication and improved reusability.
Example: SearchBoxComponent.cs
To further enhance the efficiency of the tests, extensions for web elements were used. These extensions encapsulated recurring method calls during testing, promoting cleaner and more readable code.
Example: WebDriverExtensions.cs
Tests are powered by a data source, which can either come directly from a simple InlineData method attribute or from Excel files containing prepared data. This approach allows for the creation of more flexible and scalable tests that can be easily adapted to various data sets.
Example: LoginPageTests.cs
Code redundancy was reduced through the use of abstract classes that implement recurring methods found in many similar objects. This approach enhances code readability, simplifies maintenance, and boosts the efficiency of test creation.
Example: PageTestBase.cs
Test logic inside test methods is wrapped by another method implemented in PageTestBase.cs - UITest, which catches test failures and saves captured screenshots in the app directory.
Example of use: UITest(nameof(this.LoginForm_WebElements_AreVisible), () =>...
Features | Test Case ID | Test Description | Test Steps | Expected Results | Test Case Method Coverage |
---|---|---|---|---|---|
Login Form | LOG-1 | Given the application is running, When the login form is visible, Then all elements of the login form should be displayed |
1. Navigate to Login Page 2. Verify that all login form elements are visible |
Login Form and it's content are visible: Fields: 1. UserEmail input 2.Password Input Buttons: 1. Login Button 2. Sign in with Facebook 3. Sign in with Apple account 4. Sign in with Google account 5. Navigation sign up button 6. Toggle password visibility button Links: 1. Forgot Password |
LoginForm_WebElements_ AreVisible |
Login Form | LOG-2 | Given the user has not entered any credentials, When the user attempts to sign in, Then the user should not be able to sign in and an appropriate error message should be displayed |
1. Navigate to Login Page 2. Click on a Login Button without filled input fields |
Error message indicating invalid email and password is displayed | Login_With_Empty_ Credentials_Should_Fail |
Login Form | LOG-3 | Given valid user email credentials, when the form is submitted without a password, then the login button should be disabled | 1. Navigate to Login Page 2. Enter User Email credentials 3. Click Login Button |
Button is disabled | Login_With_Only_Email_ Should_Fail |
Login Form | LOG-4 | Given invalid user email credentials and password, When user attempts to sign in, Then the user should not be able to sign in and an error message should be displayed |
1. Navigate to Login Page 2. Enter invalid User Email credentials and password 3. Click Login Button |
Error message indicating invalid email is displayed | Login_With_Invalid_Credentials_ Should_Fail |
Login Form | LOG-5 | Given valid user email credentials and password, When user attempts to sign in, Then the user should be able to sign in and be redirected to expected url |
1. Navigate to Login Page 2. Enter valid User Email and Password 3. Click Login Button |
User is signed in and redirected to expected URL | Login_With_Valid_Credentials_ Redirects_To_Expected_Url |
Login Form | LOG-6 | Given appropriate third-party app login button, When user clicks on the button, Then the user is redirected to expected third-party URL |
1. Navigate to the Login Page 2. Click on a third-party app button|User is redirected to expected URL |
User is redirected to expected URL | Login_With_Facebook_Button_ Redirects_To_Expected_Url Login_With_Apple_Button_ Redirects_To_Expected_Url Login_With_Google_Button_ Redirects_To_Expected_Url |
Login Form | LOG-7 | Given appropriate sign-up button, When user clicks on the button, Then the user is redirected to expected sign-up page |
1. Navigate to the Login Page 2. Click on a sign-up button |
User is redirected to expected URL | Signup_Button_Clicked_ Redirects_To_Expected_Page |
Login Form | LOG-8 | Given appropriate 'Forgot Pasword' link, When user clicks on the link, Then the user is redirected to expected password recovery URL |
1. Navigate to the Login Page 2. Click on a 'Forgot Password' link |
User is redirected to expected URL | Forgot_Password_Link_Button_ Redirects_To_Expected_Page |
Login Form | LOG-9 | Given appropriate Toggle Password visibility button, When user clicks on the button, Then the password credentials visibility changes back and forth |
1. Navigate to the Login Page 2. Enter password 3. Click on Toggle Password Visibilty button 4. Verify that password has visible characters 5. Click the Toggle Password Visibly button again. 6. Verify that password characters are obscurred |
Password characters visibility changes back and forth when clicking on a button | Password_Characters_Visibility_ Changes_On_Button_Click |
Features | Test Case ID | Test Description | Test Steps | Expected Results | Test Case Method Coverage |
---|---|---|---|---|---|
Register Form | REG-1 | Given the application is running, When the register form is visible, Then all elements of the register form should be displayed |
1. Navigate to the Register Page 2. Verify that register form elements are visible |
Login Form and it's content are visible: Fields: 1. UserEmail input 2. Password Input Buttons: 1. Sign up Button 2. Sign in with Facebook 3. Sign in with Apple account 4. Sign in with Google account 5. Navigation sign-in button Labels: 1. User consent label CheckBox: 1. User consent CheckBox |
RegisterForm_WebElements_ Are_Visible |
Register Form | REG-2 | Given the user has not entered any credentials, When user attempts to register, Then the user should not be able to do it and appropriate error message should be displayed |
1. Navigate to Register Page 2. Click on a register button |
Error message indicating invalid email and password is displayed | Register_With_Empty_Credentials_ Should_Fail |
Register Form | REG-3 | Given a valid user email credentials, When user submits the form, Then the user should not be able to register and appropriate error message should be displayed |
1. Navigate to Register Page 2. Enter User Email credentials 3. Click Register button |
Appropriate error message for password input appears | Register_With_Only_Valid_Email_ Should_Fail |
Register Form | REG-4 | Given invalid user email credentials and password, When user attempts to register, Then the user should not be able to do it and an error message should be displayed |
1. Navigate to Register Page 2. Enter invalid User Email credentials and password 3. Click Register Button |
Error message indicating invalid email is displayed | Register_With_Invalid_Credentials_ Should_Fail |
Register Form | REG-5 | Given valid user email credentials and password, When user attempts to register, Then the user is signed-in and redirected to the main page |
1. Navigate to Register Page 2. Enter valid User Email credentials and password 3. Click on a Register Button |
User is redirected to expected URL with already logged in account | Register_With_Valid_Credentials_ Redirects_To_Expected_Url |
Register Form | REG-6 | Given appropriate sign-in button, When user clicks on the button, Then the user is redirected to expected sign-in url |
1. Navigate to Register Page 2. Click on a Log-in button |
User is redirected to expected URL | Login_With_Facebook_Button_ Redirects_To_Expected_Url Login_With_Apple_Button_ Redirects_To_Expected_Url Login_With_Google_Button_ Redirects_To_Expected_Url |
Register Form | REG-7 | Given appropriate Toggle Password visibility button, When user clicks on the button, Then the password credentials visibility changes back and forth |
1. Navigate to the Register Page 2. Enter any password 3. Click on Toggle Password Visibilty button 4. Verify that password has visible characters 5. Click the Toggle Password Visibly button again. 6. Verify that password characters are obscurred |
Password characters visibility changes back and forth when clicking on a button | Password_Characters_Visibility_ Changes_On_Button_Click |
Register Form | REG-8 | Given appropriate User Consent Checkbox button, When user clicks on the button, Then the checkbox selection state changes back and forth |
1. Navigate to Register Page 2. Click on a User Consent Checkbox 3. Verify that checkbox is selected 4. Click on User Consent Checkbox again 5. Verify that checkbox is unselected |
Checkbox selection state changes back and forth | User_Consent_CheckBox_ Is_Selected_On_Click |