Skip to content

Commit

Permalink
Merge pull request #2 from saibia8/workflow-automated-testing
Browse files Browse the repository at this point in the history
Workflow automated testing
  • Loading branch information
saibia8 authored Aug 20, 2023
2 parents eeb28e2 + 31c8599 commit c12805d
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 5 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Automated E2E Testing
on:
pull_request:
workflow_dispatch:

jobs:
run-e2e-tests:
name: Run E2E Tests
runs-on: ubuntu-latest
steps:
- name: Checkout under $GITHUB_WORKSPACE
uses: actions/checkout@main

- name: Cypress run
uses: cypress-io/github-action@v5
with:
start: npm run dev
24 changes: 24 additions & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Automated Unit Testing
on:
pull_request:
workflow_dispatch:

jobs:
run-unit-tests:
name: Run Unit Tests
runs-on: ubuntu-latest

steps:
- name: Checkout under $GITHUB_WORKSPACE
uses: actions/checkout@main

- name: Set up NodeJS
uses: actions/setup-node@v1
with:
node-version: 16

- name: Install all dependencies
run: npm install

- name: Run Tests
run: npm run test-unit
6 changes: 3 additions & 3 deletions cypress/e2e/User-login-and-access-profile/login.cy.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
describe("Social media client: login and access profile, logout, try to login with invalid password", () => {
it("Login to profile account", () => {
cy.visit("http://127.0.0.1:5500/index.html");
cy.visit("http://127.0.0.1:8080/index.html");
cy.get("#registerForm > .modal-header > .btn-close").click();
cy.get(".text-end > .btn-outline-success").click({ force: true });
cy.get("#loginEmail").type("sabKut73328@stud.noroff.no", { force: true });
cy.get("#loginPassword").type("kukuku16", { force: true });
cy.get("#loginForm > .modal-footer > .btn-success").click({ force: true });
});
it("Logout from profile account", () => {
cy.visit("http://127.0.0.1:5500/index.html");
cy.visit("http://127.0.0.1:8080/index.html");
cy.get("#registerForm > .modal-header > .btn-close").click();
cy.get(".text-end > .btn-outline-success").click({ force: true });
cy.get("#loginEmail").type("sabKut73328@stud.noroff.no", { force: true });
Expand All @@ -17,7 +17,7 @@ describe("Social media client: login and access profile, logout, try to login wi
cy.get(".btn-outline-warning").click();
});
it("Try to login with bad password", () => {
cy.visit("http://127.0.0.1:5500/index.html");
cy.visit("http://127.0.0.1:8080/index.html");
cy.get("#registerForm > .modal-header > .btn-close").click();
cy.get(".text-end > .btn-outline-success").click({ force: true });
cy.get("#loginEmail").type("sabKut73328@stud.noroff.no", { force: true });
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "module",
"main": "index.js",
"scripts": {
"test": "npm run test-unit",
"test": "npm run test-unit && npm run test-e2e-cli",
"test-unit": "jest",
"test-e2e": "cypress open",
"test-e2e-report": "cypress run --reporter mochawesome",
Expand All @@ -15,7 +15,8 @@
"lint-fix": "eslint src/js/**/*.js --cache --fix",
"build": "sass src/scss:dist/css",
"start": "sass --watch src/scss:dist/css & live-server",
"prepare": "husky install"
"prepare": "husky install",
"dev": "live-server"
},
"keywords": [],
"author": "Noroff",
Expand Down

0 comments on commit c12805d

Please sign in to comment.