Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Introduce Loading Skeletons, GitHub Workflow & Cypress Tests #3

Merged
merged 24 commits into from
Feb 16, 2024
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
adjust workflow
muriukialex committed Feb 16, 2024
commit 7595ccd5ea588a967e0ca734f2f4aa3dfdcf9168
18 changes: 9 additions & 9 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
@@ -36,15 +36,15 @@ jobs:
run: |
rm -rf node_modules
rm package-lock.json
- name: Install Dependencies
run: npm install
- name: Cypress e2e tests 🧪
uses: cypress-io/github-action@v6.4.0
with:
start: npm run dev
wait-on: "http://localhost:3000"
browser: electron
config-file: cypress.config.ts
# - name: Install Dependencies
# run: npm install
# - name: Cypress e2e tests 🧪
# uses: cypress-io/github-action@v6.4.0
# with:
# start: npm run dev
# wait-on: "http://localhost:3000"
# browser: electron
# config-file: cypress.config.ts

Deploy-Preview:
runs-on: ubuntu-latest
20 changes: 9 additions & 11 deletions .github/workflows/production.yaml
Original file line number Diff line number Diff line change
@@ -36,17 +36,15 @@ jobs:
run: |
rm -rf node_modules
rm package-lock.json
- name: Install Dependencies
run: npm install
- name: Start app
run: npm run dev
- name: Cypress e2e tests 🧪
uses: cypress-io/github-action@v6.4.0
with:
start: npm run dev
wait-on: "http://localhost:3000"
browser: electron
config-file: cypress.config.ts
# - name: Install Dependencies
# run: npm install
# - name: Cypress e2e tests 🧪
# uses: cypress-io/github-action@v6.4.0
# with:
# start: npm run dev
# wait-on: "http://localhost:3000"
# browser: electron
# config-file: cypress.config.ts

Deploy-Production:
runs-on: ubuntu-latest
16 changes: 1 addition & 15 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,11 @@
import { defineConfig } from "cypress"
import jsonServer from "json-server"

export default defineConfig({
e2e: {
baseUrl: "http://localhost:3000",
chromeWebSecurity: false,
setupNodeEvents(on, config) {
on("before:run", () => {
const server = jsonServer.create()
const router = jsonServer.router(
"cypress/fixtures/empty-user-labs.json",
)
const middlewares = jsonServer.defaults()

server.use(middlewares)
server.use(router)

server.listen(3000, () => {
console.log("JSON Server is running")
})
})
// implement node event listeners here
},
},
})
6 changes: 3 additions & 3 deletions cypress/e2e/labs/labs.cy.js
Original file line number Diff line number Diff line change
@@ -8,16 +8,16 @@ describe("User Labs", () => {
cy.stubLogin()
})

it.only("can successfully track user's lab", () => {
it("can successfully track user's lab", () => {
cy.intercept("GET", "/api/labs?**", { fixture: "empty-user-labs" })
cy.intercept("POST", "/api/labs", {
statusCode: 201,
body: { message: "Lab tracked successfully" },
})

cy.get('[data-test="lab-checkbox-1"]').should("exist")
// cy.get('[data-test="lab-checkbox-1"]').first().check()
// cy.contains("Lab tracked successfully").should("exist")
cy.get('[data-test="lab-checkbox-1"]').first().check()
cy.contains("Lab tracked successfully").should("exist")
})

it("can show error message if lab tracking is unsuccessful", () => {
4 changes: 1 addition & 3 deletions cypress/e2e/sign-in/sign-in.cy.js
Original file line number Diff line number Diff line change
@@ -5,12 +5,10 @@ describe("Sign In", () => {
cy.visit("/")
})

it.only("can successfully sign in user via Google", () => {
it("can successfully sign in user via Google", () => {
cy.stubLogin()
cy.intercept("GET", "/api/labs?**", { fixture: "empty-user-labs" })
cy.get("[data-test=aws-rstart-title]").should("be.visible")

cy.get('[data-test="lab-checkbox-1"]').should("exist")
})

it("should handle failed Google sign-in", () => {
641 changes: 0 additions & 641 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -26,7 +26,6 @@
"@bahmutov/cy-api": "^2.2.6",
"@faker-js/faker": "^8.4.1",
"@testing-library/cypress": "^10.0.1",
"@types/json-server": "^0.14.7",
"@types/node": "^20",
"@types/react": "^18",
"@types/react-dom": "^18",
@@ -37,7 +36,6 @@
"cypress-v10-preserve-cookie": "^1.2.1",
"eslint": "^8",
"eslint-config-next": "14.1.0",
"json-server": "^1.0.0-alpha.23",
"postcss": "^8",
"prettier": "^3.0.3",
"prettier-plugin-organize-imports": "^3.2.4",