add notifications test

This commit is contained in:
Nolan Lawson 2018-02-18 16:57:38 -08:00
parent babd3c7b84
commit 982d172e36
4 changed files with 19 additions and 1 deletions

View File

@ -28,6 +28,12 @@ describe('Basic timeline spec', () => {
localTimeline.splice(0, 3) localTimeline.splice(0, 3)
localTimeline.splice(9, 2) localTimeline.splice(9, 2)
const notifications = [
{followedBy: 'quux'},
{content: 'hello foobar'},
{followedBy: 'admin'}
]
it('Shows the home timeline', () => { it('Shows the home timeline', () => {
cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-setsize') cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-setsize')
cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-posinset', '0') cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-posinset', '0')
@ -37,6 +43,14 @@ describe('Basic timeline spec', () => {
cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-setsize', (30 + 15).toString()) cy.get('.virtual-list-item[aria-hidden=false] .status-article:first').should('have.attr', 'aria-setsize', (30 + 15).toString())
}) })
it('Shows notifications', () => {
cy.get('nav a').contains('Notifications').click()
cy.url().should('contain', '/notifications')
cy.validateTimeline(notifications)
})
it('Shows the local timeline', () => { it('Shows the local timeline', () => {
cy.get('nav a').contains('Local').click() cy.get('nav a').contains('Local').click()
cy.url().should('contain', '/local') cy.url().should('contain', '/local')

View File

@ -48,7 +48,7 @@ Cypress.Commands.add('login', (email, password) => {
}) })
Cypress.Commands.add('getNthVirtualArticle', (n) => { Cypress.Commands.add('getNthVirtualArticle', (n) => {
return cy.get(`.virtual-list-item[aria-hidden=false] .status-article[aria-posinset=${n}]`) return cy.get(`.virtual-list-item[aria-hidden=false] article[aria-posinset=${n}]`)
}) })
Cypress.Commands.add('validateTimeline', (timeline) => { Cypress.Commands.add('validateTimeline', (timeline) => {
@ -59,6 +59,10 @@ Cypress.Commands.add('validateTimeline', (timeline) => {
if (status.spoiler) { if (status.spoiler) {
cy.getNthVirtualArticle(i).get('.status-spoiler p').should('contain', status.spoiler) cy.getNthVirtualArticle(i).get('.status-spoiler p').should('contain', status.spoiler)
} }
if (status.followedBy) {
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', status.followedBy)
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'followed you')
}
cy.getNthVirtualArticle(i).scrollIntoView() cy.getNthVirtualArticle(i).scrollIntoView()
}) })
}) })

Binary file not shown.

Binary file not shown.