stages:
  - install
  - test
  - build
  - deploy

default:
  image: iqbberlin/aspect-test:latest

test-unit:
  stage: test
  before_script:
    - npm ci --cache .npm --prefer-offline
  script:
    - npm run test

test-e2e:
  stage: test
  before_script:
    - npm ci --cache .npm --prefer-offline
  script:
    - nohup npm run start-editor-local &
    - nohup npm run start-player-local &
    - sleep 20
    - npm run e2e-headless
  artifacts:
    when: always
    paths:
      - e2e/downloads/**/*.*
      - e2e/videos/**/*.mp4
      - e2e/screenshots/**/*.png

#deploy:
#  stage: deploy
#  only:
#    refs:
#      - master
#  before_script:
#    - npm ci --cache .npm --prefer-offline
#  script:
#    - npm run build-editor
#    - npm run build-player
#    - ./scripts/deploy.sh $TESTSTUDIO_USERNAME $TESTSTUDIO_PASSWORD
#  artifacts:
#    paths:
#      - dist/iqb-editor-aspect-nightly.html
#      - dist/iqb-player-aspect-nightly.html
#    expire_in: 1 week
