'Inside error occured (client side): undefinedTypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))

I am asking this from a QA point of view. I have a web application that I test with cypress.io.

When I access the localhost from outside Cypress, everything is ok. When I start the Cypress test, I get this error in the console of the browser:

Inside error occured (client side): undefinedTypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))

The code that I am executing is nothing fancy:

/// <reference types = "Cypress" />
    const constants = require("../support/constants");
    const data = require("../fixtures/muaOutput.json");
    const components = require("../support/components");

    describe('Login page', () => {
    beforeEach(() => {
        cy.visit(Cypress.env('muaUrl'));
        cy.login(data.muaEmail, data.muaPassword)
        if (cy.get(components.SAVE_BUTTON).length > 0) {
            cy.get(components.PIN_FIELD).clear().type('1234')
            cy.get(components.PIN_FIELD).clear().type('1234')
            cy.get(components.SAVE_BUTTON).click()
        } else {
            cy.contains(constants.MY_GARMENTS).should('be.visible')
        }
        sessionStorage.clear()
        cy.clearCookies()
        cy.clearLocalStorage()
    });

    it('1. Check if the title is present', () => {
        cy.contains(constants.PROFILE_TITLE).should('be.visible')
    });

    it('2. Verify elements on the home page', () => {
        cy.contains(constants.MY_GARMENTS).should('be.visible')
        cy.contains(constants.LOST_AND_FOUND).should('be.visible')

    });

    it('3. My Garments tests', () => {
        cy.get(components.MY_REPAIRS).click()
    })
})

Could this be an actual bug in the app? What is puzzling for me is that when I do these steps outside cypress, the errors do not appear in the console and everything works.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source