Added links to re-run the suites containing a failing spec

[Finishes #25508053]
This commit is contained in:
Steve Gravrock
2017-12-18 16:51:41 -08:00
parent ef9f82a17d
commit d742ada71d
5 changed files with 90 additions and 13 deletions

View File

@@ -395,7 +395,6 @@ describe("HtmlReporter", function() {
var specLink = spec.childNodes[0];
expect(specLink.innerHTML).toEqual("with a spec");
expect(specLink.getAttribute("href")).toEqual("?foo=bar&spec=A Suite with a spec");
// expect(specLink.getAttribute("title")).toEqual("A Suite with a spec");
});
it("has an options menu", function() {
@@ -922,6 +921,14 @@ describe("HtmlReporter", function() {
reporter.initialize();
reporter.jasmineStarted({ totalSpecsDefined: 1 });
reporter.suiteStarted({
id: 1,
description: "A suite"
});
reporter.suiteStarted({
id: 2,
description: "inner suite"
});
var passingResult = {id: 123, status: "passed", passedExpectations: [{passed: true}], failedExpectations: []};
reporter.specStarted(passingResult);
@@ -931,7 +938,7 @@ describe("HtmlReporter", function() {
id: 124,
status: "failed",
description: "a failing spec",
fullName: "a suite with a failing spec",
fullName: "a suite inner suite a failing spec",
passedExpectations: [],
failedExpectations: [
{
@@ -942,6 +949,9 @@ describe("HtmlReporter", function() {
};
reporter.specStarted(failingResult);
reporter.specDone(failingResult);
reporter.suiteDone({});
reporter.suiteDone({});
reporter.suiteDone({});
reporter.jasmineDone({});
});
@@ -960,10 +970,6 @@ describe("HtmlReporter", function() {
var specDiv = failure.childNodes[0];
expect(specDiv.getAttribute("class")).toEqual("jasmine-description");
var specLink = specDiv.childNodes[0];
expect(specLink.getAttribute("title")).toEqual("a suite with a failing spec");
expect(specLink.getAttribute("href")).toEqual("?foo=bar&spec=a suite with a failing spec");
var message = failure.childNodes[1].childNodes[0];
expect(message.getAttribute("class")).toEqual("jasmine-result-message");
expect(message.innerHTML).toEqual("a failure message");
@@ -973,6 +979,24 @@ describe("HtmlReporter", function() {
expect(stackTrace.innerHTML).toEqual("a stack trace");
});
it('provides links to focus on a failure and each containing suite', function() {
var description = container.querySelector('.jasmine-failures .jasmine-description');
var links = description.querySelectorAll('a');
expect(description.textContent).toEqual('A suite > inner suite > a failing spec');
expect(links.length).toEqual(3);
expect(links[0].textContent).toEqual('A suite');
expect(links[0].getAttribute('href')).toMatch(/\?foo=bar&spec=A suite/);
expect(links[1].textContent).toEqual('inner suite');
expect(links[1].getAttribute('href')).toMatch(/\?foo=bar&spec=A suite inner suite/);
expect(links[2].textContent).toEqual('a failing spec');
expect(links[2].getAttribute('href')).toMatch(/\?foo=bar&spec=a suite inner suite a failing spec/);
});
it("allows switching between failure details and the spec summary", function() {
var menuBar = container.querySelectorAll(".jasmine-bar")[1];