تفاصيل العمل

Automated UI testing of Almosafer.com using Selenium WebDriver, Java, and TestNG.

Project Structure

almosafer/

└── myTest.java

Prerequisites

Java 8 or higher

TestNG

Selenium WebDriver

EdgeDriver or ChromeDriver

Internet connection

Getting Started

Clone the repository or create a new Java project.

Add the provided source code into your project.

Configure your browser driver (EdgeDriver or ChromeDriver).

Add required libraries for Selenium and TestNG.

Run the test class via your IDE or TestNG XML suite.

Test Scenarios

1. English Language Validation

Verifies the default site language is English.

HTML tag must contain lang="en".

2. Currency Check

Confirms the default displayed currency is SAR.

Located using: data-testid='Header__CurrencySelector'.

3. Contact Number Verification

Validates the presence of contact number: +966554400000.

Located using: By.linkText().

4. Qitaf Logo Visibility

Checks for Qitaf logo in the footer.

CSS: footer svg[data-testid='Footer__QitafLogo']

5. Hotels Tab Not Selected by Default

Ensures "Hotels" tab is not the default selected tab.

Uses aria-selected attribute check.

6. ️ Flight Dates Validation

Departure date = Today + 1

Return date = Today + 2

Uses LocalDate and DateTimeFormatter for date handling.

7. Change Language Randomly

Randomly toggles between Arabic and English.

Validates the applied language reflects correctly.

8. Hotel Search Flow

Random city selection based on current language:

English: Dubai, Jeddah, Riyadh

Arabic: دبي, جدّة, رياض

Random guest configuration:

1 room, 2 adults or 1 room, 1 adult

Initiates hotel search.

9. Search Results Page Validation

Waits for search results to load.

Asserts:

Hotels are listed.

Each has a visible price element.

️ Technologies Used

Java – Test logic

Selenium WebDriver – UI automation

TestNG – Testing framework

EdgeDriver / ChromeDriver – Browser drivers

WebDriverWait – Explicit waits for dynamic content

Cleanup

Ensures the browser is closed after test execution:

@AfterTest

public void finish() {

driver.quit();

}

بطاقة العمل

اسم المستقل
عدد الإعجابات
0
عدد المشاهدات
18
تاريخ الإضافة
المهارات