Unable to run Karma Tests with Github Actions

81 Views Asked by At

I have start to create a workflow to execute my tests with Github Actions, but I am having an error at the time my tests start being executed. I have set selenium/standalone-chrome:111.0 service to run Chrome, but once it my tests runs, I get the following error:

04 12 2023 17:20:28.912:INFO [karma-server]: Karma v6.4.2 server started at http://karma:9876/
04 12 2023 17:20:28.913:INFO [launcher]: Launching browsers Piper_ChromeRemote with concurrency unlimited
04 12 2023 17:20:28.918:INFO [launcher]: Starting browser chrome via Remote WebDriver
04 12 2023 17:20:28.918:DEBUG [launcher]: null -> BEING_CAPTURED
04 12 2023 17:20:28.919:DEBUG [temp-dir]: Creating temp dir at /tmp/karma-36740631
04 12 2023 17:20:28.920:DEBUG [WebDriver]: WebDriver config: {"hostname":"selenium","port":4444}
04 12 2023 17:20:28.920:DEBUG [WebDriver]: Browser capabilities: {"platform":"ANY","testName":"Karma test","tags":[],"version":"","base":"WebDriver","browserName":"chrome","name":"Karma","pseudoActivityInterval":30000,"goog:chromeOptions":{"args":["--disable-gpu","--no-sandbox","--window-size=1920,1080","--disable-dev-shm-usage","--disable-background-timer-throttling"]}}
04 12 2023 17:20:30.847:DEBUG [WebDriver]: Session ID: 52d38f67f43f47c195e71b39550f6611
04 12 2023 17:20:31.266:ERROR [WebDriver]: WebDriver command failed {
  spec: {
    platform: 'ANY',
    testName: 'Karma test',
    tags: [],
    version: '',
    base: 'WebDriver',
    browserName: 'chrome',
    name: 'Karma',
    pseudoActivityInterval: 30000,
    'goog:chromeOptions': { args: [Array] }
  },
  error: Error: [get("http://karma:9876/?id=36740631")] Error response status: 13, UnknownError - An unknown server-side error occurred while processing the command. Selenium error: unknown error: net::ERR_NAME_NOT_RESOLVED
    (Session info: chrome=111.0.5563.146)
  Build info: version: '4.8.3', revision: 'b19b418e60'
  System info: os.name: 'Linux', os.arch: 'amd64', os.version: '5.15.0-1047-gcp', java.version: '11.0.18'
  Driver info: driver.version: unknown

(node:internal/process/task_queues:82:21) { status: 13, cause: { state: 'unknown error', sessionId: null, class: 'org.openqa.selenium.remote.Response', value: [Object], status: 13 }, inspect: [Function (anonymous)], 'jsonwire-error': { status: 13, summary: 'UnknownError', detail: 'An unknown server-side error occurred while processing the command.' } } }

Here is my workflow:

name: Unit Tests Check

on:
  pull_request:
    branches:
      - main

jobs:
  build:
    runs-on: ubuntu-latest
    container:
      image: node:18

    services:
      selenium:
        image: selenium/standalone-chrome:111.0
        options: --shm-size=2gb

    steps:
    - name: Checkout code
      uses: actions/checkout@v4
    - uses: actions/setup-node@v3
      with:
        node-version: '18'
        cache: 'npm'

    - name: Install dependencies
      run: |
        cd inbox
        npm install

    - name: Run all tests
      run: |
        cd inbox
        npm run test
0

There are 0 best solutions below