Skip to content

Codecept with Playwright e2e tests throws connection refused error in Github Actions #15642

Closed

Description

Context:

  • Playwright Version: 1.18.0
  • Operating System: Linux
  • Node.js version: 14
  • Browser: [Chromium, Firefox]

I'm trying to run e2e tests in parallel with workers (run-workers) in Github Actions in headless mode and getting this error
browserContext.storageState: net::ERR_FAILED at https://localhost:3000/ at Playwright._after

Some of the tests run successfully before throwing this error.
I have observed this error only on Github Actions and works fine on local

browserContext.storageState: net::ERR_FAILED at https://localhost:3000/
    at Playwright._after (/data/runners/node_modules/codeceptjs/lib/helper/Playwright.js:434:50) {
  name: 'Error'
}
  Click on close icon in nav bar when the form is in dirty state then Save the changes- Crystal
    --- STARTED "before each" hook: Before for "Click on close icon in nav bar when the form is in dirty state then Save the changes- Crystal" ---
    I clear cookie 
    › Screenshot is saving to /data/runners/test/output/record_2ade0e9c5f1ca5cebfabd11e1e1ae3fa/0000.png
    I am on page "/home"
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    › Screenshot is saving to /data/runners/test/output/record_2ade0e9c5f1ca5cebfabd11e1e1ae3fa/0001.png
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] Error | Error: page.goto: net::ERR_CONNECTION_REFUSED at https://localhost:3000/showcase/home
=========================== logs ===========================
navigating to "https://localhost:3000/showcase/home", waiting until "networkidle"
============================================================
    [1] <teardown> Stopping recording promises
  ✖ FAILED in 212ms

configuration file

const { setHeadlessWhen, setWindowSize } = require("@codeceptjs/configure");
const { integration } = require(`./../package.json`);
const page = require("./utils/pageObject");
const bootstrap = require("./utils/boostrap");
const users = require("./utils/users");

setHeadlessWhen(process.env.CI || integration.headless);
setWindowSize(1920, 1080);

exports.config = {
    tests: `./**/*.+(e2e|visual).+(js|ts)`,
    output: `./output`,
    helpers: {
        Playwright: {
            url: process.env.SHOWCASE_URL || integration.url || "https://localhost:3000/showcase",
            browser: process.profile || integration.browser || "chromium",
            show: !integration.headless,
            coloredLogs: true,
            smartWait: integration.waitInSeconds * 1000 || 5 * 1000,
            uniqueScreenshotNames: true,
            fullPageScreenshots: true,
            restart: false,
            keepBrowserState: true,
            keepCookies: true,
            waitForNavigation: "networkidle0",
            timeouts: {
                script: 60000,
                "page load": 10000,
            },
            ignoreHTTPSErrors: true,
            chromium: {
                args: [
                    "--disable-web-security",
                    "--allow-insecure-localhost",
                    "--ignore-certificate-errors",
                    "--no-sandbox",
                    "-–allow-file-access-from-files",
                ],
            },
            firefox: {
                args: [
                    "--disable-web-security",
                    "--allow-insecure-localhost",
                    "--ignore-certificate-errors",
                    "--ignore-ssl-errors",
                    "--no-sandbox",
                    "-–allow-file-access-from-files",
                ],
            },
        },
        Actions: {
            require: "./utils/helpers/actionsHelper.js",
        },
    },
    include: {
        I: "./utils/customSteps.js",
        Selectors: "./utils/pageObject",
    },
    multiple: {
        e2e: {
            browsers: [{ browser: "firefox" }, { browser: "chromium" }],
        },
    },
    bootstrap: bootstrap,
    mocha: {},
    name: "showcase",
    plugins: {
        retryFailedStep: {
            enabled: true,
        },
        stepByStepReport: {
            enabled: true,
        },
        screenshotOnFail: {
            enabled: false,
        },
        customLocator: {
            enabled: true,
            prefix: "testid=",
            attribute: "data-testid",
        },
        allure: {
            enabled: false,
            enableScreenshotDiffPlugin: false,
        },
        autoLogin: {
            enabled: true,
            saveToFile: true,
            inject: "loginAs",
            users: users,
        },
        stepTimeout:{
            enabled: true,
            timeout: 10
        }
    },
};

Describe the bug

Add any other details about the problem here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions