Search code examples
dockergitlabautomated-testsplaywrightplaywright-typescript

"shell not found" error on Gitlab pipeline attempting to run Microsoft Playwright tests


I am running into an issue running Microsoft Playwright on Gitlab. When I kick off the test, I get the shell not found error after the image is pulled.

YML file

stages:
   - test

tests:
  rules:
      - when: manual
  stage: test
  image: mcr.microsoft.com/playwright:v1.41.1-jammy
  script:
    - npm ci
    - npx playwright test
  artifacts:
    paths:  
      - playwright-report
      - test-results
      - results.xml/
    when: always
    expire_in: 120 days  
    reports:
        junit: results.xml

Error highlighted below

enter image description here

Can someone let me know what I am doing wrong?

Thanks


Solution

  • I figured it out by using the tsconfig path mapping. I added the tsconfig.json file in my root directory, then used the mapping below. Reference - https://playwright.dev/docs/test-typescript#typescript-with-esm

    {
        "compilerOptions": {
          "baseUrl": "./",  
          "paths": {
            "@pages/*": ["pages/*"]  
          }
        }
      }
    

    Thanks, @EnergY for your suggestions regarding the original issue I hope this helps someone out