---
image: node

variables:
  npm_config_cache: "$CI_PROJECT_DIR/.npm"
  CYPRESS_CACHE_FOLDER: "$CI_PROJECT_DIR/cache/Cypress"

cache:
  key: __${CI_COMMIT_REF_SLUG}
  paths:
    - .npm
    - cache/Cypress

stages:
  - test
  - release

test:
  image: cypress/base:10
  stage: test
  before_script:
    - npm ci
    - npm run build
    - npm run serve &
    - $(npm bin)/wait-on http://127.0.0.1:9000
  script:
    - npm test
  tags:
    - sib
  except:
    - tags
  artifacts:
    paths:
      - cypress/videos
      - cypress/screenshots
    expire_in: 1 day
