Skip to content
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
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
node_modules
functions
build
cypress
lib
storybook-static
dist
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,10 @@
"env-cmd": "^10.1.0",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-cypress": "^2.12.1",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jest": "^27.2.1",
"eslint-plugin-mocha": "^10.1.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-sort-class-members": "^1.15.2",
"eslint-plugin-unicorn": "^36.0.0",
Expand Down
12 changes: 12 additions & 0 deletions packages/cypress/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"plugins": ["cypress", "mocha"],
"rules": {
"cypress/no-assigning-return-values": "error",
"cypress/no-unnecessary-waiting": "warn",
"cypress/assertion-before-screenshot": "warn",
"cypress/no-force": "warn",
"cypress/no-async-tests": "warn",
"cypress/no-pause": "warn",
"mocha/no-skipped-tests": "error"
}
}
25 changes: 23 additions & 2 deletions packages/cypress/src/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,29 @@
* ```
* or
* ```
* import * as MOCK_DATA from '../data
* import { MOCK_DATA } from '../data
* ```
*
**/
export * from 'oa-shared/mocks/data'

import {
categories,
events,
howtos,
mappins,
research,
tags,
users,
} from 'oa-shared/mocks/data'

export { howtos, users } from 'oa-shared/mocks/data'

export const MOCK_DATA = {
categories,
events,
howtos,
mappins,
research,
tags,
users,
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ describe('[Sign-in - authenticated user]', () => {
it('redirects to home page', () => {
cy.visit('/sign-in')
cy.login('howto_reader@test.com', 'test1234')
cy.wait(3000)
cy.visit('/sign-in').url().should('include', '/')
})
})
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generatedId } from '../utils/test-utils'
import { generatedId } from '../utils/TestUtils'
import { FRIENDLY_MESSAGES } from 'oa-shared'

// existing user already created in auth system
Expand Down Expand Up @@ -69,7 +69,6 @@ describe('[Sign-up - new user]', () => {
describe('[Sign-up - authenticated user]', () => {
it('redirects to home page', () => {
cy.login('howto_reader@test.com', 'test1234')
cy.wait(3000)
cy.visit('/sign-up').url().should('include', '/')
})
})
2 changes: 1 addition & 1 deletion packages/cypress/src/integration/academy.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Page } from '../utils/test-utils'
import { Page } from '../utils/TestUtils'

describe('[Academy]', () => {
describe('[List instructions]', () => {
Expand Down
100 changes: 0 additions & 100 deletions packages/cypress/src/integration/bugs.spec.ts

This file was deleted.

3 changes: 0 additions & 3 deletions packages/cypress/src/integration/events.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,6 @@ describe('[Events]', () => {
describe('[Create an event]', () => {
it('[By Authenticated]', () => {
cy.login('event_creator@test.com', 'test1234')
// as click event changes depending on logged in state wait to ensure button updated
// TODO - better to bind attribute to button depending on logged in state to search for
cy.wait(2000)
cy.get('[data-cy=create-event]').click()

cy.step('Fill up mandatory info')
Expand Down
7 changes: 5 additions & 2 deletions packages/cypress/src/integration/howto/read.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('[How To]', () => {
})
})

describe.only('[Filter by Category]', () => {
describe('[Filter by Category]', () => {
beforeEach(() => {
cy.visit('/how-to')
})
Expand Down Expand Up @@ -220,7 +220,10 @@ describe('[How To]', () => {
cy.location('pathname').should('eq', '/how-to')
cy.location('search').should(
'eq',
`?search=this+how+to+does+not+exist+${id}&source=how-to-not-found`,
`?search=this%20how%20to%20does%20not%20exist%20${id.replaceAll(
'-',
'%20',
)}&source=how-to-not-found`,
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/cypress/src/integration/howto/write.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('[How To]', () => {
cy.get('[data-cy=confirm]').click()
}

describe.only('[Create a how-to]', () => {
describe('[Create a how-to]', () => {
const expected = {
_createdBy: 'howto_creator',
_deleted: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/cypress/src/integration/map.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ context('map', () => {
})
})

describe.only('[By User]', () => {
describe('[By User]', () => {
it('should show the user a message stating their pin is rejected', () => {
cy.login(
mapview_testing_rejected.email,
Expand Down
21 changes: 8 additions & 13 deletions packages/cypress/src/integration/notifications.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('[Notifications]', () => {
(docs) => {
expect(docs.length).to.be.greaterThan(0)
const user = docs[1]
let notifications = user['notifications']
const notifications = user['notifications']
expect(notifications.length).to.equal(1)
expect(notifications[0]['type']).to.equal('howto_useful')
expect(notifications[0]['relevantUrl']).to.equal(
Expand All @@ -56,7 +56,7 @@ describe('[Notifications]', () => {
(docs) => {
expect(docs.length).to.be.greaterThan(0)
const user = docs[1]
let notifications = user['notifications']
const notifications = user['notifications']
expect(notifications.length).to.equal(1)
expect(notifications[0]['type']).to.equal('research_useful')
expect(notifications[0]['relevantUrl']).to.equal('/research/qwerty')
Expand All @@ -80,7 +80,7 @@ describe('[Notifications]', () => {
(docs) => {
expect(docs.length).to.be.greaterThan(0)
const user = docs[1]
let notifications = user['notifications']
const notifications = user['notifications']
expect(notifications.length).to.equal(1)
expect(notifications[0]['type']).to.equal('new_comment')
expect(notifications[0]['relevantUrl']).to.equal(
Expand All @@ -107,7 +107,7 @@ describe('[Notifications]', () => {
(docs) => {
expect(docs.length).to.be.greaterThan(0)
const user = docs[1]
let notifications = user['notifications']
const notifications = user['notifications']
expect(notifications.length).to.equal(1)
expect(notifications[0]['type']).to.equal('new_comment_research')
expect(notifications[0]['relevantUrl']).to.equal(
Expand All @@ -128,8 +128,7 @@ describe('[Notifications]', () => {
cy.get(
'[data-cy="notifications-desktop"] [data-cy="toggle-notifications-modal"]',
).click()
const notifications = cy.get('[data-cy="notification"]')
expect(notifications).to.exist
expect(cy.get('[data-cy="notification"]')).to.exist
})

it('[notifications modal is closed when clicking on the notifications icon for the second time or clicking on the header]', () => {
Expand All @@ -139,21 +138,18 @@ describe('[Notifications]', () => {
cy.get(
'[data-cy="notifications-desktop"] [data-cy="toggle-notifications-modal"]',
).click()
let notificationsModal = cy.get('[data-cy="notifications-modal-desktop"]')
expect(notificationsModal).to.exist
expect(cy.get('[data-cy="notifications-modal-desktop"]')).to.exist
//click on the notifications button again
cy.get(
'[data-cy="notifications-desktop"] [data-cy="toggle-notifications-modal"]',
).click()
notificationsModal = cy.get('[data-cy="notifications-modal-desktop"]')
notificationsModal.should('not.exist')
cy.get('[data-cy="notifications-modal-desktop"]').should('not.exist')
//click within the header area
cy.get(
'[data-cy="notifications-desktop"] [data-cy="toggle-notifications-modal"]',
).click()
cy.get('[data-cy="header"]').click()
notificationsModal = cy.get('[data-cy="notifications-modal-desktop"]')
notificationsModal.should('not.exist')
cy.get('[data-cy="notifications-modal-desktop"]').should('not.exist')
})

it('[are marked read when clicking on clear button]', () => {
Expand All @@ -177,7 +173,6 @@ describe('[Notifications]', () => {
})
},
)
const noNotificationsText = 'Nada, no new notifications'
cy.get('[data-cy="NotificationList: empty state"]').should('exist')
})
})
Loading