-
Notifications
You must be signed in to change notification settings - Fork 521
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 CA Sabina Kutniauske #260
Open
saibia8
wants to merge
47
commits into
NoroffFEU:master
Choose a base branch
from
saibia8:workflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
5cb365b
Created README.md file
saibia8 937abbf
Installed eslint
saibia8 eb1292b
Modifed README.md file
saibia8 a6085b9
Added lint scripts and .eslintcache to .gitignore
saibia8 e435b2a
1.0.1
saibia8 f1e6e13
Added module type to package.json
saibia8 a5d96e7
Installed prettier
saibia8 3c539ff
Inserting format script in package.json
saibia8 93ba176
Formated js files with prettier
saibia8 5c9557a
1.0.2
saibia8 e944ff0
Modified README.md file
saibia8 8ca071d
Added hooks
saibia8 f9f6d89
Adds husky.sh file
saibia8 3b0a972
Merge branch 'workflow-hooks' into workflow
saibia8 331c102
1.0.3
saibia8 be17d20
Modified README.md file
saibia8 7c1ef50
Installed jest
saibia8 9eabf3b
Added test and test-unit scripts for jest
saibia8 640c2c8
1.0.4
saibia8 573416d
Modified README.md file
saibia8 307a2e2
Configurated unit testing with jest
saibia8 0ee110e
Installed cypress
saibia8 c9a8102
1.0.5
saibia8 5f2a8ae
Updated README.md file
saibia8 630043b
Local storage mock class
saibia8 c961683
Updated localStorage.mock.js file
saibia8 7e4521f
Added rule no-undef off
saibia8 df88aaa
Test saves Token to localStorage
saibia8 a063c31
Testfetchs and saves Token to localStorage
saibia8 1fa81f1
Testremoves Token from localStorage
saibia8 fa1ad21
1.0.6
saibia8 284ff03
Modified README.md file
saibia8 3ef7017
Cypress login and access profile
saibia8 21cdae5
Creted logout and login with bad password tests
saibia8 cbd3f9f
Delete demo test
saibia8 7f49975
Create static.yml
saibia8 b99a432
Merge pull request #1 from saibia8/Action-create-page
saibia8 6d7e2be
1.0.7
saibia8 b75ab9c
Modified README.md file
saibia8 eeb28e2
Updated cypress.config.js
saibia8 efcca7f
Modified package.json scripts
saibia8 ab03837
Changed live server port
saibia8 31c8599
Add unit and e2e workflows
saibia8 c12805d
Merge pull request #2 from saibia8/workflow-automated-testing
saibia8 e1ce161
Modified README.md with badges
saibia8 3669336
Revert "Formated js files with prettier"
saibia8 f886ceb
Merge pull request #5 from saibia8/workflow-reverted-formating
saibia8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{ | ||
"env": { | ||
"browser": true, | ||
"es2021": true | ||
}, | ||
"extends": "eslint:recommended", | ||
"overrides": [ | ||
{ | ||
"files": ["**/*.cy.js"], | ||
"env": { "cypress/globals": true }, | ||
"plugins": ["cypress"], | ||
"extends": ["plugin:cypress/recommended"], | ||
"rules": { | ||
"cypress/no-unnecessary-waiting": "off", | ||
"no-unused-vars": "off" | ||
} | ||
}, | ||
{ | ||
"files": ["**/*.test.js"], | ||
"env": { "jest": true }, | ||
"plugins": ["jest"], | ||
"extends": ["plugin:jest/recommended"], | ||
"rules": { "jest/prefer-expect-assertions": "off" } | ||
} | ||
], | ||
"parserOptions": { | ||
"ecmaVersion": "latest", | ||
"sourceType": "module" | ||
}, | ||
"rules": { | ||
"no-unused-vars": "off", | ||
"no-undef": "off" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# Simple workflow for deploying static content to GitHub Pages | ||
name: Deploy static content to Pages | ||
|
||
on: | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["workflow"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | ||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
# Single deploy job since we're just deploying | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
- name: Install Dependencies | ||
run: npm i | ||
- name: Build SASS | ||
run: npm run build | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v3 | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v2 | ||
with: | ||
# Upload entire repository | ||
path: '.' | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/node_modules | ||
/dist | ||
/dist | ||
.eslintcache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/bin/sh | ||
if [ -z "$husky_skip_init" ]; then | ||
debug () { | ||
[ "$HUSKY_DEBUG" = "1" ] && echo "husky (debug) - $1" | ||
} | ||
|
||
readonly hook_name="$(basename "$0")" | ||
debug "starting $hook_name..." | ||
|
||
if [ "$HUSKY" = "0" ]; then | ||
debug "HUSKY env variable is set to 0, skipping hook" | ||
exit 0 | ||
fi | ||
|
||
if [ -f ~/.huskyrc ]; then | ||
debug "sourcing ~/.huskyrc" | ||
. ~/.huskyrc | ||
fi | ||
|
||
export readonly husky_skip_init=1 | ||
sh -e "$0" "$@" | ||
exitCode="$?" | ||
|
||
if [ $exitCode != 0 ]; then | ||
echo "husky - $hook_name hook exited with code $exitCode (error)" | ||
exit $exitCode | ||
fi | ||
|
||
exit 0 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/sh | ||
. "$(dirname "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
added 52 packages, and audited 371 packages in 6s | ||
|
||
53 packages are looking for funding | ||
run `npm fund` for details | ||
|
||
4 high severity vulnerabilities | ||
|
||
To address issues that do not require attention, run: | ||
npm audit fix | ||
|
||
To address all issues (including breaking changes), run: | ||
npm audit fix --force | ||
|
||
Run `npm audit` for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#Workflow CA | ||
|
||
[![Automated Unit Testing](https://github.com/saibia8/social-media-client-Sabina/actions/workflows/unit-test.yml/badge.svg?branch=Testing-PR)](https://github.com/saibia8/social-media-client-Sabina/actions/workflows/unit-test.yml) | ||
|
||
[![Automated E2E Testing](https://github.com/saibia8/social-media-client-Sabina/actions/workflows/e2e-test.yml/badge.svg?branch=Testing-PR)](https://github.com/saibia8/social-media-client-Sabina/actions/workflows/e2e-test.yml) | ||
|
||
Installed eslint and patched version v.1.0.1 | ||
Installed prettier, formated javascript files and patched version v1.0.2 | ||
Installed pre-commit eslint hook and patched version v1.0.3 | ||
Installed jest for unit-testing and patched version v1.0.4 | ||
Installed cypress for e2e-testing and patched version v1.0.5 | ||
Created test files login.test.js and logout.test.js and patched version v1.0.6 | ||
Created test file login.cy.js and action to static pages, patched version v1.0.7 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"presets": [["@babel/preset-env", { "targets": { "node": "current" } }]] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { defineConfig } from "cypress"; | ||
|
||
export default defineConfig({ | ||
e2e: { | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
video: false, | ||
screenshotOnRunFailure: false, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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: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: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 }); | ||
cy.get(".btn-outline-warning").click(); | ||
}); | ||
it("Try to login with bad password", () => { | ||
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("kukuku18", { force: true }); | ||
cy.get("#loginForm > .modal-footer > .btn-success").click({ force: true }); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "hello@cypress.io", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// *********************************************** | ||
// This example commands.js shows you how to | ||
// create various custom commands and overwrite | ||
// existing commands. | ||
// | ||
// For more comprehensive examples of custom | ||
// commands please read more here: | ||
// https://on.cypress.io/custom-commands | ||
// *********************************************** | ||
// | ||
// | ||
// -- This is a parent command -- | ||
// Cypress.Commands.add('login', (email, password) => { ... }) | ||
// | ||
// | ||
// -- This is a child command -- | ||
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This is a dual command -- | ||
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... }) | ||
// | ||
// | ||
// -- This will overwrite an existing command -- | ||
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import "./commands"; | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CodeRabbit
The changes made to the
README.md
file are generally good, providing clear information about the testing and linting tools added to the project. However, the term "patched version" is used repeatedly but it's not clear what it refers to. It would be more informative if each line that introduces a new tool or test also briefly describes its purpose or how it improves the project.