I am having a problem to test AGM. Stores should be shown on the map. I have mocked the store location I want to select like this
cy.visit(url, {
failOnStatusCode: failOnStatusCode, onBeforeLoad(win: Cypress.AUTWindow) {
cy.stub(win.navigator.geolocation, 'getCurrentPosition').callsFake((cb) => {
return cb({coords: {latitude, longitude}});
});
}
})
But the geolocation does not function every time. Sometimes it works, sometimes not. In this state, I can not run the tests in a pipeline.