From a2d8420cc584120cdf85e28c40d28b4c2bf32dc6 Mon Sep 17 00:00:00 2001 From: Mohammed Rabil <63334479+rabilrbl@users.noreply.github.com> Date: Sat, 22 Oct 2022 07:19:17 +0530 Subject: [PATCH] Cypress: Fixes & Refactoring (#3798) * Create main.yml * Fix main.yml errors * Update main.yml * Update and rename main.yml to merge_upstream.yml * Update merge_upstream.yml * Update merge_upstream.yml * Refactor cypress workflow - Change to ubuntu-latest - Switch to npm from yarn - Give appropriate names for each step in workflow * Fix patient crud error on Add Patient button * Remove accidentally added workflow * Delete stale.yml (#3782) * feat: added github stale action (#3785) * Made the teleicuvitalcard responsive (#3669) * Made TeleViatlsCard responsive * Minor enhancement * fix buggy redirect after clicking on cancel button in add more bed types (#3710) * fix buggy redirect after clicking on cancel button in add more bed types * fix: deepscan issues * Update packages and remove obsolete dependencies (#3748) * Remove nonessential packages * Update packages having a minor version change * Add back autoprefixer * Fix for google maps * Change error message for offline camera (#3789) * Minor UI enhacement in Patients page for extreme small devices and some ranges (#3779) * Use `Inter` font as the sans font (#3683) * Adds `Inter` as sans font * fix overweighted font usages * correct font weights * correct font weights * Fix login page title overflow * Adds fallback to `sans-serif` Co-authored-by: Bodhish Thomas * Update src/style/index.css Co-authored-by: Bodhish Thomas * fix syntax * fix typo Co-authored-by: Bodhish Thomas * Patient Category Colors (#3728) * patient category type * show category in patient list page * move colors to tailwind config for app wide access * category on info card * fix issue with classes skipped from build * category on patient profile * patient info card, move category above patient photo * Revert "patient info card, move category above patient photo" This reverts commit 9dc5d5582b18d65ea6ff7c2e884fe803ccbc167f. * Patient Review feature fixes (#3584) * Add review_interval and review badges * Change label to Review before * Update src/Components/Patient/DailyRounds.tsx Co-authored-by: Khavin Shankar * Upgrade cypress to v10.10.0 * Fix Error in facility create with adding doctor * Fix `parseInt` parameter error in patient crud * Add emojis Co-authored-by: Khavin Shankar Co-authored-by: ARYAN PATEL Co-authored-by: Pragati Bhattad <55177805+Pragati1610@users.noreply.github.com> Co-authored-by: Ashesh <3626859+Ashesh3@users.noreply.github.com> Co-authored-by: Rithvik Nishad Co-authored-by: Bodhish Thomas --- .github/workflows/cypress.yaml | 38 +++++++++++++-------- cypress/e2e/facility_spec/facility.cy.ts | 5 ++- cypress/e2e/patient_spec/patient_crud.cy.ts | 6 ++-- package-lock.json | 34 +++++++++--------- package.json | 2 +- 5 files changed, 47 insertions(+), 38 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 886d4ea6966..80e3437e4b8 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -11,49 +11,57 @@ on: jobs: cypress-run: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 + - name: Checkout 📥 + uses: actions/checkout@v3 - - name: Checkout care + - name: Checkout care 📥 uses: actions/checkout@v3 with: repository: coronasafe/care path: care - - name: Docker Layer Caching + - name: Docker Layer Caching 🍥 uses: satackey/action-docker-layer-caching@v0.0.11 - - name: Compose Up Care + - name: Run docker compose up on care 🐳 run: cd care && touch .env && make build && make up && cd .. && sleep 30s # Voluntarily kept 30 seconds delay to wait for migrations to complete. - - run: docker exec care python manage.py collectstatic - - run: docker exec care python manage.py load_dummy_data + - name: Run Django collectstatic and load dummy data on care 🐍 + run: | + docker exec care python manage.py collectstatic + docker exec care python manage.py load_dummy_data - - name: Check if care is up + - name: Check care is up ♻ run: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000 - - name: Replace proxy with local care + - name: Change api proxy url 📝 run: 'sed --in-place "s^\"proxy\": .*,^\"proxy\": \"http://localhost:9000\",^g" package.json' - - run: yarn install - - name: Cypress run + - name: Install dependencies 📦 + run: npm install --legacy-peer-deps + + - name: Cypress run 🥬 uses: cypress-io/github-action@v4 with: install: false - start: yarn start + start: npm run start wait-on: "http://localhost:4000" wait-on-timeout: 300 browser: electron - - uses: actions/upload-artifact@v2 + + - name: Upload cypress screenshots on failure 📸 + uses: actions/upload-artifact@v2 if: failure() with: name: cypress-screenshots path: cypress/screenshots + # Test run video was always captured, so this action uses "always()" condition - - uses: actions/upload-artifact@v2 + - name: Upload cypress videos 📹 + uses: actions/upload-artifact@v2 if: always() with: name: cypress-videos diff --git a/cypress/e2e/facility_spec/facility.cy.ts b/cypress/e2e/facility_spec/facility.cy.ts index 79c9c23fa50..4d2295f2f1c 100644 --- a/cypress/e2e/facility_spec/facility.cy.ts +++ b/cypress/e2e/facility_spec/facility.cy.ts @@ -138,12 +138,15 @@ describe("Facility", () => { cy.get("[id=bed-capacity-cancel]").click(); // add doctor information + cy.get("button") + .should("contain", "Add Doctor Types") + .contains("Add Doctor Types") + .click({ force: true }); cy.url().should("include", "doctor"); cy.get("[id=area-of-specialization]").select("1"); cy.get("[id=count]").type("15"); cy.get("[id=doctor-save").click(); cy.verifyNotification("Doctor count added successfully"); - cy.url().should("include", "doctor"); cy.get("[id=doctor-cancel").click(); cy.url().then((url) => { diff --git a/cypress/e2e/patient_spec/patient_crud.cy.ts b/cypress/e2e/patient_spec/patient_crud.cy.ts index 22484ca3381..228b6b23861 100644 --- a/cypress/e2e/patient_spec/patient_crud.cy.ts +++ b/cypress/e2e/patient_spec/patient_crud.cy.ts @@ -2,7 +2,7 @@ import { cy, describe, before, beforeEach, it, afterEach } from "local-cypress"; const username = "devdistrictadmin"; const password = "Coronasafe@123"; -const phone_number = "9" + parseInt(Math.random() * 10 ** 9).toString(); +const phone_number = "9" + parseInt((Math.random() * 10 ** 9).toString()); const emergency_phone_number = "9430123487"; let patient_url = ""; @@ -50,8 +50,8 @@ describe("Patient Creation", () => { emergency_phone_number, { delay: 100 } ); - cy.get("[data-testid=pincode] input").click(); - cy.get("[data-testid=submit-button]").click(); + cy.wait(1000); + cy.get("button").get("[data-testid=submit-button]").click(); cy.url().should("include", "/consultation"); cy.url().then((url) => { cy.log(url); diff --git a/package-lock.json b/package-lock.json index 3f171958cf5..c591099ca90 100644 --- a/package-lock.json +++ b/package-lock.json @@ -106,7 +106,7 @@ "@typescript-eslint/eslint-plugin": "^5.13.0", "@typescript-eslint/parser": "^5.13.0", "autoprefixer": "^10.4.12", - "cypress": "^10.6.0", + "cypress": "^10.10.0", "cypress-localstorage-commands": "^2.1.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.5.0", @@ -26234,12 +26234,11 @@ "license": "MIT" }, "node_modules/cypress": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.6.0.tgz", - "integrity": "sha512-6sOpHjostp8gcLO34p6r/Ci342lBs8S5z9/eb3ZCQ22w2cIhMWGUoGKkosabPBfKcvRS9BE4UxybBtlIs8gTQA==", + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.10.0.tgz", + "integrity": "sha512-bU8r44x1NIYAUNNXt3CwJpLOVth7HUv2hUhYCxZmgZ1IugowDvuHNpevnoZRQx1KKOEisLvIJW+Xen5Pjn41pg==", "dev": true, "hasInstallScript": true, - "license": "MIT", "dependencies": { "@cypress/request": "^2.88.10", "@cypress/xvfb": "^1.2.4", @@ -26260,7 +26259,7 @@ "dayjs": "^1.10.4", "debug": "^4.3.2", "enquirer": "^2.3.6", - "eventemitter2": "^6.4.3", + "eventemitter2": "6.4.7", "execa": "4.1.0", "executable": "^4.1.1", "extract-zip": "2.0.1", @@ -28552,11 +28551,10 @@ } }, "node_modules/eventemitter2": { - "version": "6.4.5", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.5.tgz", - "integrity": "sha512-bXE7Dyc1i6oQElDG0jMRZJrRAn9QR2xyyFGmBdZleNmyQX0FqGYmhZIrIrpPfm/w//LTo4tVQGOGQcGCb5q9uw==", - "dev": true, - "license": "MIT" + "version": "6.4.7", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz", + "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==", + "dev": true }, "node_modules/eventemitter3": { "version": "4.0.7", @@ -69216,9 +69214,9 @@ "dev": true }, "cypress": { - "version": "10.6.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.6.0.tgz", - "integrity": "sha512-6sOpHjostp8gcLO34p6r/Ci342lBs8S5z9/eb3ZCQ22w2cIhMWGUoGKkosabPBfKcvRS9BE4UxybBtlIs8gTQA==", + "version": "10.10.0", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-10.10.0.tgz", + "integrity": "sha512-bU8r44x1NIYAUNNXt3CwJpLOVth7HUv2hUhYCxZmgZ1IugowDvuHNpevnoZRQx1KKOEisLvIJW+Xen5Pjn41pg==", "dev": true, "requires": { "@cypress/request": "^2.88.10", @@ -69240,7 +69238,7 @@ "dayjs": "^1.10.4", "debug": "^4.3.2", "enquirer": "^2.3.6", - "eventemitter2": "^6.4.3", + "eventemitter2": "6.4.7", "execa": "4.1.0", "executable": "^4.1.1", "extract-zip": "2.0.1", @@ -70864,9 +70862,9 @@ "dev": true }, "eventemitter2": { - "version": "6.4.5", - "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.5.tgz", - "integrity": "sha512-bXE7Dyc1i6oQElDG0jMRZJrRAn9QR2xyyFGmBdZleNmyQX0FqGYmhZIrIrpPfm/w//LTo4tVQGOGQcGCb5q9uw==", + "version": "6.4.7", + "resolved": "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.7.tgz", + "integrity": "sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==", "dev": true }, "eventemitter3": { diff --git a/package.json b/package.json index 9317026e4d2..8805a7d6803 100644 --- a/package.json +++ b/package.json @@ -161,7 +161,7 @@ "@typescript-eslint/eslint-plugin": "^5.13.0", "@typescript-eslint/parser": "^5.13.0", "autoprefixer": "^10.4.12", - "cypress": "^10.6.0", + "cypress": "^10.10.0", "cypress-localstorage-commands": "^2.1.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.5.0",