-
I have a problem in github ci, it cannot find the alias, and think it even doesn't define that, but all is well on local. I tested on both cypress:open and cypress:run this is the command I defiend: Cypress.Commands.add("byPassLogin", () => {
const url = Cypress.env("api_url");
const token = "...";
cy.saveToLocalStorage("auth_token", token);
cy.intercept("POST", url, (req) => {
if (req.body.operationName === "me") {
req.reply({
statusCode: 200,
body: {
data: {
me: { id: "1", email: "test@email.com" },
},
},
});
}
}).as("byPassLogin");
}); and then I used it on describe("test account functionality", () => {
const URL = Cypress.env("api_url");
beforeEach(() => {
cy.visit("/");
cy.byPassLogin();
});
it.only("should logout when click on nav bar", () => {
cy.intercept("POST", URL, (req) => {
if (req.body.operationName === "signOut") {
req.reply({
statusCode: 200,
body: {
data: { updateUser: { errors: null, user: { id: "1" } } },
},
});
}
}).as("signOut");
cy.wait("@byPassLogin").then(() => {
cy.url().should("include", "/app");
cy.get("#account").click();
cy.get("#logout").click();
cy.wait("@signOut").then(() => {
cy.url().should("include", "/login");
});
});
});
});
error on github
any help would be appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
This is not possible to reproduce without a repository that can be shared. Effectively, aliases which is something isolated to the runner works, but when the runner is in CI it does not. This is highly unlikely and we have to see it not working to help. |
Beta Was this translation helpful? Give feedback.
-
Thanks @muratkeremozcan I succeed to manage the issue, to finding the issue I used a workflow similar to this to record my testing in That's it. |
Beta Was this translation helpful? Give feedback.
Thanks @muratkeremozcan
I succeed to manage the issue, to finding the issue I used a workflow similar to this to record my testing in
dashboard.cypress.io
, then I found it does not post form data to the correct endpoint URL, actually since the URL has been defined in env I needed to define it in CI as well.That's it.
It was working since I had the env in local.