maciejmaciejewski / azure-pipelines-protractor

Embed Protractor HTML report in Azure Pipelines
MIT License
3 stars 3 forks source link

TypeError: Cannot read property 'includes' of undefined #20

Open Wikbake opened 3 years ago

Wikbake commented 3 years ago

Hello,

As in the title I got an error from the screenshot below. If there isn't any screenshot in the test results folder, the Protractor tab loads correctly.

image

Logs:

##[debug]loaded 23
##[debug]Agent.ProxyUrl=undefined
##[debug]Agent.CAInfo=undefined
##[debug]Agent.ClientCert=undefined
##[debug]Agent.SkipCertValidation=undefined
New version has been released, please find change log at https://github.com/maciejmaciejewski/azure-pipelines-protractor/releases
##[debug]cwd=/home/vsts/work/1/s/test-results/auto-generated/protractor-result
##[debug]/home/vsts/work/1/s/test-results/auto-generated/protractor-result
##[debug]Processed: ##vso[task.addattachment name=002c007c-00e7-00d2-00e2-004e00610099.png;type=protractor.screenshot;]/home/vsts/work/1/s/test-results/auto-generated/protractor-result/screenshots/002c007c-00e7-00d2-00e2-004e00610099.png
##[debug]Processed: ##vso[task.addattachment name=00630068-0050-0032-003c-0033003c00ca.png;type=protractor.screenshot;]/home/vsts/work/1/s/test-results/auto-generated/protractor-result/screenshots/00630068-0050-0032-003c-0033003c00ca.png
##[debug]Agent.JobName=Job
##[debug]System.StageDisplayName=__default
##[debug]System.StageAttempt=1
##[debug]tabName=Protractor
##[debug]Processed: ##vso[task.addattachment name=Protractor.job.__default.1.fcbf1ec98e557f329440a9a7e7e53f0c;type=protractor.report;]/home/vsts/work/1/s/test-results/auto-generated/protractor-result/combined.json
Finishing: Prepare display of the test results

My reporter setup:

const beautifulReporter = new BeautifulReporter({
            baseDirectory: autoGeneratedFolderName + '/protractor-result',
            screenshotsSubfolder: 'screenshots',
            jsonsSubfolder: 'jsons',
            takeScreenShotsOnlyForFailedSpecs: true,
            docName: 'report.html',
            preserveDirectory: true
        });
        jasmine.getEnv().addReporter(beautifulReporter.getJasmine2Reporter());

Chrome console: image

If I change this: const tc = contentJSON.find((x) => x.screenShotFile.includes(screenshot.name)); to this: const tc = contentJSON.find((x) => x.screenShotFile === screenshot.name);

it doesn't show the screenshots but loads somehow. What is more, if I will try to open the "missing" image in a new tab I get: image

maciejmaciejewski commented 3 years ago

Hi @Wikbake Thank you for detailed descritpion. Your issue looks exactly as #19 can we agree to to close this one and keep it there?

Wikbake commented 3 years ago

Sure

maciejmaciejewski commented 3 years ago

@Wikbake Actually I will stick to this issue for the further investigation. I have checked my example report and it loads correctly so I cannot reproduce this issue locally. From the task logs I can see that 2 reports are uploaded, however script cannot find screenShotFile property in the json report file. Which version of the reporter do you use?

Wikbake commented 3 years ago

I'm using 1.1.2

maciejmaciejewski commented 3 years ago

@Wikbake The current version is 1.3.6, whereas 1.1.2 has been released on 13 Feb 2018 and I have a feeling that the structure of json file has changed and now causing parsing issues. Could you please update your reporter version and get back to me with the results.

Wikbake commented 3 years ago

Where can I find that version? Everywhere I'm looking it's 1.1.2.

On Marketplace: https://marketplace.visualstudio.com/items?itemName=MaciejMaciejewski.azure-pipelines-protractor&targetId=f9dc9493-375a-45d8-8dae-4f181b115a9d&utm_source=vstsproduct&utm_medium=ExtHubManageList image On your github: image Also Azure DevOps says it's latest: image

maciejmaciejewski commented 3 years ago

Sorry for misunderstanding. I was asking for the version of the reporter that generates the report for your protector. Please check your package.json file.

Wikbake commented 3 years ago

Aaah, my bad. It's indeed 1.3.6.

maciejmaciejewski commented 3 years ago

Can you please confirm if your combined.json file contains escaped data like

"[{\"description\":\"tc1\",\"passed\":true,\"pending\":false,\"os\":\"Linux\",\"instanceId\":103,\"browser\":{\"name\":\"chrome\",\"version\":\"80.0.3987.122\"},\"message\":\"Passed\",\"browserLogs\":[],\"screenShotFile\":\"screenshots/003f008c-0043-00ce-00a1-004d00450024.png\",\"timestamp\":1603111108768,\"duration\":22},
Wikbake commented 3 years ago

Confirmed, it looks generally like that:

"[{\"description\":\"xxx\",\"passed\":false,\"pending\":false,\"os\":\"linux\",\"sessionId\":\"xxx\",\"instanceId\":6,\"browser\":{\"name\":\"chrome\",\"version\":\"86.0.4240.75\"},\"message\":[\"xxx\",\"xxx\",\"xxx\"],\"trace\":[\"xxx\"],\"browserLogs\":[{\"level\":\"SEVERE\",\"message\":\"xxx\",\"timestamp\":1602587587374,\"type\":\"\"}],\"screenShotFile\":\"screenshots/00630068-0050-0032-003c-0033003c00ca.png\",\"timestamp\":1602587585630,\"duration\":221984},
tcukanoot commented 2 years ago

Getting the same error, is this ticket still being worked on, or is there a solution available? Thanks in advance image image

SteveHindmarsh commented 2 years ago

Hi, I am also receiving this error and see no solution been provided to this issue (issue 19 as mentioned is not resolved either?). Am I missing something? A link to a workaround perhaps?