Skip navigation

Get Started

Prerequisites

Before you begin, make sure you have the following programs installed on your system:

Additionally, ensure you have the following Visual Studio Code extensions installed:

Installation

  1. Clone the regression-test repository by running the following command in the terminal:

    git clone https://github.com/precise-alloy/regression-test.git
    
  2. Install the required node modules by executing the following command in the terminal:

    npm install
    

Creating your first Test Suite

  1. Creating a Test Suite.

    Create a test suite in the data folder. Each test suite should adhere to the naming convention: <name>.tests.yaml.
    For instance, you can create a file named data/alloy.tests.yaml with the following content:

    scenarios:
       - url: https://alloy.eshn.dev/pages/home.html
       - url: https://alloy.eshn.dev/pages/service.html
       - url: https://alloy.eshn.dev/pages/portfolio.html
       - url: https://alloy.eshn.dev/pages/contact.html
    

    For more information on available options within a test suite, refer to the Create a test suite and Create a scenario documentation.

  2. Taking a Snapshot of the Website.

    To capture a snapshot of the website at the current time, use the following command:

    npm run ref -- --test-suite alloy
    

    Please note that the ref command only captures the snapshot but does not open any report in the browsers.

  3. Approving the Snapshot.

    To approve the captured snapshot, run the following command:

    npm run approve -- --test-suite alloy
    
  4. Testing for Visual Changes.

    Suppose the development team has just deployed new code to the site, and you want to ensure that nothing is breaking visually or that all visual changes are as intended. Use the following command to perform the test:

    npm run test -- --test-suite alloy
    

    After the command finishes, it will open the test report in your default browser, showing the results.

    If the test results appear to be correct, run the approve command again as mentioned above to set the new reference. However, if any issues are identified, inform the development team so that they can fix the problems and then re-run the testing step.

  5. Regression Testing after New Deployment.

    Whenever there is a new deployment, you can re-execute the test and approve it again to perform regression testing on the site visually.