Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
e838044
chore(deps): add fflate package
duncdrum Oct 28, 2025
77de444
chore(build): update build configuration and improve target descriptions
duncdrum Oct 28, 2025
5434d4a
fix(api): refine namespace handling in TEI elements to exclude specif…
duncdrum Oct 28, 2025
a46030a
fix(api): ensure valid date grouping in correspondence entries
duncdrum Oct 28, 2025
34db260
feat(odd): add 'trigger' parameter for click events in pb-facs-link m…
duncdrum Oct 28, 2025
8c14577
fix(registers): correct conditional check for register feature in tem…
duncdrum Oct 28, 2025
0160e8f
feat(api): enhance login endpoint to support logout functionality
duncdrum Oct 28, 2025
e746471
feat(cypress): add Cypress configuration and API/UI tests for generat…
duncdrum Oct 28, 2025
72be4ef
feat(tests): expand generated app tests f
duncdrum Oct 28, 2025
a24edfd
feat(tests): add API tests for version and document retrieval functio…
duncdrum Oct 28, 2025
4035281
feat(tests): add API tests for annotation functionality
duncdrum Oct 28, 2025
ed01181
feat(tests): add custom API and E2E test templates
duncdrum Oct 28, 2025
0111e86
test(validation): add OpenAPI schema validation for generated apps
duncdrum Oct 29, 2025
529c6d4
feat(tests): adopt tests from e2e repo
duncdrum Oct 29, 2025
742a18c
feat(tests): add tests for ODD Editor functionality
duncdrum Oct 29, 2025
0ce11f1
refactor(tests): streamline API call intercepts in tests
duncdrum Oct 29, 2025
e2f2d11
chore(.gitignore): update ignore patterns for build and test artifacts
duncdrum Oct 29, 2025
65eef47
fix(build): handle git revision only for releases
duncdrum Oct 29, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
<echo message="${npm.build.output}" />
</target>

<!-- TBD(DP): make conditional on release -->
<target name="templates" description="process template files" depends="git.revision">
<target name="templates" description="process template files" if="is-release">
<echo message="Apply values to .tmpl ..." />
<copy todir="${basedir}" overwrite="true" verbose="true">
<fileset file="*.xml.tmpl" />
Expand All @@ -76,7 +75,7 @@
</copy>
</target>

<target name="git.revision" description="Store git revision in ${commit-id}" if="git.present">
<target name="git.revision" description="Store git revision in ${commit-id}" if="is-release" depends="check-release">
<exec executable="git" outputproperty="git.revision" failifexecutionfails="false"
errorproperty="">
<arg value="--git-dir=${git.repo.path}" />
Expand Down
20 changes: 15 additions & 5 deletions modules/api.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,12 +356,22 @@
},
"/api/login": {
"post": {
"summary": "Login the user",
"description": "Login the given user",
"summary": "Login or logout the user",
"description": "Login the given user or logout current user",
"tags": ["user"],
"operationId": "auth:login",
"parameters": [
{
"name": "logout",
"in": "query",
"description": "Set to 'true' to logout current user",
"schema": {
"type": "string"
}
}
],
"requestBody": {
"required": true,
"required": false,
"content": {
"multipart/form-data": {
"schema": {
Expand Down Expand Up @@ -399,7 +409,7 @@
},
"responses": {
"200": {
"description": "OK",
"description": "OK - Login successful or logout completed",
"content": {
"application/json": {
"schema": {
Expand All @@ -426,7 +436,7 @@
}
},
"401": {
"description": "Wrong user or password"
"description": "Wrong user or password, or logout when not logged in"
}
}
}
Expand Down
15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"cypress": "^15.5.0",
"cypress-ajv-schema-validator": "^2.0.2",
"esbuild": "^0.25.11",
"fflate": "^0.8.2",
"glob": "^11.0.3",
"sass": "^1.93.2"
}
Expand Down
129 changes: 129 additions & 0 deletions profiles/annotate/test/cypress/e2e/api/annotations.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
// StandardJS, should-style assertions
// API tests for Annotation functionality
// Generated by jinks - DO NOT EDIT manually

const uploadAnnotations = () => {
return cy.fixture('annotations.xml', 'utf8').then(xml => {
return cy.uploadXml('/api/upload/annotate', 'annotations.xml', xml)
.then(({ status, body }) => {
cy.wrap(status).should('eq', 200)
cy.wrap(body).should('have.length', 1)
cy.wrap(body).its('0.name').should('include', 'annotations.xml')
})
})
}

const assertAnnotate = (payload, paraIndex, expectedXml) => {
return cy.request({
method: 'POST',
url: '/api/annotations/merge/annotate%2Fannotations.xml',
headers: { 'Content-Type': 'application/json' },
body: payload
}).then(({ status, body }) => {
cy.wrap(status).should('eq', 200)
cy.wrap(body.changes).should('have.length', 1)
const doc = new DOMParser().parseFromString(body.content, 'application/xml')
const para = selectPara(doc, paraIndex)
const xml = new XMLSerializer().serializeToString(para)
cy.wrap(xml).should('equal', expectedXml)
})
}

const selectPara = (doc, idx) => {
const xpath = `//*[local-name()='body']/*[local-name()='p'][${idx}]`
const res = doc.evaluate(xpath, doc, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null)
return res.singleNodeValue
}

describe('/api/annotations/merge', () => {
// Upload once; login before each test for a fresh session
before(() => {
return cy.login().then(() => uploadAnnotations())
})
beforeEach(() => {
cy.login()
})

it('deletes at start and wraps', () => {
assertAnnotate({
annotations: [
{ type: 'delete', node: '1.4.2.2.2', context: '1.4.2.2' },
{ context: '1.4.2.2', start: 1, end: 9, text: 'Gauger I', type: 'hi', properties: {} },
{ context: '1.4.2.2', start: 11, end: 14, text: '113', type: 'hi', properties: {} },
{ context: '1.4.2.2', start: 1, end: 13, text: 'Gauger I, 113', type: 'link', properties: { target: '#foo' } }
]
}, 1, '<p xmlns="http://www.tei-c.org/ns/1.0">(<ref target="#foo"><hi>Gauger I</hi>, <hi>113</hi></ref>).</p>')
})

it('deletes at end and wraps', () => {
assertAnnotate({
annotations: [
{ type: 'delete', node: '1.4.2.4.2', context: '1.4.2.4' },
{ context: '1.4.2.4', start: 1, end: 4, text: '113', type: 'hi', properties: {} },
{ context: '1.4.2.4', start: 6, end: 14, text: 'Gauger I', type: 'hi', properties: {} },
{ context: '1.4.2.4', start: 1, end: 13, text: '113, Gauger I', type: 'link', properties: { target: '#foo' } }
]
}, 2, '<p xmlns="http://www.tei-c.org/ns/1.0">(<ref target="#foo"><hi>113</hi>, <hi>Gauger I</hi></ref>).</p>')
})

it('annotate after nested note', () => {
assertAnnotate({
annotations: [
{ context: '1.4.2.8', start: 20, end: 39, text: 'Opuscula theologica', type: 'hi', properties: {} }
]
}, 4, '<p xmlns="http://www.tei-c.org/ns/1.0"><ref target="#">Starb am<note place="footnote">Fehlt.</note></ref>. Sammlung: <hi>Opuscula theologica</hi>.</p>')
})

it('wrap to end of paragraph', () => {
assertAnnotate({
annotations: [
{ context: '1.4.2.16', start: 210, end: 308, text: 'S. Werenfels, Fasciculus Epigrammatum, in: ders., Opuscula III (Anm. 20), S. 337–428, dort S. 384:', type: 'link', properties: { target: '#foo' } }
]
}, 8, '<p xmlns="http://www.tei-c.org/ns/1.0">Bei <persName type="author" ref="kbga-actors-8470">Budé</persName> (Anm. 21), S. 56f.59, finden sich zwei Briefe von Fontenelle an Turettini, in denen <persName ref="kbga-actors-8482">Fontenelle</persName> sich lobend über <persName ref="kbga-actors-1319">Werenfels</persName> äußert. Den erwähnten Dank formulierte <persName ref="kbga-actors-1319">Werenfels</persName> in Form eines Epigramms; vgl. <ref target="#foo"><persName type="author" ref="kbga-actors-1319">S. Werenfels</persName>, <hi rend="i">Fasciculus Epigrammatum</hi>, in: ders., <hi rend="i">Opuscula</hi> III (Anm. 20), S. 337–428, dort S. 384:</ref></p>')
})

it('annotate after nested choice', () => {
assertAnnotate({
annotations: [
{ context: '1.4.2.10', start: 9, end: 28, text: 'Opuscula theologica', type: 'hi', properties: {} }
]
}, 5, '<p xmlns="http://www.tei-c.org/ns/1.0"><hi>Zum <choice><abbr>Bsp.</abbr><expan>Beispiel</expan></choice></hi> <hi>Opuscula theologica</hi>.</p>')
})

it('insert choice/abbr/expan', () => {
assertAnnotate({
annotations: [
{ context: '1.4.2.12', start: 6, end: 17, text: 'ipsum dolor', type: 'abbreviation', properties: { expan: 'sit amet' } }
]
}, 6, '<p xmlns="http://www.tei-c.org/ns/1.0">Lorem <choice><abbr>ipsum dolor</abbr><expan>sit amet</expan></choice> sit amet.</p>')
})

it('insert app/lem/rdg', () => {
assertAnnotate({
annotations: [
{ context: '1.4.2.12', start: 6, end: 17, text: 'ipsum dolor', type: 'app', properties: { 'wit[1]': '#me', 'rdg[1]': 'sit amet' } }
]
}, 6, '<p xmlns="http://www.tei-c.org/ns/1.0">Lorem <app><lem>ipsum dolor</lem><rdg wit="#me">sit amet</rdg></app> sit amet.</p>')
})

it('delete choice/abbr/expan', () => {
assertAnnotate({
annotations: [
{ type: 'delete', node: '1.4.2.14.2', context: '1.4.2.14' }
]
}, 7, '<p xmlns="http://www.tei-c.org/ns/1.0">Lorem ipsum dolor sit amet.</p>')
})

it('delete element containing note', () => {
assertAnnotate({
annotations: [
{ type: 'delete', node: '1.4.2.8.1', context: '1.4.2.8' }
]
}, 4, '<p xmlns="http://www.tei-c.org/ns/1.0">Starb am<note place="footnote">Fehlt.</note>. Sammlung: Opuscula theologica.</p>')
})

after(() => {
cy.logout()
})
})

27 changes: 27 additions & 0 deletions profiles/annotate/test/cypress/fixtures/annotations.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Annotations Test</title>
</titleStmt>
<publicationStmt>
<p/>
</publicationStmt>
<sourceDesc>
<p/>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<body>
<p>(<persName type="author" ref="Gauger">Gauger</persName> I, 113).</p>
<p>(113, <persName type="author" ref="Gauger">Gauger</persName> I).</p>
<p>113, <persName type="author" ref="Gauger">Gauger</persName></p>
<p><ref target="#">Starb am<note place="footnote">Fehlt.</note></ref>. Sammlung: Opuscula theologica.</p>
<p><hi>Zum <choice><abbr>Bsp.</abbr><expan>Beispiel</expan></choice></hi> Opuscula theologica.</p>
<p>Lorem ipsum dolor sit amet.</p>
<p>Lorem <choice><abbr>ipsum dolor</abbr><expan>sit amet</expan></choice> sit amet.</p>
<p>Bei <persName type="author" ref="kbga-actors-8470">Budé</persName> (Anm. 21), S. 56f.59, finden sich zwei Briefe von Fontenelle an Turettini, in denen <persName ref="kbga-actors-8482">Fontenelle</persName> sich lobend über <persName ref="kbga-actors-1319">Werenfels</persName> äußert. Den erwähnten Dank formulierte <persName ref="kbga-actors-1319">Werenfels</persName> in Form eines Epigramms; vgl. <persName type="author" ref="kbga-actors-1319">S. Werenfels</persName>, <hi rend="i">Fasciculus Epigrammatum</hi>, in: ders., <hi rend="i">Opuscula</hi> III (Anm. 20), S. 337–428, dort S. 384:</p>
</body>
</text>
</TEI>
10 changes: 7 additions & 3 deletions profiles/base10/.gitignore.tpl
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
build
build/
transform
node_modules
node_modules/
resources/scripts/*.map
resources/lib/
resources/css/leaflet/
resources/css/prismjs
resources/images/openseadragon
resources/images/leaflet
resources/i18n/common
resources/i18n/common
test/cypress/screenshots/
test/cypress/videos/
test/cypress/downloads/
.DS_Store
Loading
Loading