Skip to content

Commit

Permalink
adjust workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
muriukialex committed Feb 16, 2024
1 parent 28974cb commit 7595ccd
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 684 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/preview.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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/[email protected]
# with:
# start: npm run dev
# wait-on: "http://localhost:3000"
# browser: electron
# config-file: cypress.config.ts

Deploy-Preview:
runs-on: ubuntu-latest
Expand Down
20 changes: 9 additions & 11 deletions .github/workflows/production.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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/[email protected]
# with:
# start: npm run dev
# wait-on: "http://localhost:3000"
# browser: electron
# config-file: cypress.config.ts

Deploy-Production:
runs-on: ubuntu-latest
Expand Down
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
Expand Up @@ -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", () => {
Expand Down
4 changes: 1 addition & 3 deletions cypress/e2e/sign-in/sign-in.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
Loading

0 comments on commit 7595ccd

Please sign in to comment.