Gitlab CI Configuration

Setup of Gitlab CI Configuration

Explanation for the script above:

  1. Stages define a stage for the test automation process, you can name it to your liking but we are choosing ‘test’ here for clarity.
  2. e2e - this is the label for the job, again you can name it whatever you want.
    • stage : should be ‘test’.
    • only : list your target branches here, for example, if you want to run the job after push or merge to ‘dev’ branch then you need to add it here.
    • tags : Should be ‘general’ for the job to be picked up by the runner, you can adjust this according to your CI configuration.
    • image : The docker image to be used by the job, just use the official one provided by Microsoft.
    • script : The scripts to be executed by the runner
      • cp TSP_DEV_CA.crt /usr/local/share/ca-certificates
      • update-ca-certificates - The above 2 scripts are for installing root certificates for our DEV environment. If your server isn’t behind a VPN you don’t need to do this.
      • npm ci installing the dependencies.
      • npx playwright test running the end to end test.
    • timeout : Maximum time the job can be run.
    • artifacts : Controls whether the job should produce an artifact (in this case ‘always’ because Playwright produces a report after the test finished), where to store them and when it should expire.

Reference : Gitlab yml Docs