version: 2.1

orbs:
  browser-tools: circleci/browser-tools@1.4.8

defaults: &defaults
  machine:
    image: default
    docker_layer_caching: false
  steps:
    - checkout
    - run: .circleci/build.sh
    - browser-tools/install-chrome:
        chrome-version: latest # TODO: remove until: https://github.com/CircleCI-Public/browser-tools-orb/issues/75
        replace-existing: true # TODO: remove until: https://github.com/CircleCI-Public/browser-tools-orb/issues/75
    - run:
        command: docker-compose run --rm test-rest
        working_directory: test
        when: always
    - run:
        command: docker-compose run --rm test-acceptance.webdriverio
        working_directory: test
        when: always
    - run:
        command: docker-compose run --rm test-bdd.faker
        working_directory: test
        when: always

jobs:
  docker:
    <<: *defaults
    environment:
      - NODE_VERSION: 18.16.0

workflows:
  version: 2

  test_all:
    jobs:
      - docker
