Skip to content

Commit

Permalink
chore(tiles): add test for broken links
Browse files Browse the repository at this point in the history
  • Loading branch information
rkettelerij committed Nov 12, 2024
1 parent b49bce1 commit e57c9ef
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/config_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ datasetDetails:
- name: Metadata dataset
value: >-
[Dataset metadata in Example Register](https://example.com/my-dataset/metadata)
datasetCatalogUrl: https://www.pdok.nl/datasets
datasetCatalogUrl: https://example.com/datasets
baseUrl: http://localhost:8080
availableLanguages:
- nl
Expand Down
3 changes: 2 additions & 1 deletion tests/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ yarn-error.log

# Cypress
cypress/videos
cypress/screenshots
cypress/screenshots
downloads/
51 changes: 51 additions & 0 deletions tests/cypress/e2e/common.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,16 @@ describe('OGC API Common tests', () => {
cy.get('.card-header.h5').should("have.length", 6)
})

it('landing page should have no broken links', () => {
cy.visit('/')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

// disabled since it has two violations in the 3rd party swagger-ui component (outside our control)
it.skip('openapi page should have no a11y violations', () => {
cy.visit('/api')
Expand All @@ -28,6 +38,16 @@ describe('OGC API Common tests', () => {
cy.htmlvalidate();
})

it('openapi page should have no broken links', () => {
cy.visit('/api')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('conformance page should have no a11y violations', () => {
cy.visit('/conformance')
cy.injectAxe()
Expand All @@ -39,6 +59,17 @@ describe('OGC API Common tests', () => {
cy.htmlvalidate();
})

// Here we also check ogc.org pages, so this test may fail if ogc webpage is down...
it('conformance page should have no broken links', () => {
cy.visit('/conformance')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('collections page should have no a11y violations', () => {
cy.visit('/collections')
cy.injectAxe()
Expand All @@ -50,6 +81,16 @@ describe('OGC API Common tests', () => {
cy.htmlvalidate();
})

it('collections page should have no broken links', () => {
cy.visit('/collections')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('collection page should have no a11y violations', () => {
cy.visit('/collections/addresses')
cy.injectAxe()
Expand All @@ -60,4 +101,14 @@ describe('OGC API Common tests', () => {
cy.visit("/collections/addresses");
cy.htmlvalidate();
})

it('collection page should have no broken links', () => {
cy.visit('/collections/addresses')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})
})
19 changes: 19 additions & 0 deletions tests/cypress/e2e/features.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ describe('OGC API Features tests', () => {
})
})

it('collection page should have no broken links', () => {
cy.visit('/collections/addresses/items')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('feature page should have no a11y violations', () => {
cy.visit('/collections/addresses/items/1')
cy.injectAxe()
Expand All @@ -26,4 +36,13 @@ describe('OGC API Features tests', () => {
})
})

it('feature page should have no broken links', () => {
cy.visit('/collections/addresses/items/1')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})
})
30 changes: 30 additions & 0 deletions tests/cypress/e2e/styles.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ describe('OGC API Styles tests', () => {
cy.htmlvalidate();
})

it('styles page should have no broken links', () => {
cy.visit('/styles')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('style page should have no a11y violations', () => {
cy.visit('/styles/dummy-style')
cy.injectAxe()
Expand All @@ -22,6 +32,16 @@ describe('OGC API Styles tests', () => {
cy.htmlvalidate();
})

it('style page should have no broken links', () => {
cy.visit('/styles/dummy-style')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('styles metadata page should have no a11y violations', () => {
cy.visit('/styles/dummy-style/metadata')
cy.injectAxe()
Expand All @@ -32,4 +52,14 @@ describe('OGC API Styles tests', () => {
cy.visit("/styles/dummy-style/metadata");
cy.htmlvalidate();
})

it('styles metadata page should have no broken links', () => {
cy.visit('/styles/dummy-style/metadata')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})
})
62 changes: 61 additions & 1 deletion tests/cypress/e2e/tiles.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ describe('OGC API Tiles tests', () => {
cy.htmlvalidate();
})

it('dataset tiles page should have no broken links', () => {
cy.visit('/tiles')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('dataset tiles metadata page should have no a11y violations', () => {
cy.visit('/tiles/NetherlandsRDNewQuad')
cy.injectAxe()
Expand All @@ -22,6 +32,16 @@ describe('OGC API Tiles tests', () => {
cy.htmlvalidate();
})

it('dataset tiles metadata page should have no broken links', () => {
cy.visit('/tiles/NetherlandsRDNewQuad')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('geodata tiles page (collection-level) should have no a11y violations', () => {
cy.visit('/collections/addresses/tiles')
cy.injectAxe()
Expand All @@ -33,17 +53,37 @@ describe('OGC API Tiles tests', () => {
cy.htmlvalidate();
})

it('geodata tiles page should have no broken links', () => {
cy.visit('/collections/addresses/tiles')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('geodata tiles metadata page (collection-level) should have no a11y violations', () => {
cy.visit('/collections/addresses/tiles/NetherlandsRDNewQuad')
cy.injectAxe()
cy.checkA11y()
})

it("geodata tiles metadata page should have valid HTML", () => {
cy.visit("/collections/addresses/tiles/NetherlandsRDNewQuad");
cy.visit('/collections/addresses/tiles/NetherlandsRDNewQuad');
cy.htmlvalidate();
})

it('geodata tiles metadata page should have no broken links', () => {
cy.visit('/collections/addresses/tiles/NetherlandsRDNewQuad')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('tileMatrixSets page should have no a11y violations', () => {
cy.visit('/tileMatrixSets')
cy.injectAxe()
Expand All @@ -55,6 +95,16 @@ describe('OGC API Tiles tests', () => {
cy.htmlvalidate();
})

it('tileMatrixSets page should have no broken links', () => {
cy.visit('/tileMatrixSets')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})

it('specific tileMatrixSet (NetherlandsRDNewQuad) page should have no a11y violations', () => {
cy.visit('/tileMatrixSets/NetherlandsRDNewQuad')
cy.injectAxe()
Expand All @@ -65,4 +115,14 @@ describe('OGC API Tiles tests', () => {
cy.visit("/tileMatrixSets/NetherlandsRDNewQuad");
cy.htmlvalidate();
})

it('specific tileMatrixSet (NetherlandsRDNewQuad) page should have no broken links', () => {
cy.visit('/tileMatrixSets/NetherlandsRDNewQuad')
cy.get('a').each(link => {
const href = link.prop('href')
if (href && !href.includes('example.com')) {
cy.request(href)
}
})
})
})

0 comments on commit e57c9ef

Please sign in to comment.