Skip to content

Commit

Permalink
ci: run cypress using dev server (#5297)
Browse files Browse the repository at this point in the history
  • Loading branch information
petermakowski committed Jan 23, 2024
1 parent 0911384 commit f049c15
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,49 @@ on:
- main
- "3.*"
- "*cypress*"

jobs:
cypress:
name: Cypress
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
groups: ['no-users', 'with-users']
env:
MAAS_URL: http://localhost:5240
MAAS_UI_URL: http://localhost:8400
steps:
- uses: actions/checkout@main
- name: Get branch name
uses: nelonoel/branch-name@v1.0.1
- name: Setup MAAS
uses: canonical/setup-maas@main
with:
maas-url: ${{env.MAAS_URL}}/MAAS
maas-url: ${{ env.MAAS_URL }}/MAAS
- name: Install Cypress
uses: cypress-io/github-action@v4
with:
runTests: false
install-command: yarn install
- name: Run Cypress tests without a user
uses: cypress-io/github-action@v4
with:
config: baseUrl=${{env.MAAS_URL}},pageLoadTimeout=100000
install: false
spec: "cypress/e2e/no-users/**/*.spec.ts"
wait-on: "${{env.MAAS_URL}}/MAAS/r/machines"
build: yarn build
- name: Create MAAS admin
if: matrix.groups == 'with-users'
run: sudo maas createadmin --username=admin --password=test --email=fake@example.org
- name: Create MAAS non-admin user
if: matrix.groups == 'with-users'
run: |
export API_KEY=`sudo maas apikey --username=admin`
maas login admin http://localhost:5240/MAAS $API_KEY
maas admin users create username=user password=test email=fake-user@example.org is_superuser=0
- name: Wait for MAAS boot resources
run: while [ $(maas admin boot-resources is-importing | cat) == "true" ]; do sleep 10; done; echo "syncing finished"
- name: Run Cypress tests with a user
- name: Run Cypress tests
uses: cypress-io/github-action@v4
with:
config: baseUrl=${{env.MAAS_URL}},pageLoadTimeout=100000
config: baseUrl=${{env.MAAS_UI_URL}},pageLoadTimeout=100000
install: false
spec: "cypress/e2e/with-users/**/*.spec.ts"
wait-on: "${{env.MAAS_URL}}/MAAS/r/machines"
start: yarn start
spec: cypress/e2e/${{ matrix.groups }}/**/*.spec.ts
wait-on: ${{env.MAAS_UI_URL}}/MAAS/r/machines
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand All @@ -62,4 +63,4 @@ jobs:
WORKFLOW: ${{ github.workflow }}
with:
filename: .github/ISSUE_TEMPLATE/ci-failure.md
update_existing: true
update_existing: true

0 comments on commit f049c15

Please sign in to comment.