Cookie Consent by Free Privacy Policy Generator Aktuallisiere deine Cookie Einstellungen 📌 How to Target XHR Errors in Cypress


📚 How to Target XHR Errors in Cypress


💡 Newskategorie: Programmierung
🔗 Quelle: dev.to

Introduction

Hello, I am Miyazawa, an engineer at WESEEK, Inc. I usually develop GROWI, an open-source wiki. Today, I will explain how to deal with XHR errors that occur in Cypress, which is used for visual regression testing of GROWI.

Error Details

The error content introduced here is circled in red below. The screenshot shows the actual GROWI login screen.

Error

The actual Cypress code in which the error occurred is shown below. Specifically, it is a Cypress custom command to log in by going to /login, entering the user name and password registered in advance, and pressing the login button. You can code as cy.login(username, password) to use it.

Error2

Error Cause

I believe that the cause is that the user's session data was not saved properly in the browser by trying to move to a page that requires login without waiting for the /api/v3/login response that runs when the login button is pressed.

As a test, after pressing the login button (cy.get('.btnSubmitForLogin').click()), I added cy.wait(10000), and the login process was successfully performed without any XHR errors.

From the above, I realized that waiting for the response from /api/v3/login seems to be a good idea, so I will modify the code accordingly.

Solution

Cypress has an API called intercept. This API allows spying and stubbing on HTTP requests made within an application.

Since I only need to spy in this case, the code refers to the documentation. The first argument is the method name and the second argument is the URL. You can create an alias using as.If you put the alias you created into cy.wait, it will wait for /api/v3/login to complete.

Solution1

I put the above code into the custom command causing the error and it worked correctly.

Solution2

About Us💡

In addition, I want to introduce a little more about GROWI, an open software developed by us WESEEK, Inc.

GROWI is a wiki service with features-rich support for efficient information storage within the company. It also boasts high security and various authentication methods are available to simplify authentication management, including LDAP/OAuth/SAML.

GROWI originated in Japan and GROWI OSS is FREE for anyone to download and use in English.

For more information, go to GROWI.org to learn more about us. You can also follow our Facebook to see updates about our service.

GROWI.org

...



📌 How to Target XHR Errors in Cypress


📈 69.4 Punkte

📌 Mozilla Firefox 17.0 up to 21.0 XHR HEAD Request XMLHttpRequest (XHR) HEAD access control


📈 62.04 Punkte

📌 Complete Cypress Tutorial: Learn Cypress From Scratch


📈 34.38 Punkte

📌 Cypress vs. Sorry-Cypress - Decoding the Drama


📈 34.38 Punkte

📌 Mozilla Firefox up to 53.x XHR Header Use-After-Free memory corruption


📈 31.02 Punkte

📌 Mozilla Firefox bis 53.x XHR Header Use-After-Free Pufferüberlauf


📈 31.02 Punkte

📌 Trying to install Mint Cinnamon, running into errors on integrity check; usb driver errors?


📈 25.35 Punkte

📌 BLE-Kit von Cypress: IoT-Geräte schneller entwickeln


📈 17.19 Punkte

📌 Testing The Way It Should Be (aka Intro Into Cypress)


📈 17.19 Punkte

📌 Cypress Semiconductor: Product Overview and Analysis


📈 17.19 Punkte

📌 Bericht - Infineon vor Übernahme von Cypress Semiconductor


📈 17.19 Punkte

📌 Infineon will US-Konkurrenten Cypress für 9 Milliarden Euro kaufen


📈 17.19 Punkte

📌 Übernahme - Infineon kauft US-Konkurrenten Cypress um neun Milliarden Euro


📈 17.19 Punkte

📌 Infineon plant Übernahme von Cypress für 9 Milliarden Euro


📈 17.19 Punkte

📌 IT-Business - Infineon stellt Geld für Übernahme von US-Firma Cypress auf


📈 17.19 Punkte

📌 Infineon holt von Aktionären 1,55 Milliarden Euro für Cypress-Kauf


📈 17.19 Punkte

📌 Linux Kernel up to 4.9.3 hid-cypress.c cp_report_fixup denial of service


📈 17.19 Punkte

📌 EU genehmigt Cypress-Übernahme durch Infineon


📈 17.19 Punkte

📌 Cypress.io – The State of the Art End to End Testing Tool


📈 17.19 Punkte

📌 heise+ | JavaScript: Testen mit React-Tools wie Cypress und Jest


📈 17.19 Punkte

📌 Kr00k Bug in Broadcom, Cypress WiFi Chips Leaks Sensitive Info


📈 17.19 Punkte

📌 Cypress: Neue Controller für USB 4 und Thunderbolt


📈 17.19 Punkte

📌 Linux Kernel bis 4.9.3 hid-cypress.c cp_report_fixup Denial of Service


📈 17.19 Punkte

📌 Übernahme: Infineon kauft Cypress für 9 Milliarden Euro


📈 17.19 Punkte

📌 Übernahme: Infineon kauft Cypress für 9 Milliarden Euro


📈 17.19 Punkte

📌 Cypress Semiconductor: Infineon will Konkurrenten für 9 Milliarden US-Dollar kaufen


📈 17.19 Punkte

📌 Infineon übernimmt Cypress für 9 Milliarden Euro


📈 17.19 Punkte

📌 Cypress WiFi Chips Leak Sensitive Info Due To Kr00k Bug In Broadcom – Experts Insight


📈 17.19 Punkte

📌 US-Behörde empfiehlt Ablehnung der Infineon-Milliardenübernahme von Cypress


📈 17.19 Punkte

📌 Cypress Semiconductor: Trump soll Infineon-Übernahme in USA blockieren


📈 17.19 Punkte

📌 Infineon: Milliardenschwere Cypress-Übernahme könnte platzen


📈 17.19 Punkte

📌 US-Behörde genehmigte Infineons Milliarden-Übernahme von Cypress Semi


📈 17.19 Punkte

📌 Infineon erhält US-Genehmigung für Cypress-Übernahme


📈 17.19 Punkte

📌 Infineon: US-Behörde CFIUS erlaubt Cypress-Übernahme


📈 17.19 Punkte

📌 Cypress Semiconductor: Infineon darf doch US-Chiphersteller kaufen


📈 17.19 Punkte











matomo