Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test never fails if test starts with Cypress.Promise #28016

Closed
huseyin-tumer opened this issue Oct 10, 2023 · 4 comments
Closed

Test never fails if test starts with Cypress.Promise #28016

huseyin-tumer opened this issue Oct 10, 2023 · 4 comments
Labels
stale no activity on this issue for a long period

Comments

@huseyin-tumer
Copy link

Current behavior

I am having issue when running test on Cypress.

My test function following is failing but the test status is passed. This happens if the test test starts with Cypress.Promise command. Could you please help?

    it('test 1', () => {
        new Cypress.Promise((resolve) => {
            resolve('ok')
        }).then((response) => {
            cy.visit('www.google.com')
            cy.get('x')
        })
    })

image

Note: it is working truly if the test not stars with Cypress.Promise command like below.

it('test 1', () => {
        cy.request('www.google.com').then((response) => {
            new Cypress.Promise((resolve) => {
                resolve('ok')
            }).then((question) => {
                cy.get('x')
            })
        })
    })

Desired behavior

No response

Test code to reproduce

/// <reference types="cypress" />
describe('New Test', () => {

    it('test 1', () => {
        new Cypress.Promise((resolve) => {
            resolve('ok')
        }).then((response) => {
            cy.visit('www.google.com')
            cy.get('x')
        })
    })

    it('test 2', () => {
        new Cypress.Promise((resolve) => {
            resolve('ok')
        }).then((response) => {
            cy.visit('www.google.com')
            cy.get('x')
        })
    })

})

Cypress Version

13.3.0

Node version

v16.15.0

Operating System

macOS Ventura 13.6

Debug Logs

No response

Other

No response

@MikeMcC399
Copy link
Contributor

@huseyin-tumer

I'm not experienced with Cypress.Promise however it looks like the documenation https://docs.cypress.io/api/utilities/promise#Rejected-test-promises-do-not-fail-tests
covers your case. You might like to check it out.

@huseyin-tumer
Copy link
Author

@MikeMcC399 thanks for comment, but it did not worked :(

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Apr 8, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period
Projects
None yet
Development

No branches or pull requests

3 participants