1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-06-08 18:20:20 +00:00

fix(webjob): test coverage for _executionTasks=true requests without file upload (#883)

* test(cypress): show individual errors

* test(cypress): half the cypress integration test timeout

* test(cypress): add parallel tests, timeout and reports

* test(cypress): use allSettled instead of all

* test(runner): pre-render pending test cards
This commit is contained in:
Sead Mulahasanović
2026-05-12 09:53:11 +02:00
committed by GitHub
parent eb1186b4b9
commit 55db8f45ab
7 changed files with 259 additions and 27 deletions
+56 -14
View File
@@ -12,6 +12,58 @@ context('sasjs-tests', function () {
cy.visit(sasjsTestsUrl)
})
function waitForTestsToFinish(timeout: number) {
const deadline = Date.now() + timeout
function check() {
cy.get('tests-view', { log: false }).then(($view) => {
const shadow = ($view[0] as HTMLElement).shadowRoot
const stillRunning = !!shadow?.querySelector('#run-btn:disabled')
if (!stillRunning) return
if (Date.now() >= deadline) {
cy.log('Timed out waiting for tests to finish; reporting status')
return
}
cy.wait(2000, { log: false })
check()
})
}
check()
}
function assertNoFailedTests() {
cy.get('test-card').then(($cards) => {
const failed: string[] = []
const stuck: string[] = []
const pending: string[] = []
$cards.each((_, card) => {
const shadow = (card as HTMLElement).shadowRoot
if (!shadow) return
const icon = shadow.querySelector('.status-icon')
const title =
shadow.querySelector('.header h3')?.textContent?.trim() ?? '(unknown)'
if (icon?.classList.contains('failed')) {
const error =
shadow.querySelector('.error pre')?.textContent?.trim() ?? ''
failed.push(error ? `- ${title}\n ${error}` : `- ${title}`)
} else if (icon?.classList.contains('running')) {
stuck.push(`- ${title}`)
} else if (icon?.classList.contains('pending')) {
pending.push(`- ${title}`)
}
})
const parts: string[] = []
if (failed.length)
parts.push(`${failed.length} failed:\n${failed.join('\n')}`)
if (stuck.length)
parts.push(`${stuck.length} stuck (running):\n${stuck.join('\n')}`)
if (pending.length)
parts.push(
`${pending.length} did not start (pending):\n${pending.join('\n')}`
)
expect(parts, parts.join('\n\n')).to.be.empty
})
}
function loginIfNeeded() {
cy.get('login-form, tests-view', { timeout: 30000 }).should('exist')
@@ -42,14 +94,9 @@ context('sasjs-tests', function () {
cy.get('tests-view').shadow().find('#run-btn').should('be.visible').click()
cy.get('tests-view')
.shadow()
.find('#run-btn:disabled', {
timeout: testingFinishTimeout
})
.should('not.exist')
waitForTestsToFinish(testingFinishTimeout)
cy.get('test-card').shadow().find('.status-icon.failed').should('not.exist')
assertNoFailedTests()
})
it('Should have all tests successful with debug on', () => {
@@ -63,13 +110,8 @@ context('sasjs-tests', function () {
cy.get('tests-view').shadow().find('#run-btn').should('be.visible').click()
cy.get('tests-view')
.shadow()
.find('#run-btn:disabled', {
timeout: testingFinishTimeout
})
.should('not.exist')
waitForTestsToFinish(testingFinishTimeout)
cy.get('test-card').shadow().find('.status-icon.failed').should('not.exist')
assertNoFailedTests()
})
})