Cypress · Middle · Question 65 of 77

How do you test geolocation-based features in Cypress?

Show the answer

Correct answer: Stub navigator.geolocation in onBeforeLoad

Explanation

Stubbing getCurrentPosition to call back with fixed coordinates makes the test deterministic.

Further reading

Problem with a question

Cypress · Middle · question 65

Test yourself

Take the Cypress · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz