Below is mine scenario where in one scenario I'm getting data from page and saving it in a variable as alias. tHen I want to use same variable/data in other scenario to put in an input field.I'm using Alias but getting this error.
cy.wait() could not find a registered alias for: @Orderinfo. You have not aliased anything yet.
Even it alliased properly. Data stores in @Orderinfo but not accessable in other sceanrio step.
Then("Get Data from page", () => {
cy.get(".os-order-number").invoke("text").then(($Oid) => {
let Order = $Oid.text();
let Order_id = Order.replace(/[^0-9]/g, "");
cy.wrap(Order_id).as("Orderinfo");
});
});
Given("Go to Login", () => {
cy.visit("https://dev.simplifyshopping.com/register/");
});
When("Paste variable here", () => {
cy.wait(2000);
cy.wait("@Orderinfo")
cy.get("@Orderinfo")).then((Orderinfo) => {
console.log(Orderinfo);
cy.get("#id_email").type(Orderinfo);
});
});