cypress matcher modified

This commit is contained in:
Moriz Wahl 2020-01-10 10:22:16 +01:00
parent 8c7079cf81
commit e6f1672067

View File

@ -1,6 +1,6 @@
import { When, Then } from "cypress-cucumber-preprocessor/steps"; import { When, Then } from "cypress-cucumber-preprocessor/steps";
When("I search for {string}", value => { When("I search for {string}", value => {
cy.get("[data-test=search-field]") cy.get("[data-test='search-field']")
.focus() .focus()
.type(value); .type(value);
}); });
@ -16,7 +16,7 @@ Then("the search has no results", () => {
expect($li).to.have.length(1); expect($li).to.have.length(1);
}); });
cy.get(".ds-select-dropdown").should("contain", 'Nothing found'); cy.get(".ds-select-dropdown").should("contain", 'Nothing found');
cy.get("[data-test=search-field]") cy.get("[data-test='search-field']")
.focus() .focus()
.type("{esc}"); .type("{esc}");
}); });
@ -35,21 +35,21 @@ Then("I should see the following users in the select dropdown:", table => {
}); });
When("I type {string} and press Enter", value => { When("I type {string} and press Enter", value => {
cy.get("[data-test=search-field]") cy.get("[data-test='search-field']")
.focus() .focus()
.type(value) .type(value)
.type("{enter}", { force: true }); .type("{enter}", { force: true });
}); });
When("I type {string} and press escape", value => { When("I type {string} and press escape", value => {
cy.get("[data-test=search-field]") cy.get("[data-test='search-field']")
.focus() .focus()
.type(value) .type(value)
.type("{esc}"); .type("{esc}");
}); });
Then("the search field should clear", () => { Then("the search field should clear", () => {
cy.get("[data-test=search-field]").should("have.text", ""); cy.get("[data-test='search-field']").should("have.text", "");
}); });
When("I select a post entry", () => { When("I select a post entry", () => {