yext / answers-search-ui

Answers Javascript API Library for building Search experiences.
Other
22 stars 7 forks source link

install `serve` before starting acceptance tests to reduce spurious failures #1760

Closed oshi97 closed 2 years ago

oshi97 commented 2 years ago

In our testcafe's appCommand we run npx serve to serve our html fixtures. But we don't have serve as a dep, so npx automatically installs it. Unfortunately that takes time which eats into our "appInitDelay" of 4000ms. We have appInitDelay set to 4000 and pageRequestTimeout set to 8000, which gives testcafe what I believe to be 12seconds to install and start up serve. From my testing these are the only two config options that matter here.

If we install serve before starting testcafe things go much more smoothly.

Originally I was concerned about the -l tcp://0.0.0.0:9999 port we use as opposed to just specifying the port with -p 9999, but there seems to be no issue there upon further investigation.

I also removed testcafe-browser-provider-browserstack as a general dependency, and only install it before running the browserstack acceptance tests. This is a huge dependency and includes random things browserstack uses like jimp, which is an image processing library. Removing this dependency seems to speed up npm ci by about 20 seconds, from 50->30.

J=SLAP-2100 TEST=manual

used this branch to test my hypotheses https://github.com/yext/answers-search-ui/pull/1759

coveralls commented 2 years ago

Coverage Status

Coverage remained the same at 61.548% when pulling 46c0a9d0785f3e861d9f40683dedd7247c7789e8 on dev/fix-acceptance-tests-appinitdelay into b50a7eb482fda0ebfd74f98eddd9455c2313ae85 on develop.