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

Releasing v0.2.4 #350

Draft
wants to merge 31 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
f0f90f0
🐛 (auth): Fixed origin redirects on Login
chef-danny-d Dec 27, 2021
8ba1349
fix(user): :bug: Worked on fixing update user DOB bug
chef-danny-d Jul 28, 2022
6fd2afc
refactor: :recycle: Refactored the user state update function
chef-danny-d Aug 11, 2022
4c25b32
Merge pull request #347 from odu-emse/ALMP-244
chef-danny-d Aug 11, 2022
1bbaa7b
fix: :construction: Created a dirty way to merge global ctx with loca…
chef-danny-d Aug 11, 2022
e1f721c
refactor: :construction: Created a validator function to check for fi…
chef-danny-d Aug 11, 2022
dbc1fdd
fix: :pencil2: Fixed context file name typo
chef-danny-d Aug 15, 2022
6c0bec7
refactor(context): :recycle: Instructor context now holds properies w…
chef-danny-d Aug 15, 2022
748be2a
fix(UI): :bug: Users can update their instructor profile from the UI
chef-danny-d Aug 15, 2022
0b0c747
fix(auth): :bug: Redirecting on login to original protected destination
chef-danny-d Aug 15, 2022
4058e09
Merge remote-tracking branch 'origin/ALMP-201' into ALMP-201
chef-danny-d Aug 15, 2022
b17ead6
🚧 (program): Removed ratings from UI
chef-danny-d Dec 21, 2021
303606b
fix: :recycle: Fixed minor React key warning
chef-danny-d Aug 15, 2022
44f64fa
Merge pull request #348 from odu-emse/ALMP-239
chef-danny-d Aug 15, 2022
e74e134
Merge pull request #349 from odu-emse/ALMP-224
chef-danny-d Aug 15, 2022
d20e5db
Merge pull request #330 from odu-emse/ALMP-201
chef-danny-d Aug 15, 2022
418e183
Merge pull request #328 from odu-emse/ALMP-203
chef-danny-d Aug 15, 2022
c1bb219
fix(auth): :ambulance: Fixed register routing blocker
chef-danny-d Aug 16, 2022
3f9ea3c
ci: :green_heart: Fixed Github Action yarn command to run tests
chef-danny-d Aug 16, 2022
cd496b8
ci: :arrow_up: Upgraded Cypress to v10
chef-danny-d Aug 16, 2022
188968f
Merge pull request #351 from odu-emse/ALMP-249
chef-danny-d Aug 16, 2022
73a6926
Merge pull request #352 from odu-emse/ALMP-250
chef-danny-d Aug 16, 2022
78bffe8
ci: :green_heart: Updated config for GitHub Action
chef-danny-d Aug 16, 2022
ae596f0
test: :white_check_mark: Added default values for login command
chef-danny-d Aug 16, 2022
339c7d8
added modal for profile update
Aug 17, 2022
7043983
test: :white_check_mark: Updated a11y and userbase test cases
chef-danny-d Aug 23, 2022
89aa74a
style(UI): :lipstick: Modified the confirm password modal to have pro…
chef-danny-d Aug 24, 2022
f6fcc12
Merge pull request #353 from odu-emse/ALMP-248
chef-danny-d Aug 24, 2022
7c7a0b2
Merge pull request #354 from odu-emse/ALMP-252
chef-danny-d Aug 24, 2022
0f47c0c
fix(auth): :bug: Added expiration check for JWT tokens in local storage
chef-danny-d Aug 24, 2022
cd54017
Merge pull request #355 from odu-emse/ALMP-254
chef-danny-d Aug 24, 2022
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
1 change: 1 addition & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ rules:
react/jsx-key: warn,
no-duplicate-imports: warn,
no-mixed-spaces-and-tabs: warn,
cypress/no-unnecessary-waiting: off,
}
65 changes: 32 additions & 33 deletions .github/workflows/github-actions-demo.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,35 @@
name: E2E Test for EMSE Portal
on: [push]
jobs:
cypress-run:
runs-on: ubuntu-20.04
strategy:
matrix:
node: [ 16, 18 ]
browser: [ chrome, firefox ]
containers: [1, 2, 3]
name: E2E on ${{ matrix.browser }} on Node ${{ matrix.node }}
continue-on-error: true
steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v2
- name: Install dependencies
run: yarn
- name: Running tests
uses: cypress-io/github-action@v2
with:
start: yarn local
wait-on: 'http://localhost:3000'
browser: ${{ matrix.browser }}
record: true
tag: node-${{ matrix.node }}
command-prefix: "--"
parallel: true
group: 'E2E'
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.TOKEN }}
cypress-run:
runs-on: ubuntu-20.04
strategy:
matrix:
node: [16, 18]
browser: [chrome, firefox]
name: E2E on ${{ matrix.browser }} on Node ${{ matrix.node }}
continue-on-error: true
steps:
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v2
- name: Install dependencies
run: yarn
- name: Running tests
uses: cypress-io/github-action@v4
with:
config-file: cypress.config.js
start: yarn dev
wait-on: 'http://localhost:3000'
browser: ${{ matrix.browser }}
record: true
tag: node-${{ matrix.node }}
command-prefix: '--'
group: 'E2E'
env:
# pass the Dashboard record key as an environment variable
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Recommended: pass the GitHub token lets this action correctly
# determine the unique run id necessary to re-run the checks
GITHUB_TOKEN: ${{ secrets.TOKEN }}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM node:18 as base
WORKDIR /usr/src/app

#copy folder director to docker container
COPY package.json .env postcss.config.js tailwind.config.js webpack.config.js config-overrides.js cypress.json .eslintrc.yml ./
COPY package.json .env postcss.config.js tailwind.config.js webpack.config.js config-overrides.js cypress.config.js .eslintrc.yml ./

COPY ./public ./public

Expand Down
30 changes: 30 additions & 0 deletions cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { defineConfig } = require('cypress')

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on, config) {
on('task', {
log(message) {
console.log(message)

return null
},
table(message) {
console.table(message)

return null
},
})
},
},

projectId: '5szk9g',

component: {
devServer: {
framework: 'create-react-app',
bundler: 'webpack',
},
},
})
8 changes: 0 additions & 8 deletions cypress.json

This file was deleted.

5 changes: 5 additions & 0 deletions cypress/component/Navbar.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('Navbar.cy.js', () => {
it('playground', () => {
// cy.mount()
})
})
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('Load Dashboard screen', () => {
beforeEach(() => {
cy.visit('/dashboard')
cy.login('[email protected]', 'testing@12345')
cy.visit('/users/login')
cy.login()
})

it('should display the dashboard screen and the tiles', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('Load Program screen', () => {
beforeEach(() => {
cy.visit('/portal')
cy.login('[email protected]', 'testing@12345')
cy.visit('/users/login')
cy.login()
})

it('should load the page after login', () => {
Expand Down
26 changes: 5 additions & 21 deletions cypress/integration/ui/a11y.spec.js → cypress/e2e/ui/a11y.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import jwt from 'jsonwebtoken'

const terminalLog = (violations) => {
cy.task(
'log',
Expand All @@ -20,37 +18,23 @@ const terminalLog = (violations) => {
cy.task('table', violationData)
}

let token = localStorage.getItem('JWT')

const routes = [
'dashboard',
'portal',
'program',
'program/61560592009b2b64008696c5',
'assignments',
'users/621faf87751282e60aa06d11',
]

jwt.verify(token, 'JWT', (err, decoded) => {
if (err) {
console.log(err)
} else {
console.warn(decoded)
routes.push(`user/${decoded.id}`)
}
})

describe('Component accessibility test', () => {
describe('Accessibility testing pages', () => {
routes.forEach((route) => {
const componentName = route.replace('.html', '')
const testName = `${componentName} has no detectable accessibility violations on load`
const testName = `${route} has no detectable accessibility violations`

it(testName, () => {
cy.visit('/users/login')
cy.login('[email protected]', 'testing@12345')
cy.log('Logged in')
cy.wait(5000)
cy.loginViaAPI()
cy.visit(route)
cy.wait(5000)
cy.wait(1500)
cy.injectAxe()

cy.get('body').each((element, index) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
describe('navbar renders differently if user is logged in', () => {
it('navbar when logging in', () => {
cy.visit('/users/login')
cy.login('[email protected]', 'testing@12345')
cy.login()
cy.wait(2000)
cy.visit('/dashboard')
cy.get('aside').should('be.visible')
Expand All @@ -10,7 +10,7 @@ describe('navbar renders differently if user is logged in', () => {

it('navbar when logging out', () => {
cy.visit('/users/login')
cy.login('[email protected]', 'testing@12345')
cy.login()
cy.wait(2000)
cy.visit('/dashboard')
cy.get('aside').should('be.visible')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@

describe('Load Program screen', () => {
beforeEach(() => {
cy.visit('/users/login')
cy.login()
cy.visit('/program')
cy.login('[email protected]', 'testing@12345')
})

it('should display the program card', () => {})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import { decode, verify } from 'jsonwebtoken'
import moment from 'moment'

describe('Load Login screen', () => {
beforeEach(() => {
cy.visit('/users/login')
Expand Down Expand Up @@ -34,8 +37,18 @@ describe('Tests Login form', () => {
beforeEach(() => {
cy.visit('/users/login')
})
// we expect this case to fail since we haven't fixed ALMP-199
// TODO: Fix ALMP-199 and re-test this case

it('should redirect user if token in cookie is valid', () => {
cy.loginViaAPI(credentials.correctEmail, credentials.correctPassword)
cy.getCookie('JWT')
.should('exist')
.then((cookie) => {
const rawValue = decode(cookie.value)
expect(moment(rawValue.exp).isAfter(new Date())).to.be.true
expect(moment(rawValue.iat).isBefore(new Date())).to.be.true
})
})

it('should not display an error with email address in it', () => {
cy.login(credentials.incorrectEmail, credentials.incorrectPassword)
cy.get('div.Toastify__toast-body').should(
Expand All @@ -44,6 +57,16 @@ describe('Tests Login form', () => {
)
})

it('should display an error if email is incorrect', () => {
cy.login(credentials.incorrectEmail, credentials.correctPassword)
cy.get('div.Toastify__toast-body').should('exist')
})

it('should display an error if password is incorrect', () => {
cy.login(credentials.correctEmail, credentials.incorrectPassword)
cy.get('div.Toastify__toast-body').should('exist')
})

it('should not display an error if correct credentials are provided', () => {
cy.login(credentials.correctEmail, credentials.correctPassword)
cy.url().should('include', '/dashboard')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ describe('Load Register screen', () => {
it('should display the register form fields labels', () => {
cy.get('form label').should('exist')
})
})

describe('Registration form interaction', () => {
beforeEach(() => {
cy.visit('/users/register')
})
it('should display an error if you try to submit but fields are empty', () => {
cy.get('button[type=submit]').click()
cy.get('input:invalid').should('have.length.gt', 1)
Expand All @@ -44,7 +49,7 @@ describe('Load Register screen', () => {
cy.get('div.Toastify__toast-body').should('exist')
})

it('should not display an error if middle name is not entered', () => {
it('should allow empty middle name field', () => {
cy.register({
email: '[email protected]',
password: 'testing12345',
Expand All @@ -53,7 +58,7 @@ describe('Load Register screen', () => {
cy.get('div.Toastify__toast-body').should('not.exist')
})

it('login link should lead to login page', () => {
it('should lead users to login page on hyperlink click', () => {
cy.get('span')
.contains('Log in')
.parent()
Expand All @@ -66,15 +71,57 @@ describe('Load Register screen', () => {
cy.get('button[type=reset]').should('have.attr', 'disabled')
})

it('should lead to next form if not student', () => {
cy.register({ group: 'admin' })
it('should lead to personal information page if next button is clicked and user is not a student', () => {
cy.register({
email: '[email protected]',
password: 'testing@12345',
group: 'admin',
})
cy.then(() => {
cy.get('h1').should('contain', 'Personal information')
})
})

it('should match confirmation page information with the credentials entered', () => {
const credentials = {
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
password: 'testing@12345',
group: 'student',
}
cy.register(credentials)
cy.get('div.my-1 > span.font-bold').each(($el, index) => {
switch (index) {
case 0:
cy.wrap($el).should('contain', credentials.firstName)
break
case 1:
credentials.middleName
? cy.wrap($el).should('contain', credentials.middleName)
: cy.wrap($el).should('be.empty')
break
case 2:
cy.wrap($el).should('contain', credentials.lastName)
break
case 3:
cy.wrap($el).should('contain', credentials.email)
break
case 4:
cy.wrap($el).should('contain', credentials.group)
break
default:
break
}
})
})

it('should let students go backward from confirmation page', () => {
cy.register({ group: 'student' }).then(() => {
cy.register({
email: '[email protected]',
password: 'testing@12345',
group: 'student',
}).then(() => {
cy.get('h1')
.should('contain', 'Confirm account details')
.then(() => {
Expand All @@ -90,7 +137,6 @@ describe('Load Register screen', () => {
})
})

//TODO: We expect this to fail since this is an active bug ALMP-205
it('should display an error if email you are trying to register with not a valid email', () => {
cy.register({
email: 'dpapp001',
Expand All @@ -100,10 +146,3 @@ describe('Load Register screen', () => {
cy.get('input:invalid').should('have.length', 1)
})
})

//TODO: Break these cases up into separate test clusters
// describe('Test Register form', () => {
// beforeEach(() => {
// cy.visit('/users/register')
// })
// })
Empty file removed cypress/integration/e2e/.gitkeep
Empty file.
Loading