Skip to content

Commit

Permalink
refactor: move specs to new folders
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielogregorio committed Apr 14, 2024
1 parent 5454e87 commit cd45e28
Show file tree
Hide file tree
Showing 12 changed files with 66 additions and 28 deletions.
3 changes: 1 addition & 2 deletions .cypress-cucumber-preprocessorrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"stepDefinitions": [
"cypress/e2e/bdd/cases/*.{js,ts}",
"cypress/e2e/bdd/common/*.{js,ts}",
"cypress/e2e/bdd/*.{js,ts}",
"cypress/support/step_definitions/**/*.{js,ts}"
]
}
45 changes: 41 additions & 4 deletions .github/workflows/deploy-and-test-production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,44 @@ jobs:
run: npx cypress install

- name: running e2e tests
run: pnpm run prod:e2e:headless
run: pnpm run e2e:features

e2e_accessibility:
needs: install
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
pnpm-version: [8.3.1]

steps:
- name: Checkout
uses: actions/checkout@v2

- name: use pnpm ${{ matrix.pnpm-version }}
uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm-version }}

- name: restore node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: Cache Cypress Binary
uses: actions/cache@v2
with:
path: ~/.cache/Cypress
key: cypress-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
cypress-${{ runner.os }}-
- name: Install Cypress Binary
run: npx cypress install

- name: running e2e accessibility tests
run: pnpm run e2e:accessibility

unit_tests_and_up_coverage:
needs: install
Expand Down Expand Up @@ -98,7 +135,7 @@ jobs:
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: running tests and generate coverage
run: pnpm run test:coverage
run: pnpm run unit:coverage

- name: up coverage to codacy
run: bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r ./coverage/lcov.info
Expand Down Expand Up @@ -154,12 +191,12 @@ jobs:
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/pnpm-lock.yaml') }}

- name: verify if prettier is formated
run: pnpm run prettier:check
run: pnpm run format:check

deploy:
environment: sentry
timeout-minutes: 10
needs: [unit_tests_and_up_coverage, e2e_tests, lint, format]
needs: [unit_tests_and_up_coverage, e2e_tests, e2e_accessibility, lint, format]
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/main'

Expand Down
8 changes: 4 additions & 4 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ pnpm install
#pnpm build

echo "\n${Yellow}.......................CLEAR DIRT........................${NOCOLOR}"
pnpm run clear
pnpm run clear:env

echo "\n${Yellow}....................PRETTIER CHECKING....................${NOCOLOR}"
pnpm run prettier:check
pnpm run format:check

echo "\n${Yellow}...................LINT CHECKING...................${NOCOLOR}"
pnpm run lint

echo "\n${Yellow}...............UNIT TEST AND COVERAGE....................${NOCOLOR}"
pnpm run test:coverage
pnpm run unit:coverage

echo "\n${Yellow}...............E2E TESTS....................${NOCOLOR}"
pnpm run prod:e2e:headless
pnpm run e2e


echo "\n${Cyan}=========================================================${NOCOLOR}"
Expand Down
2 changes: 1 addition & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export default defineConfig({
retries: 1,
e2e: {
setupNodeEvents,
specPattern: ['cypress/e2e/bdd/cases/*.feature', 'cypress/e2e/tests/*.{js,ts}'],
specPattern: ['cypress/e2e/bdd/*.feature', 'cypress/e2e/accessibility/*.{js,ts}', 'cypress/e2e/tests/*.{js,ts}'],
baseUrl: 'http://127.0.0.1:5556/youtube-reload',
},
});
Binary file added cypress/downloads/downloads.htm
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
36 changes: 19 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,33 @@
},
"scripts": {
"dev": "vite --host",
"test": "vitest",
"test:coverage": "vitest --coverage --watch=false",
"check": "pnpm run prettier:format && pnpm run eslint:lint && pnpm run lint && pnpm run test:coverage && pnpm run build",
"e2e:headless": "start-server-and-test _starting_app http://0.0.0.0:5556/youtube-reload _headless",
"prod:e2e:headless": "start-server-and-test _build_start_app http://0.0.0.0:5556/youtube-reload _headless",
"e2e": "start-server-and-test _starting_app http://0.0.0.0:5556/youtube-reload _open",
"cypress": "pnpm run e2e",
"lint": "eslint -c ./.eslintrc.js --fix && tsc -p .",
"prettier:format": "prettier *.{ts,js,md,tsx,jsx} --write",
"prettier:check": "prettier *.{ts,js,md,tsx,jsx} --check",
"build": "vite build",
"test:ui": "vitest --ui",
"preview": "vite preview",
"test:env:preview": "vite preview --host --port=5556",
"cy:audit": "start-server-and-test start:cy http://localhost:7777 _audit-pa11y-lighthouse",
"_audit-pa11y-lighthouse": "cross-env NODE_ENV=test TYPE_TEST=dev TZ=America/Sao_Paulo cypress run --browser chrome --spec 'cypress/e2e/group2/**'",
"clear": "rm -rf build coverage",
"unit": "vitest",
"unit:coverage": "vitest --coverage --watch=false",
"unit:ui": "vitest --ui",
"unit:preview": "vite preview --host --port=5556",
"e2e": "start-server-and-test _build_start_app http://0.0.0.0:5556/youtube-reload _headless",
"e2e:ui": "start-server-and-test _starting_dev_app http://0.0.0.0:5556/youtube-reload _open",
"e2e:local": "start-server-and-test _starting_dev_app http://0.0.0.0:5556/youtube-reload _headless",
"e2e:features": "start-server-and-test _build_start_app http://0.0.0.0:5556/youtube-reload _headless:tests",
"e2e:accessibility": "start-server-and-test _build_start_app http://0.0.0.0:5556/youtube-reload _headless:accessibility",
"check:all": "pnpm run format && pnpm run lint && pnpm run lint && pnpm run unit:coverage && pnpm run e2e",
"format": "prettier *.{ts,js,md,tsx,jsx} --write",
"lint": "eslint -c ./.eslintrc.js --fix && tsc -p .",
"format:check": "prettier *.{ts,js,md,tsx,jsx} --check",
"clear:env": "rm -rf build coverage lighthouseReport.html tsconfig.tsbuildinfo",
"prepare": "husky install",
"storybook": "storybook dev -p 6006",
"build-storybook": "storybook build",
"deploy": "gh-pages -d build",
"_open": "cypress open",
"_headless": "cypress run --headless --browser chrome",
"_starting_app": "vite --host --port=5556",
"_build_start_app": "pnpm run build && pnpm run test:env:preview"
"_headless:tests": "cypress run --headless --browser chrome --spec \"cypress/e2e/(tests|bdd)/**\"",
"_headless:accessibility": "cypress run --headless --browser chrome --spec \"cypress/e2e/accessibility/**\"",
"_build:test:and:preview": "vite preview --host --port=5556",
"_starting_dev_app": "vite --host --port=5556",
"_build_start_app": "pnpm run build && pnpm run _build:test:and:preview"
},
"dependencies": {
"@headlessui/react": "^1.7.17",
Expand Down

0 comments on commit cd45e28

Please sign in to comment.