test verbatim kind labels

This commit is contained in:
Yisroel Baum 2026-08-14 09:50:38 +03:00
parent 98a4e2e007
commit 00cfeebb9a
Signed by: yisroelbaum
GPG key ID: 0FA60884F75520A9

View file

@ -8,7 +8,7 @@ const bibleLayout = {
levels: [ levels: [
{ id: 1, kind: 'book', depth: 0, elementCount: 2 }, { id: 1, kind: 'book', depth: 0, elementCount: 2 },
{ id: 2, kind: 'portion', depth: 1, elementCount: 2 }, { id: 2, kind: 'portion', depth: 1, elementCount: 2 },
{ id: 3, kind: 'chapter', depth: 2, elementCount: 2 }, { id: 3, kind: 'Chapter_sections-v2', depth: 2, elementCount: 2 },
], ],
elements: [ elements: [
{ {
@ -26,7 +26,7 @@ const bibleLayout = {
{ {
id: 4, id: 4,
name: 'Chapter 1', name: 'Chapter 1',
kind: 'chapter', kind: 'Chapter_sections-v2',
levelId: 3, levelId: 3,
children: [], children: [],
}, },
@ -49,7 +49,7 @@ const bibleLayout = {
{ {
id: 6, id: 6,
name: 'Chapter 1', name: 'Chapter 1',
kind: 'chapter', kind: 'Chapter_sections-v2',
levelId: 3, levelId: 3,
children: [], children: [],
}, },
@ -64,7 +64,7 @@ const scheduleDetail = {
schedule: { schedule: {
id: 73, id: 73,
set: { name: 'Bible' }, set: { name: 'Bible' },
elementKind: 'chapter', elementKind: 'Chapter_sections-v2',
startDate: '2026-08-10', startDate: '2026-08-10',
targetDate: '2026-08-12', targetDate: '2026-08-12',
assignmentCount: 2, assignmentCount: 2,
@ -76,7 +76,7 @@ const scheduleDetail = {
id: 1, id: 1,
element: { element: {
name: 'Chapter 1', name: 'Chapter 1',
kind: 'chapter', kind: 'Chapter_sections-v2',
path: ['Genesis', 'Creation', 'Chapter 1'], path: ['Genesis', 'Creation', 'Chapter 1'],
}, },
}, },
@ -90,7 +90,7 @@ const scheduleDetail = {
id: 2, id: 2,
element: { element: {
name: 'Chapter 1', name: 'Chapter 1',
kind: 'chapter', kind: 'Chapter_sections-v2',
path: ['Exodus', 'Shemot', 'Chapter 1'], path: ['Exodus', 'Shemot', 'Chapter 1'],
}, },
}, },
@ -139,7 +139,7 @@ describe('set scheduling', () => {
cy.get('h1').should('have.text', 'Schedule Bible') cy.get('h1').should('have.text', 'Schedule Bible')
cy.get('#schedule-level option').then(($options) => { cy.get('#schedule-level option').then(($options) => {
expect([...$options].map((option) => option.textContent?.trim())).to.deep.equal( expect([...$options].map((option) => option.textContent?.trim())).to.deep.equal(
['Choose a level', 'Book (2)', 'Portion (2)', 'Chapter (2)'], ['Choose a level', 'Book (2)', 'Portion (2)', 'Chapter_sections-v2 (2)'],
) )
}) })
cy.get('#schedule-level').select('3') cy.get('#schedule-level').select('3')
@ -153,7 +153,8 @@ describe('set scheduling', () => {
cy.get('[data-schedule-day]').should('have.length', 3) cy.get('[data-schedule-day]').should('have.length', 3)
cy.get('[data-schedule-date="2026-08-10"]') cy.get('[data-schedule-date="2026-08-10"]')
.should('contain.text', 'Genesis / Creation / Chapter 1') .should('contain.text', 'Genesis / Creation / Chapter 1')
.and('contain.text', 'Chapter') .find('.assignment-kind')
.should('have.text', 'Chapter_sections-v2')
cy.get('[data-schedule-date="2026-08-11"]') cy.get('[data-schedule-date="2026-08-11"]')
.should('contain.text', 'Rest day') .should('contain.text', 'Rest day')
.and('not.contain.text', 'Chapter 1') .and('not.contain.text', 'Chapter 1')
@ -207,7 +208,8 @@ describe('set scheduling', () => {
cy.wait('@me') cy.wait('@me')
cy.wait('@schedule') cy.wait('@schedule')
cy.get('h1').should('have.text', 'Bible schedule') cy.get('h1').should('have.text', 'Bible schedule')
cy.contains('2 chapters across 3 days').should('be.visible') cy.get('.eyebrow').should('have.text', 'Chapter_sections-v2 plan')
cy.contains('2 Chapter_sections-v2 assignments across 3 days').should('be.visible')
cy.intercept('GET', '**/api/schedules/74', { cy.intercept('GET', '**/api/schedules/74', {
statusCode: 404, statusCode: 404,
@ -232,7 +234,7 @@ describe('set scheduling', () => {
{ {
id: 73, id: 73,
set: { name: 'Bible' }, set: { name: 'Bible' },
elementKind: 'chapter', elementKind: 'Chapter_sections-v2',
startDate: '2026-08-10', startDate: '2026-08-10',
targetDate: '2026-08-12', targetDate: '2026-08-12',
assignmentCount: 2, assignmentCount: 2,
@ -250,8 +252,8 @@ describe('set scheduling', () => {
cy.get('#schedules-heading').should('have.text', 'Your schedules') cy.get('#schedules-heading').should('have.text', 'Your schedules')
cy.get('ul[aria-label="Your schedules"]') cy.get('ul[aria-label="Your schedules"]')
.should('contain.text', 'Bible') .should('contain.text', 'Bible')
.and('contain.text', 'Chapter')
.and('contain.text', '2 assignments') .and('contain.text', '2 assignments')
cy.get('.schedule-card__heading p').should('have.text', 'Chapter_sections-v2')
cy.contains('a', 'Bible').should('have.attr', 'href', '/schedules/73') cy.contains('a', 'Bible').should('have.attr', 'href', '/schedules/73')
}) })
}) })