Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
8549654
Enhance image validation with detailed source tracking and CSS backgr…
rogoit Aug 28, 2025
78482c4
Refactor tt-get-internal-links: remove dead code, use Set instead of Map
rogoit Dec 12, 2025
dcb15c6
Refactor image validation: extract helper, fix types and Cypress chai…
rogoit Dec 12, 2025
058c828
Clean up isInternal: remove unused parameter
rogoit Dec 12, 2025
31b5a9b
Update package-lock.json
rogoit Dec 12, 2025
1c43250
Update devDependencies to latest versions
rogoit Dec 12, 2025
de8f53c
Add engines field and update peer dependencies
rogoit Dec 12, 2025
8026ec2
Enable TypeScript declarations for library
rogoit Dec 12, 2025
0d67bef
Add .nvmrc and .editorconfig
rogoit Dec 12, 2025
e3dfc7d
Remove duplicate commands.js
rogoit Dec 12, 2025
4b4b62c
Remove duplicate e2e.js
rogoit Dec 12, 2025
633a5cb
Remove duplicate index.js
rogoit Dec 12, 2025
70be496
Remove monolithic validate.cy.ts
rogoit Dec 12, 2025
c021c3f
Add accessibility test
rogoit Dec 12, 2025
9d24da2
Add links tests
rogoit Dec 12, 2025
45c4858
Add image validation test
rogoit Dec 12, 2025
7cfa809
Add content tests
rogoit Dec 12, 2025
258becf
Add SEO test
rogoit Dec 12, 2025
c6dbd2e
Add security tests
rogoit Dec 12, 2025
1647ee8
Add UI tests
rogoit Dec 12, 2025
1ed2204
Add error tests
rogoit Dec 12, 2025
008c216
Split language tests into separate file
rogoit Dec 13, 2025
daaed42
Fix unused runnable parameter in e2e.ts
rogoit Dec 13, 2025
bf9472f
Fix then() return in tt-click-if-element-exist.ts
rogoit Dec 13, 2025
e618c04
Fix then() return in tt-cookie-all-accept.ts
rogoit Dec 13, 2025
88c64bb
Fix then() return in tt-validate-all-images-response-status-ok.ts
rogoit Dec 13, 2025
110b175
Fix unused params in tt-validate-imprint-clickable.ts
rogoit Dec 13, 2025
eb0f513
Add description to @ts-nocheck in tt-validate-page-content.ts
rogoit Dec 13, 2025
f926958
Add return to promise chain in tt-validate-subpages-and-images.ts
rogoit Dec 13, 2025
d84c8f0
Add eslint-disable for namespace declaration in index.d.ts
rogoit Dec 13, 2025
95c8698
Fix then() return value in tt-validate-subpages-and-images.ts
rogoit Dec 13, 2025
82f5940
Add test files to ESLint ignores
rogoit Dec 13, 2025
488f1b1
Format test files with prettier
rogoit Dec 13, 2025
5457d6e
Format source files with prettier
rogoit Dec 13, 2025
33908e9
Format config files with prettier
rogoit Dec 13, 2025
34532fc
Rebuild dist
rogoit Dec 13, 2025
69b4a78
Bump version to 2.1.69
rogoit Dec 13, 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
9 changes: 9 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
52 changes: 42 additions & 10 deletions __test__/domainMapping.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import { describe, it, expect } from 'vitest'
import { autoDetectDomainMapping, applyDomainMapping, shouldIncludeUrl } from '../src/utils/domainMapping'
import {
autoDetectDomainMapping,
applyDomainMapping,
shouldIncludeUrl
} from '../src/utils/domainMapping'

describe('domainMapping', () => {
describe('autoDetectDomainMapping', () => {
const testCases = [
{
name: 'should detect nevercodealone staging pattern',
input: 'https://testingcrud.testify.projects.nevercodealone.de',
expected: { 'nevercodealone.de': 'testingcrud.testify.projects.nevercodealone.de' }
expected: {
'nevercodealone.de': 'testingcrud.testify.projects.nevercodealone.de'
}
},
{
name: 'should detect common staging patterns',
Expand Down Expand Up @@ -39,7 +45,10 @@ describe('domainMapping', () => {
{
name: 'should apply manual domain mapping',
url: 'https://example.com/page',
config: { mappings: { 'example.com': 'staging.example.com' }, autoDetectFromBaseUrl: false },
config: {
mappings: { 'example.com': 'staging.example.com' },
autoDetectFromBaseUrl: false
},
baseUrl: 'https://staging.example.com',
expected: 'https://staging.example.com/page'
},
Expand All @@ -60,7 +69,10 @@ describe('domainMapping', () => {
{
name: 'should prioritize manual mappings over auto-detection',
url: 'https://example.com/page',
config: { mappings: { 'example.com': 'custom.example.com' }, autoDetectFromBaseUrl: true },
config: {
mappings: { 'example.com': 'custom.example.com' },
autoDetectFromBaseUrl: true
},
baseUrl: 'https://staging.example.com',
expected: 'https://custom.example.com/page'
}
Expand All @@ -77,38 +89,58 @@ describe('domainMapping', () => {
describe('shouldIncludeUrl', () => {
it('should include internal URLs', () => {
const config = {}
const result = shouldIncludeUrl('/internal-page', config, 'https://example.com')
const result = shouldIncludeUrl(
'/internal-page',
config,
'https://example.com'
)
expect(result).toBe(true)
})

it('should include URLs from includedDomains', () => {
const config = {
includedDomains: ['api.example.com']
}
const result = shouldIncludeUrl('https://api.example.com/endpoint', config, 'https://example.com')
const result = shouldIncludeUrl(
'https://api.example.com/endpoint',
config,
'https://example.com'
)
expect(result).toBe(true)
})

it('should include URLs from manual mappings', () => {
const config = {
mappings: { 'production.com': 'staging.production.com' }
}
const result = shouldIncludeUrl('https://production.com/page', config, 'https://staging.production.com')
const result = shouldIncludeUrl(
'https://production.com/page',
config,
'https://staging.production.com'
)
expect(result).toBe(true)
})

it('should include URLs from auto-detected mappings', () => {
const config = {
autoDetectFromBaseUrl: true
}
const result = shouldIncludeUrl('https://nevercodealone.de/page', config, 'https://testingcrud.testify.projects.nevercodealone.de')
const result = shouldIncludeUrl(
'https://nevercodealone.de/page',
config,
'https://testingcrud.testify.projects.nevercodealone.de'
)
expect(result).toBe(true)
})

it('should exclude unrelated external URLs', () => {
const config = {}
const result = shouldIncludeUrl('https://external.com/page', config, 'https://example.com')
const result = shouldIncludeUrl(
'https://external.com/page',
config,
'https://example.com'
)
expect(result).toBe(false)
})
})
})
})
32 changes: 16 additions & 16 deletions __test__/isInternal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,29 +5,29 @@ describe('isInternal', () => {
const testCases = [
{ name: 'absolute paths are internal', url: '/page', expected: true },
{ name: 'relative paths are internal', url: 'page', expected: true },
{
name: 'URLs starting with baseUrl are internal',
url: 'https://example.com/page',
{
name: 'URLs starting with baseUrl are internal',
url: 'https://example.com/page',
baseUrl: 'https://example.com',
expected: true
expected: true
},
{
name: 'URLs not starting with baseUrl are external',
url: 'https://other.com/page',
{
name: 'URLs not starting with baseUrl are external',
url: 'https://other.com/page',
baseUrl: 'https://example.com',
expected: false
expected: false
},
{
name: 'staging vs production - staging baseUrl excludes production URLs',
url: 'https://nevercodealone.de/page',
{
name: 'staging vs production - staging baseUrl excludes production URLs',
url: 'https://nevercodealone.de/page',
baseUrl: 'https://testingcrud.testify.projects.nevercodealone.de/',
expected: false
expected: false
},
{
name: 'staging vs production - production baseUrl excludes staging URLs',
url: 'https://testingcrud.testify.projects.nevercodealone.de/page',
{
name: 'staging vs production - production baseUrl excludes staging URLs',
url: 'https://testingcrud.testify.projects.nevercodealone.de/page',
baseUrl: 'https://nevercodealone.de/',
expected: false
expected: false
}
]

Expand Down
23 changes: 16 additions & 7 deletions __test__/tt-every-internal-link-status-ok.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,12 @@ describe('ttEveryInternalLinkStatusOk', () => {
{ url: 'https://example.com/found', status: 302 }
]

const urls = testCases.map(tc => tc.url)
const urls = testCases.map((tc) => tc.url)
const responses = Object.fromEntries(
testCases.map(tc => [tc.url, { status: tc.status, headers: { 'content-type': 'text/html' } }])
testCases.map((tc) => [
tc.url,
{ status: tc.status, headers: { 'content-type': 'text/html' } }
])
)

setupTest(urls, responses)
Expand All @@ -51,8 +54,12 @@ describe('ttEveryInternalLinkStatusOk', () => {

ttEveryInternalLinkStatusOk()

expect(cy.log).toHaveBeenCalledWith('❌ Testing https://example.com/404: 404')
expect(cy.log).toHaveBeenCalledWith('⚠️ Link validation failed: https://example.com/404 returned 404')
expect(cy.log).toHaveBeenCalledWith(
'❌ Testing https://example.com/404: 404'
)
expect(cy.log).toHaveBeenCalledWith(
'⚠️ Link validation failed: https://example.com/404 returned 404'
)
})

test('skips non-HTML content', () => {
Expand All @@ -62,14 +69,16 @@ describe('ttEveryInternalLinkStatusOk', () => {

ttEveryInternalLinkStatusOk()

expect(cy.log).toHaveBeenCalledWith('⏭️ Testing https://example.com/file.pdf: Skipped (content-type: application/pdf)')
expect(cy.log).toHaveBeenCalledWith(
'⏭️ Testing https://example.com/file.pdf: Skipped (content-type: application/pdf)'
)
})

test('enforces minimum links requirement', () => {
setupTest(['url1', 'url2'], {
default: { status: 200, headers: { 'content-type': 'text/html' } }
})

cy.wrap.mockImplementation((value) => ({
its: vi.fn(() => ({
should: vi.fn((assertion, expected) => {
Expand All @@ -81,4 +90,4 @@ describe('ttEveryInternalLinkStatusOk', () => {

ttEveryInternalLinkStatusOk(5)
})
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/accessibility/accessibility.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Accessibility Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('Run accessibility tests', () => {
cy.ttAccessibility()
})
})
23 changes: 23 additions & 0 deletions cypress/e2e/content/language.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
describe('Language Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('HTML has valid lang attribute', () => {
cy.get('html')
.should('have.attr', 'lang')
.and('match', /^[a-z]{2}(-[A-Z]{2})?$/)
})

it('Lang matches page language', () => {
cy.ttValidateLanguageTag()
})

it('Lang validation rejects wrong language', () => {
cy.on('fail', (err) => {
expect(err.message).to.include('en')
return false
})
cy.ttValidateLanguageTag('en')
})
})
13 changes: 13 additions & 0 deletions cypress/e2e/content/page-content.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
describe('Page Content Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('Validate page content', () => {
cy.ttValidatePageContent()
})

it('Validate subpages and images', () => {
cy.ttValidateSubpagesAndImages()
})
})
14 changes: 0 additions & 14 deletions cypress/e2e/dsv98-links.cy.ts

This file was deleted.

11 changes: 11 additions & 0 deletions cypress/e2e/errors/console-errors.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('Console Error Tests', () => {
it('Set up console error listener', () => {
cy.visit('/console-errors/')
cy.ttSetupConsoleErrorListener()
})

it('Check if multiple css files are missing', () => {
cy.visit('/css-file-not-loading/')
cy.ttSetupConsoleErrorListener()
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/images/image-validation.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Image Validation Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('Images have OK response status', () => {
cy.ttValidateAllImagesResponseStatusOk()
})
})
17 changes: 17 additions & 0 deletions cypress/e2e/links/internal-links.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
describe('Internal Links Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('All internal links are loading', () => {
cy.ttEveryInternalLinkIsLoading()
})

it('All internal links have OK status', () => {
cy.ttEveryInternalLinkStatusOk()
})

it('Invalid path returns 404', () => {
cy.ttInvalidPath404()
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/security/google-services.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('Google Services Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('No Google services detected', () => {
cy.ttValidateNoGoogleServices()
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/security/http-detection.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('HTTP Detection Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('Detect HTTP connections', () => {
cy.ttDetectHttp()
})
})
9 changes: 9 additions & 0 deletions cypress/e2e/seo/h1-validation.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
describe('SEO Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('Only one H1 element exists', () => {
cy.ttOnlyOneH1()
})
})
11 changes: 11 additions & 0 deletions cypress/e2e/ui/cookies.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
describe('Cookie Tests', () => {
it('Accept all cookies on "alles" page', () => {
cy.visit('/alles/')
cy.ttCookieAllAcceptClick()
})

it('Accept all cookies on "alle" page', () => {
cy.visit('/alle/')
cy.ttCookieAllAcceptClick()
})
})
19 changes: 19 additions & 0 deletions cypress/e2e/ui/elements.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
describe('Element Tests', () => {
beforeEach(() => {
cy.visit('/')
})

it('Check if elements exist', () => {
cy.ttElementExists('.example-element')
})

it('Example for click and not click optional css selector', () => {
cy.visit('/alles')
cy.ttClickIfElementExist('.example-element')
cy.ttClickIfElementExist('.button')
})

it('Check threshold', () => {
cy.ttThreshold()
})
})
Loading
Loading