Загрузка...

Confirm The Table Columns Order

Imagine we have a table with multiple columns. We don't need to check every column, but we want to confirm that there are three columns "Users", "Items", and "Projects" in that order. We can extract all column heading cells, grab the text from each one, then filter out all columns we are NOT interested in. The remaining 3 columns string array must be in the expected order.

const getTexts = function ($el) {
return Cypress._.map($el, 'innerText')
}
// the list of columns we are looking for
const target = ['Users', 'Items', 'Projects']
cy.get('table thead th')
.then(getTexts)
// filter the array
// confirm each column title we need is present
// and they are in the expected order
.should('deep.equal', target)

Find the full recipe at https://glebbahmutov.com/cypress-examples

Видео Confirm The Table Columns Order канала gleb bahmutov
Яндекс.Метрика
Все заметки Новая заметка Страницу в заметки
Страницу в закладки Мои закладки
На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.
О CookiesНапомнить позжеПринять