skip to Main Content

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

2

Answers


  1. Chosen as BEST ANSWER

    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


  2. there may be two workarounds for your problem.

    1. Edit your config.toml file by adding and changing this lines :

    config.toml

    ...
    executor = "docker"
    shell = "bash" ## <- add this line
    [runners.cache] 
        MaxUploadedArchiveSize = 0 
    [runners.docker] 
        tls_verify = false 
        image = "ruby:2.7" 
        privileged = true ## <- and this to true
        disable_entrypoint_overwrite = false 
        oom_kill_disable = false 
        disable_cache = false 
        volumes = ["/cache"] 
        shm_size = 0
    
    1. If this doesn’t work change your image keyword in your pipeline into this by adding the /bin/sh or /bin/bash entrypoint :
    stages:
       - test
    
    tests:
      ...
      stage: test
      image: 
        name: mcr.microsoft.com/playwright:v1.41.1-jammy
        entrypoint: [ '/bin/sh', '-c' ] # or entrypoint: [ '/bin/bash', '-c' ]
      script:
        - npm ci
        - npx playwright test
      ...
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search