Crossing origins is super common with sites that use third-party authentication, for example. Before, you would have to use programmatic authentication in Cypress tests, but this wasn’t indicative of how a real person would use the app. Now with cross-origin support, you no longer need to work around your login flow:
Due to how Cypress executes your tests in a browser, visiting another site was a huge technical hurdle due to cross-origin security limitations.
In Cypress 12 cy.session() included, which support out of experimental and into general availability status. Session support can tie closely with cross-origin in that you can save a user session (storage, cookies, etc.) after authentication and restore it in a subsequent test. This cuts down on overall test suite execution time as each test won’t need to go through the authentication flow.
Sample Code:
it(‘user should be able to login’, () => {
cy.visit(‘https://localhost:3000/‘);
// clicking sign in button redirects to 3rd party auth site
cy.get(‘#sign-in’).click();
cy.origin(‘auth.securewebsite.com‘, () => {
cy.get(‘input[type=”email”]’).type(‘test@test.com‘); cy.get(‘input[type=”password”]’).type(‘testpassword’, { log: false }); // clicking submit does the auth and redirects back to main site cy.get(‘input[type=”submit”]’).click();
});
// once done testing can continue
cy.contains(`Welcome Tester McTester!`); });
Read more at Cross-Origin-Testing
Witness how our meticulous approach and cutting-edge solutions elevated quality and performance to new heights. Begin your journey into the world of software testing excellence. To know more refer to Tools & Technologies & QA Services
Happy Automated Testing 🙂
FAQ
What are software testing services?
Software testing includes a wide range of services such as Performance and Load Testing, Web Testing, Regression Testing, Accessibility Testing, Unit Testing, Localization Testing, Usability Testing, Exploratory Testing, and User Acceptance Testing. It also includes, Functionality Testing, Mobile Application Testing, API Testing, UI Testing, and Compatibility & Security Testing Services.
Why do you need to test your software for quality assurance?
Software testing ensures the product’s quality and the satisfaction of customers and users. Additionally, it promises enhanced user experience, reliability, and better business optimization (reduced maintenance expense).
How do quality assurance and testing differ?
Organisations need help understanding both quality assurance and software testing because both aim to create bug-free, functional applications. Software testing involves techniques and procedures to find software bugs; quality assurance is a process to ensure that the project complies with the stakeholders’ expectations.
As the Founder & CEO of JigNect Technologies (www.jignect.tech), I specialize in providing cutting-edge software testing solutions. With over 12 years of experience in Software Testing (QA), I have honed my skills and expertise in ensuring the quality and reliability of software products. Additionally, I am a certified SAFe® 5 Practitioner, further demonstrating my commitment to implementing Agile and Lean practices in software development. With a deep understanding of the industry and a passion for delivering exceptional results, I lead my team at JigNect Technologies to provide top-notch software testing services to our clients.