cypress-documentation
                                
                                 cypress-documentation copied to clipboard
                                
                                    cypress-documentation copied to clipboard
                            
                            
                            
                        cy.url() is an empty string after a redirect
Description
When I'm testing the login flow via keycloak, the webpage would redirect to a url on localhost and when I try to get the current url using cy.url(), I'm getting an empty string.
URL of Issue(s)
N/A
Steps to replicate
- Start an oauth login flow, specifically keycloak.
- Use the correct username and password.
- Expect to be redirected to a callback url on your local/test server.
- Get redirected to an actual page like /home. Or manually callcy.visit('/home').
- Test that the cy.url()contains/home.
Browser
Chromium 129
Device
- [X] PC
- [ ] Mac
- [ ] iPhone
- [ ] iPad
- [ ] Android Phone
- [ ] Android Tablet
Additional Information
The test body:
    const email = Cypress.env("username"),
      password = Cypress.env("password");
    cy.visit("/login");
    cy.get("#username").type(email);
    cy.get("#password").type(password);
    cy.contains("Sign In").click();
    cy.visit("/console");
    cy.url().should("match", /.*(\/console|\/teamspace\/create).*/);
Here's the screenshot starting from last third line of the test.