Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Wikbake opened this issue Oct 13, 2020 · 12 comments
Open

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

Wikbake opened this issue Oct 13, 2020 · 12 comments

Comments

@Wikbake
Copy link

Wikbake commented Oct 13, 2020

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
Copy link
Owner

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
Copy link
Author

Wikbake commented Oct 14, 2020

Sure

@maciejmaciejewski
Copy link
Owner

@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
Copy link
Author

Wikbake commented Oct 19, 2020

I'm using 1.1.2

@maciejmaciejewski
Copy link
Owner

@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
Copy link
Author

Wikbake commented Oct 19, 2020

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
Copy link
Owner

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
Copy link
Author

Wikbake commented Oct 19, 2020

Aaah, my bad. It's indeed 1.3.6.

@maciejmaciejewski
Copy link
Owner

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
Copy link
Author

Wikbake commented Oct 21, 2020

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
Copy link

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

@SteveHindmarsh
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants