Ocelot-Social/cypress/integration/common/I_can_see_the_following_table.js

17 lines
433 B
JavaScript

import { Then } from "@badeball/cypress-cucumber-preprocessor";
Then('I can see the following table:', table => {
const headers = table.raw()[0]
headers.forEach((expected, i) => {
cy.get('thead th')
.eq(i)
.should('contain', expected)
})
const flattened = [].concat.apply([], table.rows())
flattened.forEach((expected, i) => {
cy.get('tbody td')
.eq(i)
.should('contain', expected)
})
})