0

I try to copy the value from the filed (*First name'**) then I want to find if in the list of users

But, when I type ('@value')to the serarch filed, the cypress put @value like text

enter image description here enter image description here

cy.contains('First name*').invoke('val').as('value')

cy.get('.search-wrap').first().click().type('@value','{enter}', {timeout:10000})

Almazov
  • 11
  • 2

1 Answers1

2

I'd write it like this:

cy
  .contains('First name*')
  .invoke('val')
  .should(val => {
    cy
     .get('.search-wrap')
     .first()
     .click()
     .type(`${val}{enter}`, { timeout: 10000 });
  });
pavelsaman
  • 7,399
  • 1
  • 14
  • 32