Ayeshashaik12/Mini-Project
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
======================================================================================================================== Royal Caribbean Alaska Cruise Search & Filter Automation Playwright Automation Project ======================================================================================================================== 1)PROJECT OVERVIEW ------------------------------------------------------------------------------------------------------------------------ This project automates the Royal Caribbean Alaska cruise search and filtering workflow using Playwright with TypeScript. The automation demonstrates: - Browser launch and navigation - Verifying presence of the global Search option - Searching for “Rhapsody of the Seas” and navigating to ship details - Clicking Book Now to open sailing search - Applying filters: Months, Departure Port, Destination, Length of Cruise (Nights) - Sorting results by Price: Low to High - Counting and displaying the number of results - UI validation using assertions - Locating elements using xpath, linkText, and partialLinkText - Scrolling elements into view - Synchronization using explicit waits - Retrieving web element properties - Capturing screenshots & recording execution videos = Error handling with failure screenshots This project is intended for learning and demonstration of Playwright automation concepts tailored to cruise search workflows. ------------------------------------------------------------------------------------------------------------------------ 2)TECHNOLOGY STACK ------------------------------------------------------------------------------------------------------------------------ Automation Tool : Playwright Language : TypeScript Test Runner : Playwright Test Browser : Chromium (default) Operating System : Windows / macOS / Linux ------------------------------------------------------------------------------------------------------------------------ 3)PROJECT STRUCTURE ------------------------------------------------------------------------------------------------------------------------ project-root | |-- tests | |-- royalcaribbean-alaska.spec.ts | |-- screenshots | |-- dates.png | |-- departure.png | |-- destination.png | |-- home.png | |-- low.png | |-- month.png | |-- videos | |-- Test | |-- playwright.config.ts |-- package.json |-- README.txt |-- node_modules ------------------------------------------------------------------------------------------------------------------------ 4)PREREQUISITES ------------------------------------------------------------------------------------------------------------------------ The following software must be installed: Node.js (Version 16 or above) npm (comes with Node.js) Internet connection Verify installation using: node -v npm -v ------------------------------------------------------------------------------------------------------------------------ 5)PROJECT SETUP ------------------------------------------------------------------------------------------------------------------------ Step 1: Install dependencies Run the following command in the project root folder: npm install Step 2: Install Playwright browsers Run: npx playwright install ------------------------------------------------------------------------------------------------------------------------ 6)TEST EXECUTION ------------------------------------------------------------------------------------------------------------------------ - Run all tests: npx playwright test - Run specific test file: npx playwright test tests/royalcaribbean-alaska.spec.ts - Run test in headed mode (visible browser): npx playwright test --headed - View HTML test report: npx playwright show-report ------------------------------------------------------------------------------------------------------------------------ 7)TEST SCENARIO DETAILS ------------------------------------------------------------------------------------------------------------------------ The test performs the following steps end-to-end: - Launch the browser and create a context with video recording enabled. - Navigate to https://www.royalcaribbean.com/alaska-cruises. - Verify page title and presence of the Search option (global search icon/field). - Use search to find “Rhapsody of the Seas”. - Click the first search result: “Rhapsody of the Seas | Cruise Ships | Royal Caribbean Cruises”. - Click Book Now on the ship page to open sailing search. - Filter on cruise dates: -- Select Months (choose any four available months). -- Select Departure Port (any available port). -- Select Destination (any available destination). -- Select Number of Nights (Length of Cruise). - Click See results / Apply (as available). - Sort the results by Price: Low to High. - Display/Log the total number of cruise search results. - Capture screenshots at major steps and on failures. - Close the browser context and page. Note: UI is dynamic; selectors are built using xpath, linkText, partialLinkText, and role-based locators. Synchronization is handled with explicit waits. For dropdowns, Playwright’s selectOption() is used (equivalent to Selenium’s Select class usage). ------------------------------------------------------------------------------------------------------------------------ 8)SCREENSHOTS ------------------------------------------------------------------------------------------------------------------------ Screenshots are saved in the screenshots folder: - dates.png : Alaska landing page with search presence verified - depature.png : Search results page highlighting the selected ship - destination.png : Ship page after clicking Book Now - home.png : Filters panel with selected months/ports/destination/nights - low.png : Search results sorted by lowest price - month.png : Captured automatically on test failure ------------------------------------------------------------------------------------------------------------------------ 9)VIDEO RECORDING ------------------------------------------------------------------------------------------------------------------------ - Video recording is enabled at BrowserContext level. - Videos are saved in the videos folder. - Each test execution generates a video automatically for debugging and review. ------------------------------------------------------------------------------------------------------------------------ 10)ELEMENT LOCATORS & KEY AUTOMATION SCOPE ------------------------------------------------------------------------------------------------------------------------ 1.Locator Strategies Used - XPath: For dynamic or nested nodes, especially in filter panels and search results grids. Example: //button[contains(., 'Book Now')] - linkText: For direct link matches Example: page.getByRole('link', { name: 'Rhapsody of the Seas' }) or page.locator('a', { hasText: 'Rhapsody of the Seas' }) - partialLinkText: Using hasText or :text() to match partial link text Example: page.locator('a:has-text("Rhapsody")') 2. Retrieving Web Element Properties - Use locator.textContent(), innerText(), getAttribute(), isVisible(), isEnabled() to fetch UI properties. 3. Scrolling into View - Use locator.scrollIntoViewIfNeeded() to ensure elements are visible before clicking. 4. Synchronization with Explicit Waits - Use page.waitForLoadState('networkidle'), locator.waitFor({ state: 'visible' }), and assertions like await expect(locator).toBeVisible(). 5. Dropdown Selection (Months/Ports/Destination/Nights) - Playwright uses selectOption() for <select> elements. Example: await page.selectOption('#months', [{ value: 'May' }, { value: 'Jun' }, { value: 'Jul' }, { value: 'Aug' }]); ------------------------------------------------------------------------------------------------------------------------ 11)ERROR HANDLING ------------------------------------------------------------------------------------------------------------------------ - Core test logic is wrapped with try-catch. - On failure: -- Error is logged to console. -- A full-page failure screenshot (error.png) is captured. -- Test is marked as failed with a clear message. - afterEach hooks can attach artifacts to the test report. ------------------------------------------------------------------------------------------------------------------------ 12)UTILITIES ------------------------------------------------------------------------------------------------------------------------ - A small utility is used for timestamped filenames to avoid overwriting screenshots. Sample format: YYYY-MM-DD_HH-mm-ss Example generated names: ship_search_2026-03-13_18-40-22.png results_sorted_2026-03-13_18-41-10.png ------------------------------------------------------------------------------------------------------------------------ 13)KEY PLAYWRIGHT CONCEPTS USED ------------------------------------------------------------------------------------------------------------------------ - BrowserContext with video recording - Page navigation and assertions - Locators (xpath, linkText via role/text, partialLinkText via hasText) - Explicit waits and synchronization strategies - Screenshot and video capture - Working with dropdowns (selectOption and custom ARIA lists) - Test hooks (beforeAll, afterAll, beforeEach, afterEach) - Sorting & extracting UI text values to validate price ordering - Counting search results (using locator.count()) ------------------------------------------------------------------------------------------------------------------------ 14)NOTES ------------------------------------------------------------------------------------------------------------------------ - The Royal Caribbean website is dynamic and may A/B test UI—locators may require updates over time. - Ensure a stable internet connection for consistent test runs. - Some filters may render as chips or accordions; adjust locator strategies accordingly. - Price parsing should handle currency symbols and thousand separators (e.g., $1,299). - When selecting four months, prefer the first four visible/available months in the filter UI for stability. - Use test IDs or aria labels if available for more resilient selectors. ------------------------------------------------------------------------------------------------------------------------ 15)AUTHOR ------------------------------------------------------------------------------------------------------------------------ Name : Ayesha, Shaik Role : Programmer Analyst Trainee Location : Chennai ======================================================================================================================== END OF README ========================================================================================================================