-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
validateLogOutputContents, tests extended with results validation, ad…
…ditional tests for negative cases (test failure and init failure) (#2774)
- Loading branch information
1 parent
c1ccca6
commit 09207e4
Showing
4 changed files
with
126 additions
and
56 deletions.
There are no files selected for viewing
83 changes: 83 additions & 0 deletions
83
test/dashboard-e2e/cypress/e2e/run-test-validate-results.cy.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/// <reference types="cypress" /> | ||
/// <reference types="@cypress/xpath" /> | ||
|
||
import TestDataHandler from '../support/data-handlers/test-data-handlers'; | ||
const testDataHandler=new TestDataHandler(); | ||
import ApiHelpers from '../support/api/api-helpers'; | ||
const apiHelpers=new ApiHelpers(Cypress.env('API_URL')); | ||
import MainPage from '../support/pages/MainPage'; | ||
const mainPage=new MainPage(); | ||
import TestExecutionsPage from '../support/pages/TestExecutionsPage'; | ||
const testExecutionsPage=new TestExecutionsPage(); | ||
|
||
|
||
function runTestFlow(testName) { | ||
const testData = testDataHandler.getTest(testName) | ||
const realTestName = testData.name | ||
let currentExecutionNumber; | ||
|
||
//prerequisites | ||
const assureTestCreated = apiHelpers.assureTestCreated(testData, false) //API helpers using async/await must be wrapped | ||
cy.wrap(assureTestCreated) | ||
.then(() => { | ||
//actions | ||
const getLastExecutionNumber = apiHelpers.getLastExecutionNumber(realTestName) | ||
cy.wrap(getLastExecutionNumber) | ||
.then((lastExecutionNumber) => { | ||
mainPage.visitMainPage() | ||
mainPage.openTestExecutionDetails(realTestName) | ||
testExecutionsPage.runTest() | ||
currentExecutionNumber = lastExecutionNumber+1 | ||
const executionName = `${realTestName}-${currentExecutionNumber}` | ||
testExecutionsPage.openExecutionDetails(executionName) //openLatestExecutionDetails? | ||
}) | ||
}) | ||
} | ||
|
||
describe('Run test with Dashboard', () => { | ||
it('Run Cypress test from git-dir', () => { | ||
runTestFlow('cypress-git-dir-created') | ||
|
||
testExecutionsPage.validateLogOutputContents('smoke-without-envs.cy.js', 60000) | ||
testExecutionsPage.validateLogOutputContents('All specs passed') | ||
|
||
//TODO: validate passed/failed icon - data-test needed | ||
}) | ||
it('Run K6 test from git-file', () => { | ||
runTestFlow('k6-git-file-created') | ||
|
||
testExecutionsPage.validateLogOutputContents('script: test/k6/executor-tests/k6-smoke-test-without-envs.js', 30000) | ||
testExecutionsPage.validateLogOutputContents('1 complete and 0 interrupted iterations') | ||
|
||
//TODO: validate passed/failed icon - data-test needed | ||
}) | ||
it('Run Postman test from git-file', () => { | ||
runTestFlow('postman-git-file-created') | ||
|
||
testExecutionsPage.validateLogOutputContents('postman-executor-smoke', 30000) | ||
testExecutionsPage.validateLogOutputContents('GET https://testkube.kubeshop.io/ [200 OK') | ||
|
||
//TODO: validate passed/failed icon - data-test needed | ||
}) | ||
}) | ||
|
||
|
||
describe('Run test with Dashboard - Negative cases', () => { | ||
it('Test results - test failure', () => { | ||
runTestFlow('postman-negative-test') | ||
|
||
testExecutionsPage.validateLogOutputContents('postman-executor-smoke', 30000) | ||
testExecutionsPage.validateLogOutputContents(`'TESTKUBE_POSTMAN_PARAM' should be set correctly to 'TESTKUBE_POSTMAN_PARAM_value' value`) | ||
testExecutionsPage.validateLogOutputContents('AssertionError') | ||
|
||
//TODO: validate passed/failed icon - data-test needed | ||
}) | ||
it.skip('Test results - test init failure', () => { // temporary disabled because of https://github.com/kubeshop/testkube/issues/2669 issue | ||
runTestFlow('postman-negative-init') | ||
|
||
testExecutionsPage.validateLogOutputContents('warning: Could not find remote branch some-non-existing-branch to clone', 30000) | ||
testExecutionsPage.validateLogOutputContents('Remote branch some-non-existing-branch not found') | ||
|
||
//TODO: validate passed/failed icon - data-test needed | ||
}) | ||
}) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters