winterstein / sogive-app

The SoGive user app - See your impact
Other
2 stars 5 forks source link

Wrap serverSafetyCheck in beforeAll async await #207

Closed anitawoodruff closed 4 years ago

anitawoodruff commented 4 years ago

Without this I was getting the following errors when running some tests in headless mode:

net::ERR_ABORTED at http://local.sogive.org
Error: Execution context was destroyed, most likely because of a navigation.
Error: Navigation failed because browser has disconnected!

..I think because the page navigation in the first test was occurring before this check had completed. (Whereas headless mode (or the setViewPort in editor tests) slowed it down enough this check completed.)

Adding the beforeAll async await sorted it out.

Checked that when ServerIO.APIBASE is set to prod the check still successfully aborts before any tests are run.

winterstein commented 4 years ago

Thanks @anitawoodruff Hello @dodo721 - Can I pass this to you for test & merge?

anitawoodruff commented 4 years ago

Never mind - I see the serverSafetyCheck was obsoleted by https://github.com/good-loop/wwappbase.js/commit/c3c778223fc9c86498ecd91377feff5e1ed537c4 and there's a PR in progress to fix up the SoGive tests - I'll rebase on that instead

(am writing a new puppeteer test for the editor dashboard in prep for adding an 'Upload Editorials' button there).