mstdmstd
1 month ago
299
0
Testing

How with cypress get ID of inserted row in CRUD testing?

Posted 1 month ago by mstdmstd

Using cypress("@vue/cli-plugin-e2e-cypress": "~4.2.0") in @vue/cli 4.0.5 app I make CRUD opearitions and adding new category :

    cy.get('#parent_id').select('1')


    cy.get('section.submit_form_category')
        .get('button.submit_button_category')
        .click()  // by submitting new category was added on server

    cy.url()
        .should('include', '/admin/categories/edit/')

    cy.contains('Edit category')

    cy.get('section.submit_form_category')
        .get('a.cancel_button_category')
        .click()


    cy.url()
        .should('include', '/admin/categories')
    cy.contains('Categories')  // opened listing of categories 

Next I need to delete this row and for this I need to get ID of a new category created above. If there is a way to make it ?

Thanks!

Please sign in or create an account to participate in this conversation.