diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 4239d188f39..be8acb7861b 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -35,20 +35,20 @@ jobs: run: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000 - name: Change api proxy url ๐Ÿ“ - run: 'sed --in-place "s^\"proxy\": .*,^\"proxy\": \"http://localhost:9000\",^g" package.json' + run: 'sed --in-place "s^\"target\": .*,^\"target\": \"http://localhost:9000\",^g" vite.config.ts' - name: Install dependencies ๐Ÿ“ฆ - run: npm install --legacy-peer-deps + run: npm install - name: Compile rescript files โš™๏ธ run: "npm run build:res" - name: Cypress run ๐Ÿฅฌ - uses: cypress-io/github-action@v4 + uses: cypress-io/github-action@v5 with: env: SKIP_PREFLIGHT_CHECK=true install: false - start: "npm run dev:react" + start: "npx vite --host" wait-on: "http://localhost:4000" wait-on-timeout: 300 browser: electron @@ -73,7 +73,7 @@ jobs: labels: cypress failed - name: Upload cypress screenshots on failure ๐Ÿ“ธ - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: failure() with: name: cypress-screenshots @@ -81,7 +81,7 @@ jobs: # Test run video was always captured, so this action uses "always()" condition - name: Upload cypress videos ๐Ÿ“น - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: cypress-videos diff --git a/README.md b/README.md index f3918432612..83e293cbe68 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ - ๐Ÿ’ฌ Comment on the issue if you are willing to take it up, and link the pull request with the issue. - ๐Ÿท๏ธ Tag `@coronasafe/code-reviewers` for faster resolution. -- ๐Ÿ“ธ Attach screenshots in the pull requests shwoing the changes made in the UI. +- ๐Ÿ“ธ Attach screenshots in the pull requests showing the changes made in the UI. #### Install the required dependencies diff --git a/cypress/e2e/assets_spec/filter.cy.ts b/cypress/e2e/assets_spec/filter.cy.ts index 53e2279d64b..d0ada8711cf 100644 --- a/cypress/e2e/assets_spec/filter.cy.ts +++ b/cypress/e2e/assets_spec/filter.cy.ts @@ -22,17 +22,40 @@ describe("Assets Filter", () => { expect(interception.response.statusCode).to.equal(200); expect(interception.request.url).to.include("search_text=test"); }); + cy.contains("Apply").click(); + cy.contains("Facility:"); }); it("Filter by Asset Type", () => { - cy.get("[name='asset_type']").select("EXTERNAL"); + cy.get("[id='asset-type'] > div > button") + .click() + .get("li") + .contains("EXTERNAL") + .click(); + cy.contains("Apply").click(); + cy.contains("Asset Type: EXTERNAL"); }); it("Filter by Asset Status", () => { - cy.get("[name='asset_status']").select("ACTIVE"); + cy.get("[id='asset-status'] > div > button") + .click() + .get("li") + .contains("ACTIVE") + .click(); + cy.contains("Apply").click(); + cy.contains("Status: ACTIVE"); }); - afterEach(() => { + it("Filter by Asset Class", () => { + cy.get("[id='asset-class'] > div > button") + .click() + .get("li") + .contains("ONVIF Camera") + .click(); cy.contains("Apply").click(); + cy.contains("Asset Class: ONVIF"); + }); + afterEach(() => { + cy.saveLocalStorage(); }); }); diff --git a/cypress/e2e/auth_spec/auth.cy.ts b/cypress/e2e/auth_spec/auth.cy.ts index df9461f1030..d03ea34e671 100644 --- a/cypress/e2e/auth_spec/auth.cy.ts +++ b/cypress/e2e/auth_spec/auth.cy.ts @@ -14,7 +14,7 @@ describe("Authorisation/Authentication", () => { cy.url().should("include", "/"); }); - it("Try login admin with incorrect password", () => { + it("Try login as admin with incorrect password", () => { cy.log("Logging in the user: devdistrictadmin:Coronasafe@123"); cy.awaitUrl("/", true); diff --git a/cypress/integration/1-getting-started/todo.spec.js b/cypress/integration/1-getting-started/todo.spec.js deleted file mode 100644 index 4768ff923ec..00000000000 --- a/cypress/integration/1-getting-started/todo.spec.js +++ /dev/null @@ -1,143 +0,0 @@ -/// - -// Welcome to Cypress! -// -// This spec file contains a variety of sample tests -// for a todo list app that are designed to demonstrate -// the power of writing tests in Cypress. -// -// To learn more about how Cypress works and -// what makes it such an awesome testing tool, -// please read our getting started guide: -// https://on.cypress.io/introduction-to-cypress - -describe('example to-do app', () => { - beforeEach(() => { - // Cypress starts out with a blank slate for each test - // so we must tell it to visit our website with the `cy.visit()` command. - // Since we want to visit the same URL at the start of all our tests, - // we include it in our beforeEach function so that it runs before each test - cy.visit('https://example.cypress.io/todo') - }) - - it('displays two todo items by default', () => { - // We use the `cy.get()` command to get all elements that match the selector. - // Then, we use `should` to assert that there are two matched items, - // which are the two default items. - cy.get('.todo-list li').should('have.length', 2) - - // We can go even further and check that the default todos each contain - // the correct text. We use the `first` and `last` functions - // to get just the first and last matched elements individually, - // and then perform an assertion with `should`. - cy.get('.todo-list li').first().should('have.text', 'Pay electric bill') - cy.get('.todo-list li').last().should('have.text', 'Walk the dog') - }) - - it('can add new todo items', () => { - // We'll store our item text in a variable so we can reuse it - const newItem = 'Feed the cat' - - // Let's get the input element and use the `type` command to - // input our new list item. After typing the content of our item, - // we need to type the enter key as well in order to submit the input. - // This input has a data-test attribute so we'll use that to select the - // element in accordance with best practices: - // https://on.cypress.io/selecting-elements - cy.get('[data-test=new-todo]').type(`${newItem}{enter}`) - - // Now that we've typed our new item, let's check that it actually was added to the list. - // Since it's the newest item, it should exist as the last element in the list. - // In addition, with the two default items, we should have a total of 3 elements in the list. - // Since assertions yield the element that was asserted on, - // we can chain both of these assertions together into a single statement. - cy.get('.todo-list li') - .should('have.length', 3) - .last() - .should('have.text', newItem) - }) - - it('can check off an item as completed', () => { - // In addition to using the `get` command to get an element by selector, - // we can also use the `contains` command to get an element by its contents. - // However, this will yield the