Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
769 views
in Technique[技术] by (71.8m points)

Phantomjs browser incorrectly computing css calc() function in Nightwatch tests

I am building Nightwatch tests (uses Phantomjs) for functioning front ends, and one of my tasks is to make sure banner images' heights are dynamic and their heights are being calculated correctly per the screen size.

I have some page elements that look something like this:

//html
<div class="bannerImg"></div>

//css
.bannerImg {
    background-image: url('someImgUrl');
    height: calc(100vh - 200); //some calculation here
    min-height: 600px; //some minimum height
}

For example, a viewport of 1080 should yield a height of 880px.

However when I run my test, Nightwatch is reporting the element's size to be 600px (essentially, bellow 600).

From my research on this, others have had other/similar difficulties with calc() and testing with the Phantom.js browser https://github.com/ariya/phantomjs/issues/13547

Is there any plans on adding support for this function?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

PhantomJS is no longer in active development, if possible you should migrate to puppeteer which was heavily inspired by PhantomJS.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...