github.com/quickfeed/quickfeed@v0.0.0-20240507093252-ed8ca812a09c/doc/selenium-testing.md (about)

     1  # How to run Selenium tests
     2  
     3  ## Required packages
     4  
     5  All required packages should automatically be downloaded using:
     6  
     7  ```shell
     8  npm install
     9  ```
    10  
    11  ## Installing browser specific drivers
    12  
    13  For Selenium to work, you need to download drivers for the browsers you want to use.
    14  A list of available drivers can be found [here](https://www.selenium.dev/documentation/webdriver/getting_started/install_drivers/).
    15  To use the Selenium's drivers, they must be in your system's `PATH`.
    16  
    17  On Linux and macOS, to verify that the drivers are in your `PATH`, run:
    18  
    19  ```shell
    20  which <driver_name>
    21  ```
    22  
    23  On Windows you can verify by running
    24  
    25  ```shell
    26  <driver_name>.exe
    27  ```
    28  
    29  ## Configuring the Selenium tests
    30  
    31  You can enable the specific browser drivers by editing `public/src/__tests__/config.json`.
    32  The Selenium tests will try to run in all enabled browsers.
    33  
    34  You can also specify a base URL to be used by the tests in the same `config.json` file.
    35  The base URL must match the URL of the web server used for testing.
    36  
    37  ## Running the Selenium tests
    38  
    39  Selenium tests require that the frontend is reachable at the base URL specified in `config.json`.
    40  
    41  To start a web server for testing, run:
    42  
    43  ```shell
    44  make webpack-dev-server
    45  ```
    46  
    47  This will print messages to the console ending with something like:
    48  
    49  ```shell
    50  webpack 5.65.0 compiled successfully in 6204 ms
    51  ```
    52  
    53  Then in another terminal window, run the actual Selenium tests with:
    54  
    55  ```shell
    56  make selenium
    57  ```
    58  
    59  Or:
    60  
    61  ```shell
    62  cd public
    63  npm run test:selenium
    64  ```
    65  
    66  Alternatively, you can run specific tests by running:
    67  
    68  ```shell
    69  npm run test:selenium -- -t "test_name"
    70  ```
    71  
    72  where `test_name` will try to match on the `describe` text in the tests.