This repository was archived by the owner on Feb 9, 2026. It is now read-only.
Repository navigation
Selenium Testing Guideline
e-taha edited this page Nov 11, 2025
·
1 revision
This directory contains end-to-end (E2E) tests using Selenium WebDriver.
e2e/
├── config/ # Configuration files
├── helpers/ # Utility functions and helpers
├── pages/ # Page Object Models
├── tests/ # Test files
└── drivers/ # Browser drivers (if using manual setup)
npm install --save-dev selenium-webdrivernpm install --save-dev webdriver-manager
webdriver-manager update- Download ChromeDriver: https://chromedriver.chromium.org/
- Download GeckoDriver: https://github.com/mozilla/geckodriver/releases
- Place in
e2e/drivers/or add to system PATH
npm run e2enpx jest e2e/tests/auth.test.jsnpm run e2e:chromenpm run e2e:allTests for user authentication:
- Login with valid/invalid credentials
- Registration flow
- Password reset
- Logout
Tests for recipe interactions:
- Recipe browsing
- Recipe details
- Bookmarking recipes
- Rating recipes
- Recipe filtering and search
Tests for user profile:
- Profile display
- Profile editing
- User preferences
- Bookmarked recipes
- My recipes section
Methods:
-
navigateTo()- Go to login page -
login(email, password)- Perform login -
getErrorMessage()- Get error text -
clickForgotPassword()- Click forgot password link -
clickRegister()- Click register link
Methods:
-
navigateTo()- Go to dashboard -
isDashboardDisplayed()- Check if dashboard visible -
getRecipeCount()- Get number of recipes -
clickRecipe(index)- Click recipe by index -
clickLogout()- Logout user
Methods:
-
navigateTo(recipeId)- Go to recipe detail -
getRecipeTitle()- Get recipe title -
getRecipeDescription()- Get description -
clickBookmark()- Toggle bookmark -
isBookmarked()- Check if bookmarked -
rateRecipe(stars)- Rate recipe (1-5)
Methods:
-
navigateTo()- Go to profile page -
getUserName()- Get user's name -
getUserEmail()- Get user's email -
clickEditProfile()- Enter edit mode -
updateName(newName)- Update user name -
updateBio(newBio)- Update user bio -
clickSave()- Save changes -
clickCancel()- Cancel editing
Utility functions for waiting:
-
waitForElement()- Wait for element to be present -
waitForElementVisible()- Wait for element to be visible -
waitForElementClickable()- Wait for element to be clickable -
waitForUrlChange()- Wait for URL to change -
waitForPageTitle()- Wait for page title -
sleep()- Sleep for milliseconds (use sparingly)
✅ DO:
- Use Page Object Model pattern
- Use explicit waits instead of sleep
- Add
data-testidattributes to your components - Test complete user workflows
- Give tests descriptive names
- Clean up after tests (quit driver)
❌ DON'T:
- Use hardcoded waits (setTimeout)
- Test implementation details
- Make tests depend on each other
- Test too many things in one test
- Forget to handle async/await
describe("Feature Group", () => {
let driver;
let page;
beforeAll(async () => {
driver = await new Builder().forBrowser("chrome").build();
page = new MyPage(driver);
});
afterAll(async () => {
await driver.quit();
});
test("should do something", async () => {
await page.navigateTo();
await page.doAction();
const result = await page.getResult();
expect(result).toBe(expectedValue);
});
});Use in By object:
By.id("element-id");
By.name("element-name");
By.className("class-name");
By.css("css.selector");
By.xpath("//xpath/expression");
By.linkText("Link Text");
By.partialLinkText("Partial");See config/test.config.cjs for settings:
- Base URL
- Browser options
- Timeouts
- Test data
- Reporter settings
| Issue | Solution |
|---|---|
Element not found |
Check locator, use DevTools to inspect |
Timeout |
Increase timeout, verify element exists |
StaleElementReference |
Re-find element, use explicit waits |
SessionNotCreated |
Update WebDriver, check browser version |
Port already in use |
Kill existing process or change port |
To run tests in CI/CD pipeline:
# GitHub Actions example
- name: Run E2E Tests
run: npm run e2e
env:
BASE_URL: ${{ secrets.BASE_URL }}- Customer Milestone 1 Report of CMPE 451 Fall 2025
- Customer Milestone 2 Report of CMPE 451 Fall 2025
- Customer Milestone 3 Report of CMPE 451 Fall 2025
- Customer Milestone 2 Template Report of CMPE 451 Fall 2025
- Lab8: Requirements Review & Acceptance Planning
- Lab 9: Milestone 3 Demo Preparation
- Celil Özkan (Backend)
- Cem Sarpkaya (Backend)
- Özgür Savaşçıoğlu (Backend)
- Taha Ensar Kukul (Frontend)
- Ahmet Hacıoğlu (Frontend)
- Ahmet Selçuk Ersoy (Frontend)
- Bahadır Demirel (Frontend)
- Muhammed Ekinci (Mobile)
- Ali Gökçek (Mobile)
- Seyit Mustafa Demir (Mobile)
- Talha Özdoğan (Mobile)
- Requirements
- Milestones Roadmap
- Lab 5: MVP Implementation & Planning
- Unit Tests Coverage
- Selenium Quick Start Guide
- Selenium Testing Guide
09-22 Week 1
09-29 Week 2
10-06 Week 3
10-13 Week 4
10-20 Week 5
10-27 Week 6
11-03 Week 7
11-10 Week 8
11-17 Week 9
11-24 Week 10
12-01 Week 11
12-08 Week 12
- Lab1 Report
- Lab2 Report
- Lab3 Report
- Lab4 Report
- Lab5 Report
- Lab6 Report
- Lab7 Report
- Lab8 Report
- Lab9 Report
- Lab Report Template
- Lab 1 Meeting Notes (23.09.2025)
- Lab 2 Meeting Notes (30.09.2025)
- Lab 3 Meeting Notes (07.10.2025)
- Lab 4 Meeting Notes (14.10.2025)
- Lab 5 Meeting Notes (04.11.2025)
- Lab 6 Meeting Notes (11.11.2025)
- Lab 7 Meeting Notes (18.11.2025)
- Lab 8 Meeting Notes (02.12.2025)
- Lab 9 Meeting Notes (09.12.2025)
- Meeting Agenda 1
- Meeting Agenda 2
- Meeting Agenda 3
- Meeting Agenda 4
- Meeting Agenda 5
- Meeting Agenda 6
- Meeting Notes 1 (16.02.2025)
- Meeting Notes 2 (24.02.2025)
- Meeting Notes 3 (27.02.2025)
- Meeting Notes 4 (04.03.2025)
- Meeting Notes 5 (06.03.2025)
- Meeting Notes 6 (13.03.2025)
- Meeting Notes 7 (17.03.2025)
- Meeting Notes 8 (21.04.2025)
- Meeting Notes 9 (28.04.2025)
- Meeting Notes 10 (01.05.2025)
- Meeting Notes 11 (06.05.2025)
- Lecture Notes 1 (13.02.2025)
- Lecture Notes 2 (20.02.2025)
- Lecture Notes 3 (27.02.2025)
- Lecture Notes 4 (06.03.2025)
- Lecture Notes 5 (13.03.2025)
- Project Concept Design
- Elicitation Questions
- Elicitation Q&A
- Backend Endpoints (DRAFT)
- Unit Tests Coverage
Click to Expand ⬇️
- Scenario 1 - User Register
- Scenario 2 - Dietitian Register
- Scenario 3 - User Login
- Scenario 4 - User Deletion
- Scenario 5 - Upload & Edit Recipe
- Scenario 6 - Single Meal Planning
- Scenario 7 - Grocery Price Comparison
- Scenario 8 - Community Forum
- Scenario 9 - Recipe Discovery & Filter
- Scenario 10 - Local Food Discovery
- Scenario 11 - Nutritional Guidance Interaction
- Scenario 12 - Market Inventory Management
- Scenario 13 - Profile Management and Preference Settings
- Scenario 14 - Rate and Comment the Recipe by User
- Scenario 15 - Bookmark a Meal and Access it in Profile Page
- Scenario 16 - Adding Nutrition Tips to a Dietitian Profile
- Scenario 17 - User Forget Password
- Scenario 18 ‐ User Follows Unfollows Users
- Scenario 19 - Allergen Alert and Meal Plan Adjustment
- Scenario 20 - Dietitian Rating of a Recipe