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

Workflow automated testing #2

Merged
merged 3 commits into from
Aug 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
Loading