Use $_SESSION (php) with Cypress.io

Viewed 256

I have spent so many hours without finding an answer, so I think I misunderstand something really basic.

I have a PHP site where I save the user ID as a session ($_SESSION). And now I am trying to built a test environment with Cypress.io.

But the session value is empty all the time, even if I log in to every test.

The test I am trying to run:

it("Can fill the form", () => {
  cy.visit("http://localhost:8888/logout.php");
  cy.clearCookie('*****');
  cy.get("form");
  cy.visit('http://localhost:8888/login.php');
  cy.get('.input-group:nth-child(1) > .form-control').type('****');
  cy.get('.input-group:nth-child(2) > .form-control').type('****');
  cy.get('.btn').click(); 
  cy.contains('ready');
  cy.get('[data-cy=cy-menu-settings]').click();

  });

When the click happens a new site will show up, but no $_SESSION on user ID, and it gives many errors.

What I am understanding wrong here?

Thank you

0 Answers
Related