diff --git a/frontend/website/cypress/e2e/set-layout.cy.ts b/frontend/website/cypress/e2e/set-layout.cy.ts index 5430694..eab270a 100644 --- a/frontend/website/cypress/e2e/set-layout.cy.ts +++ b/frontend/website/cypress/e2e/set-layout.cy.ts @@ -5,29 +5,37 @@ const authenticatedUser = { const bibleLayout = { set: { id: 41, name: 'Bible' }, + levels: [ + { id: 1, kind: 'book', depth: 0, elementCount: 2 }, + { id: 2, kind: 'portion', depth: 1, elementCount: 2 }, + { id: 3, kind: 'chapter', depth: 2, elementCount: 1 }, + ], elements: [ { id: 1, name: 'Genesis', kind: 'book', + levelId: 1, children: [ { id: 3, name: 'Creation', kind: 'portion', + levelId: 2, children: [ { id: 4, name: 'Chapter 1', kind: 'chapter', + levelId: 3, children: [], }, ], }, - { id: 5, name: 'Noah', kind: 'portion', children: [] }, + { id: 5, name: 'Noah', kind: 'portion', levelId: 2, children: [] }, ], }, - { id: 2, name: 'Exodus', kind: 'book', children: [] }, + { id: 2, name: 'Exodus', kind: 'book', levelId: 1, children: [] }, ], } @@ -89,7 +97,7 @@ describe('set element layout', () => { cy.intercept('GET', '**/api/sets/41', { delay: 500, statusCode: 200, - body: { set: { id: 41, name: 'Empty set' }, elements: [] }, + body: { set: { id: 41, name: 'Empty set' }, levels: [], elements: [] }, }).as('layout') cy.visit('/sets/41') diff --git a/frontend/website/cypress/e2e/set-scheduling.cy.ts b/frontend/website/cypress/e2e/set-scheduling.cy.ts index 6ebe605..77a5d41 100644 --- a/frontend/website/cypress/e2e/set-scheduling.cy.ts +++ b/frontend/website/cypress/e2e/set-scheduling.cy.ts @@ -5,21 +5,29 @@ const authenticatedUser = { const bibleLayout = { set: { id: 41, name: 'Bible' }, + levels: [ + { id: 1, kind: 'book', depth: 0, elementCount: 2 }, + { id: 2, kind: 'portion', depth: 1, elementCount: 2 }, + { id: 3, kind: 'chapter', depth: 2, elementCount: 2 }, + ], elements: [ { id: 1, name: 'Genesis', kind: 'book', + levelId: 1, children: [ { id: 3, name: 'Creation', kind: 'portion', + levelId: 2, children: [ { id: 4, name: 'Chapter 1', kind: 'chapter', + levelId: 3, children: [], }, ], @@ -30,12 +38,22 @@ const bibleLayout = { id: 2, name: 'Exodus', kind: 'book', + levelId: 1, children: [ { id: 5, - name: 'Chapter 1', - kind: 'chapter', - children: [], + name: 'Shemot', + kind: 'portion', + levelId: 2, + children: [ + { + id: 6, + name: 'Chapter 1', + kind: 'chapter', + levelId: 3, + children: [], + }, + ], }, ], }, @@ -73,7 +91,7 @@ const scheduleDetail = { element: { name: 'Chapter 1', kind: 'chapter', - path: ['Exodus', 'Chapter 1'], + path: ['Exodus', 'Shemot', 'Chapter 1'], }, }, ], @@ -103,7 +121,7 @@ describe('set scheduling', () => { expect(request.headers.accept).to.equal('application/json') expect(request.body).to.deep.equal({ setId: 41, - elementKind: 'chapter', + levelId: 3, startDate: '2026-08-10', targetDate: '2026-08-12', }) @@ -121,10 +139,10 @@ describe('set scheduling', () => { cy.get('h1').should('have.text', 'Schedule Bible') cy.get('#schedule-level option').then(($options) => { expect([...$options].map((option) => option.textContent?.trim())).to.deep.equal( - ['Choose a level', 'Book (2)', 'Portion (1)', 'Chapter (2)'], + ['Choose a level', 'Book (2)', 'Portion (2)', 'Chapter (2)'], ) }) - cy.get('#schedule-level').select('chapter') + cy.get('#schedule-level').select('3') cy.get('#schedule-start-date').type('2026-08-10') cy.get('#schedule-target-date').type('2026-08-12') cy.get('form').submit() @@ -141,7 +159,7 @@ describe('set scheduling', () => { .and('not.contain.text', 'Chapter 1') cy.get('[data-schedule-date="2026-08-12"]').should( 'contain.text', - 'Exodus / Chapter 1', + 'Exodus / Shemot / Chapter 1', ) }) @@ -168,7 +186,7 @@ describe('set scheduling', () => { .and('be.visible') cy.get('@createSchedule.all').should('have.length', 0) - cy.get('#schedule-level').select('chapter') + cy.get('#schedule-level').select('3') cy.get('#schedule-start-date').type('2026-08-12') cy.get('#schedule-target-date').type('2026-08-10') cy.get('form').submit()