| 1 | import { When } from "@badeball/cypress-cucumber-preprocessor"; |
| 2 | import { checkEntry } from "./data_tables"; |
| 3 | |
| 4 | When( |
| 5 | "I select entry {string} in the settings data table {string}", |
| 6 | (name: string, table: string) => { |
| 7 | findEntryInTable(name, table); |
| 8 | checkEntry(name); |
| 9 | } |
| 10 | ); |
| 11 | |
| 12 | export const findEntryInTable = (name: string, table: string) => { |
| 13 | cy.dataCy("search-" + table) |
| 14 | .find("input") |
| 15 | .clear(); |
| 16 | cy.dataCy("search-" + table) |
| 17 | .find("input") |
| 18 | .should("have.value", ""); |
| 19 | cy.dataCy("search-" + table) |
| 20 | .find("input") |
| 21 | .type(name); |
| 22 | cy.dataCy("search-" + table) |
| 23 | .find("input") |
| 24 | .should("have.value", name); |
| 25 | }; |