wip #501
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test webapps | |
on: | |
push: | |
branches: | |
- 2023.9.x-feature-e2e | |
schedule: | |
- cron: "30 9 * * *" | |
jobs: | |
cypress-run: | |
name: Cypress run | |
runs-on: ubuntu-latest | |
env: | |
CORTEZA_VERSION: 2023.9.1 | |
CYPRESS_VERSION: 13.5.0 | |
CYPRESS_HOST: http://corteza | |
CYPRESS_BASE_URL: http://corteza | |
CYPRESS_ADMIN_URL: http://corteza/admin | |
CYPRESS_COMPOSE_URL: http://corteza/compose | |
CYPRESS_WORKFLOW_URL: http://corteza/workflow | |
CYPRESS_REPORTER_URL: http://corteza/reporter | |
CYPRESS_ONE_URL: http://corteza/one | |
CYPRESS_PRIVACY_URL: http://corteza/privacy | |
CYPRESS_USER_EMAIL: [email protected] | |
CYPRESS_USER_EMAIL_NEW: [email protected] | |
CYPRESS_USER_PASSWORD: cypress123 | |
CYPRESS_USER_PASSWORD_NEW: newcypress123 | |
CYPRESS_USER_DPO: [email protected] | |
CYPRESS_USER_DPO_PASSWORD: [email protected] | |
AUTH_REQUEST_RATE_LIMIT: 0 | |
FEDERATION_ENABLED: 'true' | |
FEDERATION_HOST: http://corteza | |
FEDERATION_LABEL: 'Corteza e2e federation host' | |
steps: | |
- name: Setup tmate session | |
uses: mxschmitt/action-tmate@v3 | |
with: | |
limit-access-to-actor: true | |
detached: true | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Pull docker images | |
run: docker-compose -f .github/docker-compose.yaml pull | |
- name: Run mailhog | |
run: docker-compose -f .github/docker-compose.yaml --project-directory cypress up -d mailhog | |
- name: Prepare npm packages | |
run: yarn | |
- name: Setup environment | |
env: | |
RELEASE_CRUST_SFTP_KEY: ${{ secrets.RELEASE_CRUST_SFTP_KEY }} | |
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }} | |
run: | | |
echo "SCREENSHOTS_GEN_FOLDER=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_ENV && \ | |
echo "TMP_KEY=$(mktemp)" >> $GITHUB_ENV | |
- name: Create crust key | |
env: | |
RELEASE_CRUST_SFTP_KEY: ${{ secrets.RELEASE_CRUST_SFTP_KEY }} | |
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }} | |
run: | | |
echo ${RELEASE_CRUST_SFTP_KEY} | base64 -d > ${RELEASE_CRUST_KEY_FILE} | |
- name: Make folder for uploaded screenshots | |
env: | |
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }} | |
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }} | |
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }} | |
run: | | |
printf '%s\n' 'cd screenshots' "mkdir ${SCREENSHOTS_GEN_FOLDER}" | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI} | |
- name: Run Admin tests | |
# specs cannot be inserted as --spec=file1.js,file2.js because cypress randomizes the list | |
run: | | |
docker-compose -f .github/docker-compose.yaml up -d corteza && \ | |
docker-compose -f .github/docker-compose.yaml --project-directory . run \ | |
--entrypoint='cypress run | |
--spec cypress/e2e/basic-functionalities/server/Create_user.cy.js | |
--reporter mochawesome | |
--browser chrome' \ | |
cypress && \ | |
docker-compose -f .github/docker-compose.yaml --project-directory . run \ | |
--entrypoint='cypress run | |
--spec cypress/e2e/basic-functionalities/admin/index.cy.js | |
--reporter mochawesome | |
--browser chrome' \ | |
cypress | |
# Cypress overwrites the screenshots folder, we need to do this after | |
# each failed run | |
- name: Upload screenshots | |
if: failure() | |
env: | |
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }} | |
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }} | |
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }} | |
run: | | |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI} | |
- name: Run Compose tests | |
if: success() || failure() | |
run: | | |
docker-compose -f .github/docker-compose.yaml restart corteza && \ | |
docker-compose -f .github/docker-compose.yaml --project-directory . run \ | |
--entrypoint='cypress run | |
--spec cypress/e2e/basic-functionalities/server/Create_user.cy.js | |
--reporter mochawesome | |
--browser chrome' \ | |
cypress | |
docker-compose -f .github/docker-compose.yaml --project-directory . run \ | |
--entrypoint='cypress run | |
--spec cypress/e2e/basic-functionalities/compose/index.cy.js | |
--reporter mochawesome | |
--browser chrome' \ | |
cypress | |
- name: Upload screenshots | |
if: failure() | |
env: | |
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }} | |
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }} | |
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }} | |
run: | | |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI} | |
- name: Run Server tests | |
if: success() || failure() | |
run: | | |
docker-compose -f .github/docker-compose.yaml restart corteza && \ | |
docker-compose -f .github/docker-compose.yaml --project-directory . run \ | |
--entrypoint='cypress run | |
--spec cypress/e2e/basic-functionalities/server/Create_user.cy.js | |
--reporter mochawesome | |
--browser chrome' \ | |
cypress | |
docker-compose -f .github/docker-compose.yaml --project-directory . run \ | |
--entrypoint='cypress run | |
--spec cypress/e2e/basic-functionalities/one/index.cy.js | |
--reporter mochawesome | |
--browser chrome'\ | |
cypress | |
- name: Upload screenshots | |
if: failure() | |
env: | |
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }} | |
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }} | |
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }} | |
run: | | |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI} | |
- name: Run Reporter, topbar, Workflows tests | |
if: success() || failure() | |
run: | | |
docker-compose -f .github/docker-compose.yaml restart corteza && \ | |
docker-compose -f .github/docker-compose.yaml --project-directory . run \ | |
--entrypoint='cypress run | |
--spec cypress/e2e/basic-functionalities/reporter/index.cy.js,cypress/e2e/basic-functionalities/topbar/index.cy.js,cypress/e2e/basic-functionalities/workflow/index.cy.js | |
--reporter mochawesome | |
--browser chrome' \ | |
cypress | |
- name: Upload screenshots | |
if: failure() | |
env: | |
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }} | |
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }} | |
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }} | |
run: | | |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI} | |
- name: Run Server tests | |
if: success() || failure() | |
run: | | |
docker-compose -f .github/docker-compose.yaml restart corteza && \ | |
docker-compose -f .github/docker-compose.yaml --project-directory . run \ | |
--entrypoint='cypress run | |
--spec cypress/e2e/basic-functionalities/server/index.cy.js | |
--reporter mochawesome | |
--browser chrome' \ | |
cypress | |
- name: Upload screenshots | |
if: failure() | |
env: | |
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }} | |
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }} | |
SCREENSHOTS_GEN_FOLDER: ${{ env.SCREENSHOTS_GEN_FOLDER }} | |
run: | | |
printf '%s\n' "cd screenshots/${SCREENSHOTS_GEN_FOLDER}" 'put -r cypress/screenshots/*' | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI} | |
- name: Publish results | |
# always() runs the step even when canceled manually | |
if: success() || failure() | |
env: | |
RELEASE_CRUST_SFTP_URI: ${{ secrets.RELEASE_CRUST_SFTP_URI }} | |
RELEASE_CRUST_KEY_FILE: ${{ env.TMP_KEY }} | |
run: | | |
npx mochawesome-merge "cypress/reports/*.json" > cypress/report.json && \ | |
npx marge -o cypress/reports-build -f index.html -i cypress/report.json && \ | |
echo "put cypress/reports-build/index.html" | sftp -q -o "StrictHostKeyChecking no" -i ${RELEASE_CRUST_KEY_FILE} ${RELEASE_CRUST_SFTP_URI} | |
- name: Send message on successful testing results | |
if: success() | |
uses: fadenb/[email protected] | |
env: | |
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }} | |
E2E_REPORTS_PASS: ${{ secrets.E2E_REPORTS_PASS }} | |
with: | |
homeserver: ${{ secrets.MATRIX_HOME_SERVER }} | |
token: ${{ secrets.MATRIX_ACCESS_TOKEN }} | |
channel: ${{ secrets.MATRIX_ROOM_ID }} | |
message: | | |
✅ E2e tests passed 🙌 🎉 | |
🔗 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/ | |
- name: Send message on failed testing results | |
if: failure() | |
uses: fadenb/[email protected] | |
env: | |
E2E_REPORTS_USER: ${{ secrets.E2E_REPORTS_USER }} | |
E2E_REPORTS_PASS: ${{ secrets.E2E_REPORTS_PASS }} | |
with: | |
homeserver: ${{ secrets.MATRIX_HOME_SERVER }} | |
token: ${{ secrets.MATRIX_ACCESS_TOKEN }} | |
channel: ${{ secrets.MATRIX_ROOM_ID }} | |
message: | | |
❌ E2e tests did not pass, screenshots provided | |
🔗 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/ | |
📷 https://${{ secrets.E2E_REPORTS_USER }}:${{ secrets.E2E_REPORTS_PASS }}@releases.cortezaproject.org/e2e-reports/screenshots/${{ env.SCREENSHOTS_GEN_FOLDER }}/ |