Skip to content

Implicit should 'exist' assertion is not being applied on cy.get() when other assertion. #205

@jennifer-shehane

Description

@jennifer-shehane

Using cy.get() on an element should implicitly assert existence of the element. But in my examples below, you can see that I have no element foobarbaz, the Command Log correctly logs 0 elements found, yet my explicitly written assertions (not.be.visible and not.have.class) chained off of the gotten element pass.

cy.get() should always implicitly assert existence unless there is an explicit assertion down the chain on that element asserting that it should not.exist.

Example Test Code

it("dom element doesn't have attributes", function() {
  cy.get("foobarbaz").should("not.be.visible");
  cy.get("foobarbaz").should("not.have.class", "foo");
});

Example Command Log
screen shot 2016-08-30 at 3 04 42 pm

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions