It's mentioned in the documentation mentioned in the comment section, I recommend reading it. Speficially Specifically, you can read this part about closures.
What you can do is to put the other cy.get()
inside the first one:
cy
.get('...')
.then($today => {
cy
.get('...')
.then($tomorrow => {
// you have access to both $today and $tomorrow
});
});
cy
.get('...')
.then($today => {
cy
.get('...')
.then($tomorrow => {
// you have access to both $today and $tomorrow
});
});
I shortened the code (e.g. didn't use the long selectors) in order to focus on the main point.