Skip to content

Commit ec76adf

Browse files
committed
fix(ci): add int test to travis, add docs, remove kitchensink
1 parent 46a6a59 commit ec76adf

27 files changed

+102
-2030
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ node_modules/*
88
node/*
99

1010
maven-archiver/
11+
12+
src/test/cypress/videos/*.mp4
13+
src/test/cypress/screenshots/**/*.png

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ before_script:
2727
script:
2828
- mvn validate
2929
- mvn test
30+
- npm run cypress
3031

3132
after_success:
3233
- docker ps

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ Should you encounter documentation for features that are deprecated in the minim
3939
3. Install this file via the Dashboard > Package Manager.
4040

4141
## (WIP) Testing
42-
Tests are executed locally by maven or on travis. To validate xml files run `mvn validate`, to run the javascript tests `mvn test` (xQsuite coming soon). We do **not** support testing via node alone, aka `npm test`, use the maven command instead.
42+
43+
### Unit tests
44+
The full test-suite consists of validation, unit, and integration tests, it runs automatically on travis. To be able to run integration tests locally, contributors should run `npm i` to download and install [cypress.js](https://www.cypress.io). This is only required once. To execute the tests run the following commands:
45+
- To validate xml files run `mvn validate`,
46+
- to run the javascript tests `mvn test` (xQsuite coming soon). We do **not** support testing via node alone, aka `npm test`, use the maven command instead.
47+
- To run the Integrations tests `npm run cypress`.
48+
49+
Both unit and integration tests, expect a running instance of exist with a copy of the documentation app installed reachable at `localhost:8080` and an empty admin password.
4350

4451
## License
4552
LGPLv2.1 [eXist-db.org](http://exist-db.org/exist/apps/homepage/index.html)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Documentation package for eXist-db",
55
"scripts": {
66
"test": "mocha src/test/mocha/ --recursive --exit",
7-
"cypress": "cypress run"
7+
"cypress": "cypress run"
88
},
99
"repository": {
1010
"type": "git",

src/test/cypress/fixtures/users.json

Lines changed: 0 additions & 232 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/// <reference types="cypress" />
2+
3+
// This is very slow and therefore skipped. Once diagnostics are re-written
4+
// we might bring this back. In the meantime dead-links are tested via xQsuite
5+
// see #
6+
7+
context.skip('Diagnostics', () => {
8+
before(() => {
9+
cy.visit('/diagnostics.html', {responseTimeout: 60000})
10+
11+
})
12+
it('should not find dead links', () => {
13+
cy.get('h1')
14+
.contains('Documentation link diagnostics')
15+
.parents('#main')
16+
.find('ul')
17+
.contains('advanced-installation.xml')
18+
})
19+
})
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/// <reference types="cypress" />
2+
3+
context('Documentation', () => {
4+
beforeEach(() => {
5+
cy.visit('/')
6+
})
7+
describe('landing article', () => {
8+
it('should have content prose', () => {
9+
cy.title('documentation')
10+
cy.get('h1')
11+
.contains('Documentation')
12+
.parents('article')
13+
.find('section > h2')
14+
.contains('Alphabetical index')
15+
.parents('article')
16+
.contains('Subject index')
17+
})
18+
19+
describe('generated indexes', () => {
20+
it('should contain articles by alphabet', () => {
21+
cy.get('[name=alphabetical-index]')
22+
.parents('section')
23+
.contains('Integration Testing')
24+
})
25+
26+
it('should contain articles by subject', () => {
27+
cy.get('[name=subject-index]')
28+
.parents('section')
29+
.contains('Integration Testing')
30+
})
31+
32+
})
33+
34+
it('should have ToC links', () => {
35+
cy.get('#sidebar')
36+
.find('.toc')
37+
.within(($toc) => {
38+
cy.get('li')
39+
.contains('Getting Started')
40+
.click()
41+
.url()
42+
.should('include', '#start')
43+
})
44+
})
45+
46+
describe('navbar', () => {
47+
it('should enable simple search', () => {
48+
cy.get('.search-query')
49+
.type('testing{enter}')
50+
.url().should('include', 'search.html')
51+
cy.get('body')
52+
.find('#f-results')
53+
.contains('Integration Testing')
54+
.click()
55+
.url()
56+
.should('include', 'integration-testing.xml')
57+
})
58+
59+
it('should reference author guidelines', () => {
60+
cy.get('.navbar')
61+
.find('#documentation')
62+
.click()
63+
.contains('author guidelines')
64+
.click()
65+
.url()
66+
.should('include', 'author-reference.xml')
67+
})
68+
})
69+
})
70+
})

0 commit comments

Comments
 (0)