/
Switch dark and light mode

Switch dark and light mode

Prepared by

Test Scenario for

Prepared by

Test Scenario for

Foivos Polykarpou

Switch dark and light mode

Overview

Title

Test Name

Objective

Title

Test Name

Objective

Switch dark and light mode

darklight.js

Purpose

  • 1.1. This test verifies the functionality of switching between dark and light modes on the preferences page of a web application.

  • 1.2. It checks for any errors during the mode switch and captures console logs and screenshots for further analysis.

Prerequisites

Dependencies Installed: Make sure the required npm packages mentioned in Login with valid and wrong credentials are installed

  • Install minimist for environment variable (baseURL)

  • Ensure that the loginfc.js module is correctly set up and exports the page, browser, and baseUrl objects.

  • The chai library should be installed for assertions.

  • The test environment should have access to the web application at the specified baseUrl.

npm install puppeteer minimist

Test Steps

  • Navigation

    • Navigate to the preferences page using the page.goto method.

    • Verify successful navigation by checking the current URL.

  • Switch to Dark Mode

    • Wait for the cursor-pointer element to be visible.

    • Click the element to switch to dark mode.

    • Introduce a 5-second delay to allow the mode switch to complete.

    • Capture a screenshot of the dark mode.

  • Switch to Light Mode

    • Click the cursor-pointer element again to switch back to light mode.

    • Introduce another 5-second delay.

    • Capture a screenshot of the light mode.

  • 4.4. Error Handling

    • If an error occurs during the mode switch, capture a screenshot and log the page's HTML content for debugging.

Expected Result

  • 5.1. The test should successfully navigate to the preferences page and switch between dark and light modes without errors.

  • 5.2. Screenshots should be captured for both modes, and console logs should be free of errors.