-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(test) Adding functional test for repo flaky tests (#190)
- Loading branch information
Showing
3 changed files
with
87 additions
and
22 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
functional-test/cypress/fixtures/grouped-failing-tests-with-git.json
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,20 @@ | ||
{ | ||
"groupedTestSuites": [ | ||
{ | ||
"groupName": "Group1", | ||
"groupLabel": "unitTest", | ||
"directory": "/test/unit", | ||
"testSuitesBlob": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<testsuite name=\"projektor.example.spock.FailingSpec\" tests=\"2\" skipped=\"0\" failures=\"2\" errors=\"0\" timestamp=\"2019-10-01T13:15:44\" hostname=\"Craigs-MacBook-Pro.local\" time=\"0.125\">\r\n <properties/>\r\n <testcase name=\"should fail\" classname=\"projektor.example.spock.FailingSpec\" time=\"0.119\">\r\n <failure message=\"Condition not satisfied: 1 == 2 | false \" type=\"org.spockframework.runtime.SpockComparisonFailure\">Condition not satisfied:\r\n\r\n1 == 2\r\n |\r\n false\r\n\r\n\tat projektor.example.spock.FailingSpec.should fail(FailingSpec.groovy:8)\r\n</failure>\r\n </testcase>\r\n <testcase name=\"should fail with output\" classname=\"projektor.example.spock.FailingSpec\" time=\"0.006\">\r\n <failure message=\"Condition not satisfied: actual == 3 | | 1 false \" type=\"org.spockframework.runtime.SpockComparisonFailure\">Condition not satisfied:\r\n\r\nactual == 3\r\n| |\r\n1 false\r\n\r\n\tat projektor.example.spock.FailingSpec.should fail with output(FailingSpec.groovy:22)\r\n</failure>\r\n </testcase>\r\n <system-out><![CDATA[A line in the given block\r\nAnother line in the given block\r\nA line in the when block\r\nA line in the then block\r\n]]></system-out>\r\n <system-err><![CDATA[]]></system-err>\r\n</testsuite>\r\n" | ||
} | ||
], | ||
"metadata": { | ||
"git": { | ||
"repoName": "flaky-org/flaky-repo", | ||
"branchName": "main", | ||
"projectName": null, | ||
"isMainBranch": true | ||
}, | ||
"ci": true | ||
}, | ||
"wallClockDuration": null | ||
} |
45 changes: 45 additions & 0 deletions
45
functional-test/cypress/integration/repository_flaky_tests.spec.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,45 @@ | ||
/// <reference types="Cypress" /> | ||
|
||
context("repository timeline", () => { | ||
it("displays flaky tests in repository", () => { | ||
const orgPart = Math.random().toString(36).substr(2, 7); | ||
const repoPart = "flaky-tests-repo"; | ||
const repoName = `${orgPart}/${repoPart}`; | ||
|
||
cy.readFile("cypress/fixtures/grouped-failing-tests-with-git.json").then( | ||
(resultsBlob) => { | ||
resultsBlob.metadata.git.repoName = repoName; | ||
|
||
cy.loadGroupedFixtureData(resultsBlob, ""); | ||
} | ||
); | ||
|
||
cy.readFile("cypress/fixtures/grouped-failing-tests-with-git.json").then( | ||
(resultsBlob) => { | ||
resultsBlob.metadata.git.repoName = repoName; | ||
|
||
cy.loadGroupedFixtureData(resultsBlob, ""); | ||
} | ||
); | ||
|
||
cy.readFile("cypress/fixtures/grouped-failing-tests-with-git.json").then( | ||
(resultsBlob) => { | ||
resultsBlob.metadata.git.repoName = repoName; | ||
|
||
cy.loadGroupedFixtureData(resultsBlob, ""); | ||
} | ||
); | ||
|
||
cy.getByTestId("nav-link-repository").click(); // From the test run page | ||
|
||
cy.getByTestId("nav-link-repo-flaky-tests").click(); // From the repo page | ||
|
||
cy.getByTestId("repository-flaky-tests-table"); | ||
|
||
cy.getByTestId("flaky-test-case-name-1").should( | ||
"contain", | ||
"projektor.example.spock.FailingSpec" | ||
); | ||
cy.getByTestId("flaky-test-case-failure-count-1").should("contain", "3"); | ||
}); | ||
}); |
44 changes: 22 additions & 22 deletions
44
functional-test/cypress/integration/repository_timeline.spec.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 |
---|---|---|
@@ -1,33 +1,33 @@ | ||
/// <reference types="Cypress" /> | ||
|
||
context("repository timeline", () => { | ||
it("displays test run over time for the repository", () => { | ||
const orgPart = Math.random().toString(36).substr(2, 7); | ||
const repoPart = "timeline-repo"; | ||
const repoName = `${orgPart}/${repoPart}`; | ||
it("displays test run over time for the repository", () => { | ||
const orgPart = Math.random().toString(36).substr(2, 7); | ||
const repoPart = "timeline-repo"; | ||
const repoName = `${orgPart}/${repoPart}`; | ||
|
||
cy.readFile("cypress/fixtures/grouped-passing-tests-with-git.json").then( | ||
(resultsBlob) => { | ||
resultsBlob.metadata.ci = true; | ||
resultsBlob.metadata.git.repoName = repoName; | ||
cy.readFile("cypress/fixtures/grouped-passing-tests-with-git.json").then( | ||
(resultsBlob) => { | ||
resultsBlob.metadata.ci = true; | ||
resultsBlob.metadata.git.repoName = repoName; | ||
|
||
cy.loadGroupedFixtureData(resultsBlob, ""); | ||
} | ||
); | ||
cy.loadGroupedFixtureData(resultsBlob, ""); | ||
} | ||
); | ||
|
||
cy.readFile("cypress/fixtures/grouped-passing-tests-with-git.json").then( | ||
(resultsBlob) => { | ||
resultsBlob.metadata.ci = true; | ||
resultsBlob.metadata.git.repoName = repoName; | ||
cy.readFile("cypress/fixtures/grouped-passing-tests-with-git.json").then( | ||
(resultsBlob) => { | ||
resultsBlob.metadata.ci = true; | ||
resultsBlob.metadata.git.repoName = repoName; | ||
|
||
cy.loadGroupedFixtureData(resultsBlob, ""); | ||
} | ||
); | ||
cy.loadGroupedFixtureData(resultsBlob, ""); | ||
} | ||
); | ||
|
||
cy.getByTestId("nav-link-repository").click(); // From the test run page | ||
cy.getByTestId("nav-link-repository").click(); // From the test run page | ||
|
||
cy.getByTestId("nav-link-repo-timeline").click(); // From the repo page | ||
cy.getByTestId("nav-link-repo-timeline").click(); // From the repo page | ||
|
||
cy.getByTestId("repository-timeline-graph"); | ||
}); | ||
cy.getByTestId("repository-timeline-graph"); | ||
}); | ||
}); |