Skip to content

Commit

Permalink
Tweak content pages and sitemap tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brianzelip committed Jan 21, 2025
1 parent 14b99b6 commit 7e7aa92
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
4 changes: 3 additions & 1 deletion cypress/e2e/content-pages.cy.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
describe('Content pages', () => {
it('show the sidebar, table of contents, and footer meta and pagination sections', () => {
it('show the sidebar, table of contents, and appropriate footer sections', () => {
cy.visit('/architecture/jsonmodel')
const firstPage = cy.url()
cy.get('#starlight__sidebar')
Expand All @@ -9,6 +9,7 @@ describe('Content pages', () => {
cy.get('footer p').contains('Last updated: ')
cy.get('footer a').contains('Previous')
cy.get('footer a').contains('Next').click()
cy.get('footer').contains('Built with Starlight').should('not.exist')

cy.url() !== firstPage
cy.get('#starlight__sidebar')
Expand All @@ -18,5 +19,6 @@ describe('Content pages', () => {
cy.get('footer p').contains('Last updated: ')
cy.get('footer a').contains('Previous')
cy.get('footer a').contains('Next')
cy.get('footer').contains('Built with Starlight').should('not.exist')
})
})
16 changes: 5 additions & 11 deletions cypress/e2e/sitemap.cy.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
const indexPath = '/sitemap-index.xml'

describe('Sitemap', () => {
if (Cypress.env('MODE') === 'production') {
it('assets are present', () => {
cy.request('/sitemap-index.xml')
cy.request(indexPath)
cy.request('/sitemap-0.xml')
})
}

it('is linked from each page', () => {
cy.visit('/')
cy.get("link[rel='sitemap']").should(
'have.attr',
'href',
'/sitemap-index.xml'
)
cy.get("link[rel='sitemap']").should('have.attr', 'href', indexPath)

cy.visit('/architecture/jsonmodel')
cy.get("link[rel='sitemap']").should(
'have.attr',
'href',
'/sitemap-index.xml'
)
cy.get("link[rel='sitemap']").should('have.attr', 'href', indexPath)
})
})

0 comments on commit 7e7aa92

Please sign in to comment.