jQuery Form Serialize Array Method

Published: 09 January 2023
on channel: gleb bahmutov
1,694
19

You can invoke the jQuery method "serializeArray" when working with a form element in Cypress. You can quickly validate all input values at once
cy.get('form')
.invoke('serializeArray')
.should('deep.equal', [
{
name: 'a',
value: '1',
},
....
])
See https://api.jquery.com/serializeArray/ and this recipe at https://glebbahmutov.com/cypress-exam...