Skip to content

Commit

Permalink
Expanding test failures if there are 15 or less (#1307)
Browse files Browse the repository at this point in the history
* Expanding test failures if there are 15 or less

* Updating cypress test
  • Loading branch information
craigatk committed Apr 20, 2024
1 parent 3687795 commit a66ae28
Show file tree
Hide file tree
Showing 4 changed files with 367 additions and 4 deletions.
8 changes: 5 additions & 3 deletions ui/cypress/e2e/failed_tests.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,19 @@ describe("test run with failed test cases", () => {
cy.getCodeText().should("contain", "System err line 1");
});

it("should show test cases collapsed initially when 6 failed test cases", () => {
it("should show test cases collapsed initially when 20 failed test cases", () => {
const publicId = "321908";

const testCaseIndexes = [1, 2, 3, 4, 5, 6];
const testCaseIndexes = [
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
];

cy.intercept("GET", `run/${publicId}/summary`, {
fixture: "test_run_summary.json",
});

cy.intercept("GET", `run/${publicId}/cases/failed`, {
fixture: "failed_test_cases_6.json",
fixture: "failed_test_cases_20.json",
});

cy.interceptTestRunBasicRequests(publicId);
Expand Down
322 changes: 322 additions & 0 deletions ui/cypress/fixtures/failed_test_cases_20.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
[
{
"idx": 1,
"test_suite_idx": 1,
"name": "should fail1",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec1",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec1.should fail1(FailingSpec1.groovy:8)\n"
}
},
{
"idx": 2,
"test_suite_idx": 1,
"name": "should fail2",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec2",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied2:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure2",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec2.should fail2(FailingSpec2.groovy:8)\n"
}
},
{
"idx": 3,
"test_suite_idx": 1,
"name": "should fail3",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec3",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec3.should fail1(FailingSpec3.groovy:8)\n"
}
},
{
"idx": 4,
"test_suite_idx": 1,
"name": "should fail4",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec4",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec4.should fail1(FailingSpec4.groovy:8)\n"
}
},
{
"idx": 5,
"test_suite_idx": 1,
"name": "should fail5",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec5",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec5.should fail1(FailingSpec5.groovy:8)\n"
}
},
{
"idx": 6,
"test_suite_idx": 1,
"name": "should fail6",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec6",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 7,
"test_suite_idx": 1,
"name": "should fail7",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec7",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 8,
"test_suite_idx": 1,
"name": "should fail8",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec8",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 9,
"test_suite_idx": 1,
"name": "should fail9",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec9",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 10,
"test_suite_idx": 1,
"name": "should fail10",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec10",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 11,
"test_suite_idx": 1,
"name": "should fail11",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec11",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 12,
"test_suite_idx": 1,
"name": "should fail1",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec12",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 13,
"test_suite_idx": 1,
"name": "should fail13",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec13",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 14,
"test_suite_idx": 1,
"name": "should fail14",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec14",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 15,
"test_suite_idx": 1,
"name": "should fail15",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec15",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 16,
"test_suite_idx": 1,
"name": "should fail16",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec16",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 17,
"test_suite_idx": 1,
"name": "should fail17",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec17",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 18,
"test_suite_idx": 1,
"name": "should fail18",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec18",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 19,
"test_suite_idx": 1,
"name": "should fail19",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec19",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
},
{
"idx": 20,
"test_suite_idx": 1,
"name": "should fail20",
"package_name": "projektor.example.spock",
"class_name": "FailingSpec20",
"duration": 0.237,
"passed": false,
"has_system_out": true,
"has_system_err": true,
"failure": {
"failure_message": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n",
"failure_type": "org.spockframework.runtime.SpockComparisonFailure",
"failure_text": "Condition not satisfied:\n\n1 \u003d\u003d 2\n |\n false\n\n\tat projektor.example.spock.FailingSpec6.should fail1(FailingSpec6.groovy:8)\n"
}
}
]
3 changes: 2 additions & 1 deletion ui/src/TestCase/TestCaseFailurePanelList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import CleanLinkText from "../Link/CleanLinkText";
import { makeStyles } from "@material-ui/core/styles";

const showFullFailureMaxFailureCount = 5;
const expandAllFailuresCount = 15;

interface TestCaseFailurePanelListProps {
failedTestCases: TestCase[];
Expand Down Expand Up @@ -37,7 +38,7 @@ const TestCaseFailurePanelList = ({
const classes = useStyles({});

const initialExpandCollapseState =
failedTestCases.length <= showFullFailureMaxFailureCount
failedTestCases.length <= expandAllFailuresCount
? ExpandCollapseState.EXPAND_ALL
: ExpandCollapseState.COLLAPSE_ALL;
const [expandCollapseAll, setExpandCollapseState] =
Expand Down
Loading

0 comments on commit a66ae28

Please sign in to comment.