Merge pull request 'test(excel): guard that discarding a failed upload clears the red cells' (#427) from fix/122-discard-excel-clears-red-cells into release/7.22
Reviewed-on: #427
This commit was merged in pull request #427.
This commit is contained in:
commit
2ee3c2241b
1 file changed
+40
@@ -419,6 +419,46 @@ context('excel tests: ', function () {
|
||||
})
|
||||
})
|
||||
|
||||
it('26 | Discarding an upload that fails validation clears the red cells', () => {
|
||||
openTableFromTree(libraryToOpenIncludes, 'mpe_x_test')
|
||||
|
||||
// The loaded table's row count is what the grid must return to - the
|
||||
// preview replaces the data source with the parsed file.
|
||||
cy.get('h4.editor-title', { timeout: longerCommandTimeout })
|
||||
.invoke('text')
|
||||
.should('match', /\(\d+ rows?/)
|
||||
.then((titleBefore) => {
|
||||
const rowsBefore = titleBefore.match(/\(([\d,]+) rows?/)?.[1]
|
||||
|
||||
attachExcelFile('mixed_content_excel.xlsx', () => {
|
||||
// The preview paints the cells that fail validation red - the state
|
||||
// the user is looking at when they decide to abandon the file.
|
||||
cy.get('#hotTable .htInvalid', {
|
||||
timeout: longerCommandTimeout
|
||||
}).should('have.length.greaterThan', 0)
|
||||
|
||||
cy.get('.buttonBar .btn-upload-preview.btn-outline-danger').click()
|
||||
cy.get('clr-modal .modal-footer .btn-success-outline').click()
|
||||
|
||||
// Back to the loaded table, with no red cells left over. cancelEdit
|
||||
// re-runs the HOT validation after restoring the data; without that
|
||||
// the invalid cell meta survives the restore and the grid stays red.
|
||||
cy.get('h4.editor-title', { timeout: longerCommandTimeout }).should(
|
||||
'contain.text',
|
||||
`(${rowsBefore} rows`
|
||||
)
|
||||
|
||||
cy.get('#hotTable .htInvalid').should('not.exist')
|
||||
|
||||
// And the page is back in its normal read-only state, not the
|
||||
// preview's button bar.
|
||||
cy.get('.btnCtrl .btn-primary', {
|
||||
timeout: longerCommandTimeout
|
||||
}).should('contain.text', 'Edit')
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
// Large files break Cypress
|
||||
|
||||
// it ('? | Uploads Excel with size of 5MB', (done) => {
|
||||
|
||||
Reference in new issue
Block a user