test today page lists scheduled nodes
This commit is contained in:
parent
6314f1c38c
commit
46d01aa813
1 changed files with 43 additions and 0 deletions
|
|
@ -29,4 +29,47 @@ describe('The today page', () => {
|
||||||
cy.visit('/home')
|
cy.visit('/home')
|
||||||
cy.get('a[href="/today"]').should('be.visible')
|
cy.get('a[href="/today"]').should('be.visible')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('lists scheduled nodes for today', () => {
|
||||||
|
const today = new Date()
|
||||||
|
const year = today.getFullYear()
|
||||||
|
const month = String(today.getMonth() + 1).padStart(2, '0')
|
||||||
|
const day = String(today.getDate()).padStart(2, '0')
|
||||||
|
const todayString = year + '-' + month + '-' + day
|
||||||
|
|
||||||
|
cy.loginAsUser()
|
||||||
|
cy.request({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/api/plans',
|
||||||
|
body: {
|
||||||
|
textId: 0,
|
||||||
|
name: 'My reading plan',
|
||||||
|
dateStart: todayString,
|
||||||
|
dateEnd: todayString,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
cy.intercept('GET', '/api/scheduled-nodes*')
|
||||||
|
.as('getScheduledNodes')
|
||||||
|
cy.visit('/today')
|
||||||
|
cy.wait('@getScheduledNodes').then((interception) => {
|
||||||
|
expect(interception.request.url).to.include(
|
||||||
|
'date=' + todayString
|
||||||
|
)
|
||||||
|
})
|
||||||
|
cy.get('#scheduled-nodes-list').should(
|
||||||
|
'contain',
|
||||||
|
'My reading plan'
|
||||||
|
)
|
||||||
|
cy.get('#scheduled-nodes-list').should('contain', 'Bereishis')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('shows an empty list when no nodes are scheduled today', () => {
|
||||||
|
cy.loginAsUser()
|
||||||
|
cy.intercept('GET', '/api/scheduled-nodes*')
|
||||||
|
.as('getScheduledNodes')
|
||||||
|
cy.visit('/today')
|
||||||
|
cy.wait('@getScheduledNodes')
|
||||||
|
cy.get('#scheduled-nodes-list li').should('have.length', 0)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue