I'm using Karma with Jasmine configured with the PhantomJS browser as detailed in browser section of Karma's config docs.
I'm testing a scroll behavior in the page by inspecting the $('body,html').scrollTop()
value.
This works fine in Chrome. However, in PhantomJS the window size seems to be growing to be the size of the document. From their docs, working with viewport and scrollPosition requires direct phantomJS WebPage API usage.
Is there a way in Karma spec scripts to access the PhantomJS page object?
A Karma contributor basically says in this this Github Issue to not use Karma for integration-level tests that would require dealing with the page
variable.
vojtajina commented 3 months ago
You can't access
page
variable - the Angular scenario runner tests run IN THE BROWSER and there is nopage
variable.The
page
variable is available in the phantomjs script (that you write to control the phantomjs browser). If you wanna use PhantomJS and its DSL for writing high level tests, just use PhantomJS without Angular scenario runner.
vojtajina commented 3 months ago
Nope, just use PhantomJS without Karma. Karma is for unit testing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With