red-toddler-79937
06/17/2022, 12:19 AMred-toddler-79937
06/17/2022, 12:19 AMred-toddler-79937
06/17/2022, 1:00 AMred-toddler-79937
06/17/2022, 1:01 AMred-toddler-79937
06/17/2022, 1:17 AMbored-baker-20372
06/17/2022, 3:35 AMbreezy-area-11544
06/17/2022, 6:46 AMvisit/
CypressError
cy.visit() failed trying to load:
https://gaspedaal.nl/
The response we received from your web server was:
> 403: Forbidden
This was considered a failure because the status code was not 2xx.
If you do not want status codes to cause failures pass the option: failOnStatusCode: false
Because this error occurred during a before all hook we are skipping the remaining tests in the current suite: Smoke tests flow`
bitter-apple-86316
06/17/2022, 6:50 AMadorable-stone-42197
06/17/2022, 7:14 AMnutritious-honey-65632
06/17/2022, 8:17 AMcy.get('@something').then(res => {
myArray.push(res)
})
breezy-area-11544
06/17/2022, 8:46 AMbreezy-area-11544
06/17/2022, 8:47 AMcy.visit({
url: "https://www.gaspedaal.nl/",
headers: {
"user-agent": "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
},
});`
But it still fails. I don't know what else to do. Someone please helpbreezy-area-11544
06/17/2022, 8:47 AMred-toddler-79937
06/17/2022, 9:14 AMred-toddler-79937
06/17/2022, 9:14 AMred-toddler-79937
06/17/2022, 9:15 AMpolite-alarm-78904
06/17/2022, 9:31 AMitem-approved-${id}
).should("be.visible")`
This returns the detached element. How can I wait for the element to render before trying to make assertions?
It randomly worked once when I added a timeout, but its not consistent.nutritious-honey-65632
06/17/2022, 9:35 AM@token
inside function, pass the token as the function parameterfresh-doctor-14925
06/17/2022, 9:39 AMcy.getBySel(item-approved-${id})
.should("be.visible")
.and(...)
But if that's asserting on the detached element, you could do a second get
once the element is in the desired state. That's how I've gotten past detachment issues in the past. Would be interested to know if there's a better way
cy.getBySel(item-approved-${id})
.should("be.visible")
.getBySel(item-approved-${id})
.doStuff()
red-toddler-79937
06/17/2022, 9:40 AMred-toddler-79937
06/17/2022, 9:40 AMred-toddler-79937
06/17/2022, 9:44 AMBearer ${token}
},
body: { isAvailable: state }
});
}
```Is this what you meant?nutritious-honey-65632
06/17/2022, 9:47 AMred-toddler-79937
06/17/2022, 9:48 AMred-toddler-79937
06/17/2022, 9:48 AMred-toddler-79937
06/17/2022, 9:49 AMfresh-doctor-14925
06/17/2022, 10:00 AMcy.get()
here isn't correct. @loginResponse
is aliased to the intercept itself, rather than what is intercepted. Also, not sure you need to verify that the response code is 200. Cypress will do that under the hood. Try:
cy.wait('@loginResponse')
.its('response.body.data').then(token => {
// do stuff with token
});
red-toddler-79937
06/17/2022, 10:06 AMred-toddler-79937
06/17/2022, 10:07 AMsetTogglState
inside the .then()
of login()
but I need to use it multiple times in my code.fresh-doctor-14925
06/17/2022, 10:31 AM