-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Closed
Labels
pkg/driverThis is due to an issue in the packages/driver directoryThis is due to an issue in the packages/driver directorytype: featureNew feature that does not currently existNew feature that does not currently exist
Description
Proposal: Command that is essentially a retryable .then
Example:
const getTable = id => cy.get(`[data-testid=${id}`)
const getColumnNames = $el => Array.from($el.find('[role=columnheader]')).map(el => el.innerText)
getTable('identifier')
.then(getColumnNames) // The `should` doesn't cause this to re-evaluate
.should('deep.equal', ['Column One', 'Column Two'])
The getTable
will get an element given a test id and getColumnNames
will get the text contents of a table's column headers. If the table's column headers aren't statically known (maybe column order is a user preference), the assertion immediately fails.
I don't think we want .then
to retry. I think it is good that .then
has strong guarantees that it will only be run once. It just makes composition of functions not quite fit.
There could be another command that does re-run if there is an assertion:
getTable('identifier')
.pipe(getColumnNames) // The `should` would cause re-evaluation
.should('deep.equal', ['Column One', 'Column Two'])
Metadata
Metadata
Assignees
Labels
pkg/driverThis is due to an issue in the packages/driver directoryThis is due to an issue in the packages/driver directorytype: featureNew feature that does not currently existNew feature that does not currently exist