Skip to content

Intermittent failures in data upload tests (e.g., B.3.16) #83

@kileyyeaman

Description

@kileyyeaman

I noticed that many of the data import tests fail intermittently (e.g., B.3.16). I am working off the 15.5.7 branch of redcap_cypress right now for a 15.5.20 revalidation.

I am not sure if the intermittent failures are still a problem, but if it is, I think it might be related to these lines in commands/data_imports.js:

    cy.top_layer(label_selector).within(() => {
        if(nearest_text.length > 0) {
            upload_element = cy.get_labeled_element(upload_selector, nearest_text).first()
        } else {
            upload_element = cy.get(selector)
        }

        upload_element.selectFile(filePath)
        
        if(button_label !== '') {
            upload_element.closestIncludingChildren(submit_button_selector).click()
        }
    })

I spent some time trying to debug and from what I have discovered, Cypress documentation notes that you cannot assign return values of any Cypress command (including cy.get()), to constants/variables due to it's asynchronous nature. (See the first code chunk near the top of the page for an explanation). So I think lines such as the one below could potentially be causing intermittent failures:

upload_element = cy.get_labeled_element(upload_selector, nearest_text).first()

Unfortunately I don't have the bandwidth this week to refactor this and make a PR, as I see it relies on some functions in commands/base.js. If it continues to be an issue I can possibly contribute in the future. I am new to the Cypress framework, so if I am way off base on this, feel free to ignore. Just wanted to give a heads up! :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions