Skip to content

Commit

Permalink
updates ci workflow for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwin-pc committed Aug 18, 2022
1 parent 0fb4c34 commit ab29cfd
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 22 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/e2e.yml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Tests

on:
pull_request:
branches: [master]

jobs:
unit:
name: Unit tests
runs-on: ubuntu-latest

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

- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14.x

- name: Install dependencies
run: npm install

- name: Run tests
run: CI=true npm test

e2e:
name: End to End
runs-on: ubuntu-latest

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

- name: Cypress run
uses: cypress-io/github-action@v4
with:
browser: chrome
build: npm run build
start: npx serve -s build -l 3000
wait-on: 'http://localhost:3000'
9 changes: 9 additions & 0 deletions src/__test__/__snapshots__/App.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exports[`Test hiccup should render page correctly 1`] = `
>
<div
class="search-container"
data-testid="search-bar"
>
<input
autocomplete="off"
Expand All @@ -30,6 +31,7 @@ exports[`Test hiccup should render page correctly 1`] = `
</div>
<div
class="section featured"
data-testid="featured-section"
>
<a
class="link"
Expand All @@ -39,6 +41,7 @@ exports[`Test hiccup should render page correctly 1`] = `
>
<li
class="card container "
data-testid="featured-card"
style="background-image: url(./assets/logo.png);"
>
Featured Link
Expand All @@ -52,6 +55,7 @@ exports[`Test hiccup should render page correctly 1`] = `
>
<li
class="card container "
data-testid="featured-card"
style="background-image: url(./assets/card.png);"
>
Another Feaured link
Expand All @@ -60,6 +64,7 @@ exports[`Test hiccup should render page correctly 1`] = `
</div>
<div
class="section categories"
data-testid="category-section"
>
<div
class="category"
Expand All @@ -78,6 +83,7 @@ exports[`Test hiccup should render page correctly 1`] = `
>
<li
class="card container "
data-testid="category-card"
>
<span
class="name"
Expand All @@ -99,6 +105,7 @@ exports[`Test hiccup should render page correctly 1`] = `
>
<li
class="card container "
data-testid="category-card"
>
<span
class="name"
Expand Down Expand Up @@ -131,6 +138,7 @@ exports[`Test hiccup should render page correctly 1`] = `
>
<li
class="card container "
data-testid="category-card"
>
<span
class="name"
Expand All @@ -152,6 +160,7 @@ exports[`Test hiccup should render page correctly 1`] = `
>
<li
class="card container "
data-testid="category-card"
>
<span
class="name"
Expand Down

0 comments on commit ab29cfd

Please sign in to comment.