test today schedule queues
This commit is contained in:
parent
6eb44d2531
commit
ba6e4908da
1 changed files with 75 additions and 1 deletions
|
|
@ -26,7 +26,7 @@ describe("today's assignments", () => {
|
|||
interceptDashboardRequests()
|
||||
})
|
||||
|
||||
it('uses the browser date and links every assignment to its schedule', () => {
|
||||
it('shows only the earliest due assignment for each schedule', () => {
|
||||
cy.intercept('GET', `**/api/assignments?date=${browserToday}`, (request) => {
|
||||
expect(request.headers.accept).to.equal('application/json')
|
||||
request.reply({
|
||||
|
|
@ -60,6 +60,32 @@ describe("today's assignments", () => {
|
|||
path: ['Introduction'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 14,
|
||||
scheduledDate: browserToday,
|
||||
schedule: {
|
||||
id: 73,
|
||||
set: { name: 'Bible' },
|
||||
},
|
||||
element: {
|
||||
name: 'Chapter 2',
|
||||
kind: 'Chapter_sections-v2',
|
||||
path: ['Genesis', 'The garden', 'Chapter 2'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 15,
|
||||
scheduledDate: browserToday,
|
||||
schedule: {
|
||||
id: 73,
|
||||
set: { name: 'Bible' },
|
||||
},
|
||||
element: {
|
||||
name: 'Chapter 3',
|
||||
kind: 'Chapter_sections-v2',
|
||||
path: ['Genesis', 'The fall', 'Chapter 3'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
|
|
@ -89,6 +115,17 @@ describe("today's assignments", () => {
|
|||
cy.get('[data-today-assignment="13"] .today-assignment__overdue').should(
|
||||
'not.exist',
|
||||
)
|
||||
cy.get('[data-today-assignment="14"]').should('not.exist')
|
||||
cy.get('[data-today-assignment="15"]').should('not.exist')
|
||||
cy.get('[data-today-schedule="73"]')
|
||||
.should('have.attr', 'data-due-count', '3')
|
||||
.and('contain.text', '3 due now')
|
||||
.and('have.class', 'today-assignment-stack--queued')
|
||||
cy.get('[data-today-schedule="81"]')
|
||||
.should('have.attr', 'data-due-count', '1')
|
||||
.and('not.have.class', 'today-assignment-stack--queued')
|
||||
.find('.today-assignment__queue-count')
|
||||
.should('not.exist')
|
||||
cy.contains('a', 'Genesis / Creation / Chapter 1')
|
||||
.should('contain.text', 'Bible')
|
||||
.and('have.attr', 'href', '/schedules/73')
|
||||
|
|
@ -144,6 +181,19 @@ describe("today's assignments", () => {
|
|||
path: ['Genesis', 'Chapter 1'],
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 13,
|
||||
scheduledDate: browserToday,
|
||||
schedule: {
|
||||
id: 73,
|
||||
set: { name: 'Bible' },
|
||||
},
|
||||
element: {
|
||||
name: 'Chapter 2',
|
||||
kind: 'chapter',
|
||||
path: ['Genesis', 'Chapter 2'],
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}).as('todayAssignments')
|
||||
|
|
@ -169,6 +219,19 @@ describe("today's assignments", () => {
|
|||
},
|
||||
})
|
||||
})
|
||||
cy.intercept('PATCH', '**/api/assignments/13', (request) => {
|
||||
expect(request.body).to.deep.equal({ completed: true })
|
||||
request.reply({
|
||||
delay: 400,
|
||||
statusCode: 200,
|
||||
body: {
|
||||
assignment: {
|
||||
id: 13,
|
||||
completedAt: '2026-08-15T12:35:00+00:00',
|
||||
},
|
||||
},
|
||||
})
|
||||
}).as('nextCompletion')
|
||||
|
||||
cy.visit('/dashboard')
|
||||
cy.wait('@me')
|
||||
|
|
@ -181,6 +244,7 @@ describe("today's assignments", () => {
|
|||
cy.wait('@completion1')
|
||||
cy.get('[data-today-assignment="12"]')
|
||||
.should('contain.text', "We couldn't update this assignment.")
|
||||
.and('contain.text', '2 due now')
|
||||
.within(() => {
|
||||
cy.contains('button', 'Mark complete').click()
|
||||
cy.contains('button', 'Completing...').should('be.disabled')
|
||||
|
|
@ -188,6 +252,16 @@ describe("today's assignments", () => {
|
|||
cy.wait('@completion2')
|
||||
|
||||
cy.get('[data-today-assignment="12"]').should('not.exist')
|
||||
cy.get('[data-today-assignment="13"]')
|
||||
.should('be.visible')
|
||||
.and('have.attr', 'data-due-count', '1')
|
||||
.within(() => {
|
||||
cy.get('.today-assignment__queue-count').should('not.exist')
|
||||
cy.contains('button', 'Mark complete').click()
|
||||
})
|
||||
cy.wait('@nextCompletion')
|
||||
|
||||
cy.get('[data-today-assignment="13"]').should('not.exist')
|
||||
cy.get('.today-assignments [role="status"]').should(
|
||||
'contain.text',
|
||||
'Nothing is due today.',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue