improve timelines test
This commit is contained in:
parent
8a1cc02c75
commit
c133c25c67
|
@ -8,6 +8,10 @@ describe('Basic timeline spec', () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
const homeTimeline = [
|
const homeTimeline = [
|
||||||
|
{content: 'pinned toot 1'},
|
||||||
|
{content: 'notification of unlisted message'},
|
||||||
|
{content: 'notification of followers-only message'},
|
||||||
|
{content: 'notification of direct message'},
|
||||||
{content: 'this is unlisted'},
|
{content: 'this is unlisted'},
|
||||||
{content: 'this is followers-only'},
|
{content: 'this is followers-only'},
|
||||||
{content: 'direct'},
|
{content: 'direct'},
|
||||||
|
@ -25,23 +29,48 @@ describe('Basic timeline spec', () => {
|
||||||
{content: 'hello world'}
|
{content: 'hello world'}
|
||||||
].concat(times(30, i => ({content: (30 - i).toString()})))
|
].concat(times(30, i => ({content: (30 - i).toString()})))
|
||||||
|
|
||||||
const localTimeline = homeTimeline.slice()
|
const localTimeline = [
|
||||||
localTimeline.splice(0, 3)
|
{spoiler: 'kitten CW'},
|
||||||
localTimeline.splice(9, 2)
|
{content: 'secret video'},
|
||||||
|
{content: "here's a video"},
|
||||||
|
{spoiler: 'CW'},
|
||||||
|
{content: "here's a secret animated kitten gif"},
|
||||||
|
{content: "here's an animated kitten gif"},
|
||||||
|
{content: "here's 2 kitten photos"},
|
||||||
|
{content: "here's a secret kitten"},
|
||||||
|
{content: "here's a kitten"},
|
||||||
|
{content: 'hello world'}
|
||||||
|
].concat(times(30, i => ({content: (30 - i).toString()})))
|
||||||
|
|
||||||
const notifications = [
|
const notifications = [
|
||||||
|
{favoritedBy: 'admin'},
|
||||||
|
{rebloggedBy: 'admin'},
|
||||||
|
{content: 'notification of unlisted message'},
|
||||||
|
{content: 'notification of followers-only message'},
|
||||||
|
{content: 'notification of direct message'},
|
||||||
{followedBy: 'quux'},
|
{followedBy: 'quux'},
|
||||||
{content: 'hello foobar'},
|
{content: 'hello foobar'},
|
||||||
{followedBy: 'admin'}
|
{followedBy: 'admin'}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
const favorites = [
|
||||||
|
{content: 'notification of direct message'},
|
||||||
|
{content: 'notification of followers-only message'},
|
||||||
|
{content: 'notification of unlisted message'},
|
||||||
|
{content: 'pinned toot 1'}
|
||||||
|
]
|
||||||
|
|
||||||
|
const pinnedStatuses = [
|
||||||
|
{content: 'this is unlisted'}
|
||||||
|
]
|
||||||
|
|
||||||
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')
|
||||||
|
|
||||||
cy.validateTimeline(homeTimeline)
|
cy.validateTimeline(homeTimeline)
|
||||||
|
|
||||||
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', '49')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Shows notifications', () => {
|
it('Shows notifications', () => {
|
||||||
|
@ -49,7 +78,6 @@ describe('Basic timeline spec', () => {
|
||||||
cy.url().should('contain', '/notifications')
|
cy.url().should('contain', '/notifications')
|
||||||
|
|
||||||
cy.validateTimeline(notifications)
|
cy.validateTimeline(notifications)
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Shows the local timeline', () => {
|
it('Shows the local timeline', () => {
|
||||||
|
@ -67,4 +95,13 @@ describe('Basic timeline spec', () => {
|
||||||
|
|
||||||
cy.validateTimeline(localTimeline) // local is same as federated in this case
|
cy.validateTimeline(localTimeline) // local is same as federated in this case
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Shows favorites', () => {
|
||||||
|
cy.get('nav a[aria-label=Community]').click()
|
||||||
|
cy.url().should('contain', '/community')
|
||||||
|
cy.get('a').contains('Favorites').click()
|
||||||
|
cy.url().should('contain', '/favorites')
|
||||||
|
cy.validateTimeline(favorites)
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
|
@ -65,6 +65,14 @@ Cypress.Commands.add('validateTimeline', (timeline) => {
|
||||||
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 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).get('.status-header span').should('contain', 'followed you')
|
||||||
}
|
}
|
||||||
|
if (status.rebloggedBy) {
|
||||||
|
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', status.rebloggedBy)
|
||||||
|
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'boosted')
|
||||||
|
}
|
||||||
|
if (status.favoritedBy) {
|
||||||
|
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', status.favoritedBy)
|
||||||
|
cy.getNthVirtualArticle(i).get('.status-header span').should('contain', 'favorited')
|
||||||
|
}
|
||||||
cy.wait(50)
|
cy.wait(50)
|
||||||
cy.getNthVirtualArticle(i).scrollIntoView()
|
cy.getNthVirtualArticle(i).scrollIntoView()
|
||||||
cy.get('.loading-footer').should('not.exist')
|
cy.get('.loading-footer').should('not.exist')
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue