https://cypress.io logo
Asynchronous writing and getting values in variabl...
# i-need-help
a
Greetings. I have needs that I don't understand how to solve without using a big .then() schema. First need: Get a csrf token and PHPSESSID so that they can be used in further test steps for API requests; The second need is to store the values of the elements on page A, perform actions that will transfer to page B, compare values, perform actions that will transfer to page C and compare the values from page A there. I have read the following articles: https://glebbahmutov.com/cypress-examples/commands/connectors.html#cypress-commands-inside-the-callback https://docs.cypress.io/guides/core-concepts/introduction-to-cypress#Mixing-Async-and-Sync-code But unfortunately, I don't understand how I can write the code in such a way that it works, and in the future it would be possible to write sections into user-defined functions and reuse them in other files. I am attaching a file with an attempt to solve the first need. I get CSRF and PHPSESSID, but at the time of sending the request (and I need to make more than 10 of them), the variables do not have the necessary data. Please help me understand this code.
g
Find my blog post about CSRF testing via https://cypress.tips/search
a
Thanks, I'll take a look. I'll try to realize
4 Views