Skip to content

Commit

Permalink
ci: setup install and cypress ci (#237)
Browse files Browse the repository at this point in the history
  • Loading branch information
dorukucak committed Oct 22, 2024
1 parent 04d794d commit c10afaa
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 6 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/github-ci.yml
Original file line number Diff line number Diff line change
@@ -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
13 changes: 7 additions & 6 deletions apps/web/src/components/copyright.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import Copyright from "./Copyright";
describe("Copyright Component", () => {
it("renders correctly", () => {
cy.mount(<Copyright />);

// 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");
Expand All @@ -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/");
});
});
});
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit c10afaa

Please sign in to comment.