Skip to content

mt-ag/docker-codecept-multimocha-playwright

Repository files navigation

Docker Codecept Multimocha Playwright

This Image uses the official Playwright Image and setups Codecept and Multimocha. You can mount your Codecept project into a container where it will get executed without additional setup.

How to use

Run your codecept project

docker run -it --rm -v /path/to/your/codecept/folder:/tests ghcr.io/mt-ag/codecept-multimocha-playwright:latest

Run one of the example tests:

docker run -it --rm -v $(pwd)/test/chromium:/tests ghcr.io/mt-ag/codecept-multimocha-playwright:latest

docker run -it --rm -v $(pwd)/test/firefox:/tests ghcr.io/mt-ag/codecept-multimocha-playwright:latest

docker run -it --rm -v $(pwd)/test/webkit:/tests ghcr.io/mt-ag/codecept-multimocha-playwright:latest

Note that you need Playwright in your Codecept config and multimocha:

exports.config = {
  tests: "./*.test.js",
  output: "./output",
  helpers: {
    Playwright: {
      url: "http://localhost",
      show: false,
      browser: "webkit",
    },
  },
  mocha: {
    reporterOptions: {
      "codeceptjs-cli-reporter": {
        stdout: "-",
        options: {
          verbose: false,
          steps: true,
        },
      },
      "mocha-junit-reporter": {
        stdout: "./output/console.log",
        options: {
          mochaFile: "./output/result.xml",
        },
        attachments: true,
      },
    },
  },
  ...
};

Full example config

Development

Build Image

docker build . -t codecept-multimocha-playwright

Debug:

docker run -it --rm -v $(pwd)/test/webkit:/tests codecept-multimocha-playwright:latest /bin/bash

Tests

./run_tests.sh