https://cypress.io logo
Waiting with cy.wait
# i-need-help
l
Good morning, I need to wait until my Transaction gets executed and the data is in the BlockChain, so once I send the click appears one spinner and takes up to 10 seconds until the message of
Congrats your HBAR has been sent successfully
appear, I'm using
cy.wait(10000)
is there any other way to do this?
Copy code
js
cy.getBySel('confirm-transaction').click();
      // Waiting for the transaction to be registered in Hedera
      // eslint-disable-next-line cypress/no-unnecessary-waiting
      cy.wait(10000);
      cy.contains('¡Tus HBAR se han enviado con éxito!').should('be.visible');
a
cy.get(spinner).should(not.exist) will put a wait on your spinner clearing, then you can test that the confirmation should exist. You can put a long timeout option value on the spinner confirmation.
Also read up on cy.intercept so you can wait on the HTTP request instead of the UI. That might also work well.
e
I usually throw an intercept in to wait for a 200 back and then verify any confirmation in the UI.
c
Also try for cy.waituntil() & wait for locator for this msg "Congrats your HBAR has been sent successfully" then proceed further in execution
l
Thanks you
Btw is there any way
To copy directly a value instead of writing the numbers / letters 1 by 1?
I'm having problems with
Copy code
js
cy.get('[placeholder="Supply Key"]').type(Cypress.env('SUPPLY_KEY'));
Since It has 80 characteres the SUPPLY_KEY
Does
.type()
has any limit of characteres?
@adorable-smartphone-87280 @echoing-tent-95037 @colossal-table-38461
a
No limit I’m aware of. I usually copy/paste element selectors directly out of the page HTML using the browser inspector.
l
I think It does because with 80 characteres doesn't work and I'm missing last one
But with 70 works for example
m
Could it be a front end limit? The data you are seeing on the front end of the application was probably sent from the backend and there was no limit from the backend side so that's why cypress can't type anymore due to the front end limit. Just guessing this because I don't think .type() should have a limit (QA perspective)
l
Nope, my aplication run everything in Front End and If I use in my aplication without Cypress works fine
Even If I type manually
Or If in the test I add later more letters works fine also
m
I see
Got it, thx for the update
l
Np