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

Nullpointer Excpetion while trying to create gspec file using new feature Spec Generator in Release 2.4 #597

Open
arulrajbt opened this issue Nov 16, 2018 · 9 comments
Labels

Comments

@arulrajbt
Copy link

Getting Nullpointer exception while calling the method generateSpecSections with PageSpecGenerationResult object as a parameter.

java.lang.NullPointerException
at com.galenframework.generator.model.GmPageSpec.lambda$null$51(GmPageSpec.java:75)
at com.galenframework.generator.PageItemNode.visitTree(PageItemNode.java:80)
at com.galenframework.generator.PageItemNode.visitTree(PageItemNode.java:82)
at com.galenframework.generator.model.GmPageSpec.lambda$create$52(GmPageSpec.java:61)
at java.util.ArrayList.forEach(Unknown Source)
at com.galenframework.generator.model.GmPageSpec.create(GmPageSpec.java:61)
at com.galenframework.generator.SpecGenerator.generateSpecSections(SpecGenerator.java:228)

@ishubin
Copy link
Member

ishubin commented Nov 19, 2018

Could you please provide clear steps to reproduce? Even better - could you please share the sample project?

@arulrajbt
Copy link
Author

I would like to generate a spec file automatically using the 'Spec Generator' feature in 2.4 by passing the PageDump json file as an input.

But i'm getting Null pointer exception while calling the method generateSpecSections in SpecGenerator.

Please help me here.

@ishubin
Copy link
Member

ishubin commented Nov 29, 2018

It is not really clear how to reproduce this issue. Could you please share the pagedump and exact command that reproduces this issue?

@arulrajbt
Copy link
Author

Attached the pagedump json file for reference.

page.zip

Command that throws Nullpointer exception
specGenerator.generateSpecSections(result)

@arulrajbt
Copy link
Author

Please let me know if you need any other details

@ishubin
Copy link
Member

ishubin commented Dec 5, 2018

Thanks for the sample file! I did manage to reproduce. Now all I need is to find some time and fix it.

@arulrajbt
Copy link
Author

Thank you ishubin.

May i know the issue behind this please.

@ishubin
Copy link
Member

ishubin commented Dec 5, 2018

I have pushed a fix in the master branch. Tomorrow will try to make a minor release once I fix another issue.
I couldn't reproduce this issue with my own simplified page dump. But in your example it was failing on these two elements fleethome-ourapproach-container and fleethome-ourapproach-container-img.
Maybe the reason is that they are located off-screen as fleethome-ourapproach-container was located with -8 left position, but I am not sure

@shankar4a1
Copy link

Hi Team,
I am encountering the similar issue when am trying to generate spec file. I have attached log below. Can some one please help. Have attached page dump in zip format

galen generate "LayoutTest/galen-sample-tests-master/dumps/homepage/page.json" --export "LayoutTest/galen-sample-tests-master/specs/homePageNew.gspec" --no-galen-extras
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.get(String)" because "jsonTree" is null
at com.galenframework.GalenMain.execute(GalenMain.java:60)
at com.galenframework.GalenMain.main(GalenMain.java:78)
Caused by: java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.JsonNode.get(String)" because "jsonTree" is null
at com.galenframework.generator.PageItemJsonMapper.loadItems(PageItemJsonMapper.java:31)
at com.galenframework.generator.SpecGenerator.generate(SpecGenerator.java:39)
at com.galenframework.actions.GalenActionGenerate.execute(GalenActionGenerate.java:42)
at com.galenframework.GalenMain.execute(GalenMain.java:58)
... 1 more
homepage.zip

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

No branches or pull requests

3 participants