diff --git a/.github/workflows/github-ci.yml b/.github/workflows/github-ci.yml new file mode 100644 index 0000000..9adb367 --- /dev/null +++ b/.github/workflows/github-ci.yml @@ -0,0 +1,41 @@ +# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions + +name: Wallet App CI for New Pull Requests + +on: + pull_request: + paths-ignore: + - "**.md" + branches: + - "*" + +jobs: + install: + name: Install dependencies + runs-on: ubuntu-latest + steps: + # https://github.com/actions/checkout + - name: Checkout 🛎️ + uses: actions/checkout@v4 + + # only install dependencies + # https://github.com/cypress-io/github-action + - name: Install 📦 + uses: cypress-io/github-action@v6 + with: + runTests: false + + cypress-tests: + name: Run cypress unit tests + needs: install + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Run Component tests 🧪 + uses: cypress-io/github-action@v6 + with: + command: yarn run cypress-component-test diff --git a/apps/web/src/components/copyright.cy.tsx b/apps/web/src/components/copyright.cy.tsx index c9e84fa..06adda6 100644 --- a/apps/web/src/components/copyright.cy.tsx +++ b/apps/web/src/components/copyright.cy.tsx @@ -4,16 +4,16 @@ import Copyright from "./Copyright"; describe("Copyright Component", () => { it("renders correctly", () => { cy.mount(); - + // Check for the text "Copyright ©" cy.contains("Copyright ©").should("exist"); - + // Check for the link with the correct href cy.get("a").should("have.attr", "href", "https://mui.com/"); - + // Check for the text "Your Website" cy.contains("Your Website").should("exist"); - + // Check for the current year const currentYear = new Date().getFullYear(); cy.contains(currentYear.toString()).should("exist"); @@ -26,7 +26,8 @@ describe("Copyright Component", () => { cy.get("p").should("have.class", "MuiTypography-body2"); // Check if MuiLink component is rendered with correct href - cy.get("a").should("have.class", "MuiLink-root") + cy.get("a") + .should("have.class", "MuiLink-root") .and("have.attr", "href", "https://mui.com/"); }); -}); \ No newline at end of file +}); diff --git a/package.json b/package.json index 070bdb0..b6386e7 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "license": "MIT", "scripts": { "pre-commit": "yarn workspaces run pre-commit", + "cypress-component-test": "yarn workspace web run cy:component", "commitlint": "commitlint", "lint-staged": "lint-staged", "postinstall": "husky",