test sparse placement controls
This commit is contained in:
parent
90dcc8665a
commit
6f2c49026a
1 changed files with 44 additions and 1 deletions
|
|
@ -67,6 +67,13 @@ const overloadedBibleLayout = {
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sparseBibleLayout = {
|
||||||
|
...bibleLayout,
|
||||||
|
levels: bibleLayout.levels.map((level) =>
|
||||||
|
level.id === 3 ? { ...level, elementCount: 4 } : level,
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
const scheduleDetail = {
|
const scheduleDetail = {
|
||||||
schedule: {
|
schedule: {
|
||||||
id: 73,
|
id: 73,
|
||||||
|
|
@ -201,7 +208,7 @@ describe('set scheduling', () => {
|
||||||
levelId: 3,
|
levelId: 3,
|
||||||
startDate: '2026-08-10',
|
startDate: '2026-08-10',
|
||||||
targetDate: '2026-08-12',
|
targetDate: '2026-08-12',
|
||||||
workloadPlacement: 'middle',
|
workloadPlacement: 'spread',
|
||||||
})
|
})
|
||||||
request.reply({ statusCode: 201, body: scheduleDetail })
|
request.reply({ statusCode: 201, body: scheduleDetail })
|
||||||
}).as('createSchedule')
|
}).as('createSchedule')
|
||||||
|
|
@ -286,6 +293,42 @@ describe('set scheduling', () => {
|
||||||
cy.wait('@createSchedule')
|
cy.wait('@createSchedule')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('packs sparse assignment days where the user chooses', () => {
|
||||||
|
cy.intercept('GET', '**/api/sets/41', {
|
||||||
|
statusCode: 200,
|
||||||
|
body: sparseBibleLayout,
|
||||||
|
}).as('layout')
|
||||||
|
cy.intercept('POST', '**/api/schedules', (request) => {
|
||||||
|
expect(request.body).to.deep.equal({
|
||||||
|
setId: 41,
|
||||||
|
levelId: 3,
|
||||||
|
startDate: '2026-08-10',
|
||||||
|
targetDate: '2026-08-15',
|
||||||
|
workloadPlacement: 'end',
|
||||||
|
})
|
||||||
|
request.reply({ statusCode: 201, body: scheduleDetail })
|
||||||
|
}).as('createSchedule')
|
||||||
|
|
||||||
|
cy.visit('/sets/41/schedules/new')
|
||||||
|
cy.wait('@me')
|
||||||
|
cy.wait('@layout')
|
||||||
|
cy.get('#schedule-level').select('3')
|
||||||
|
cy.get('#schedule-start-date').type('2026-08-10')
|
||||||
|
cy.get('#schedule-target-date').type('2026-08-15')
|
||||||
|
|
||||||
|
cy.get('[data-workload-placement]').should('be.visible').within(() => {
|
||||||
|
cy.contains('legend', 'Assignment days').should('be.visible')
|
||||||
|
cy.contains('Spread evenly').should('be.visible')
|
||||||
|
cy.contains('At the start').should('be.visible')
|
||||||
|
cy.contains('In the middle').should('be.visible')
|
||||||
|
cy.contains('At the end').should('be.visible')
|
||||||
|
cy.get('input[value="spread"]').should('be.checked')
|
||||||
|
cy.get('input[value="end"]').check()
|
||||||
|
})
|
||||||
|
cy.get('form').submit()
|
||||||
|
cy.wait('@createSchedule')
|
||||||
|
})
|
||||||
|
|
||||||
it('validates the schedule form before submitting', () => {
|
it('validates the schedule form before submitting', () => {
|
||||||
cy.intercept('GET', '**/api/sets/41', {
|
cy.intercept('GET', '**/api/sets/41', {
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue