From 1ab87dea3078a0295120ad9a925f3e6ee8f82668 Mon Sep 17 00:00:00 2001 From: Matthias Kretschmann Date: Thu, 11 Jul 2019 23:13:19 +0200 Subject: [PATCH] fix faucet test --- client/src/routes/Faucet.tsx | 1 + cypress/integration/faucet.spec.js | 15 ++++++++++++--- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/client/src/routes/Faucet.tsx b/client/src/routes/Faucet.tsx index d52a066..a177458 100644 --- a/client/src/routes/Faucet.tsx +++ b/client/src/routes/Faucet.tsx @@ -101,6 +101,7 @@ class Faucet extends PureComponent<{}, FaucetState> { primary onClick={() => this.getTokens(this.context.requestFromFaucet)} disabled={!this.context.isLogged} + name="Faucet" > Request Ether diff --git a/cypress/integration/faucet.spec.js b/cypress/integration/faucet.spec.js index 3a93c48..7cbe57f 100644 --- a/cypress/integration/faucet.spec.js +++ b/cypress/integration/faucet.spec.js @@ -3,18 +3,27 @@ context('Faucet', () => { before(() => { cy.visit('/faucet') // Wait for end of loading - cy.get('button', { timeout: 60000 }).should('have.length', 1) + cy.get('button[name="Faucet"]', { timeout: 60000 }).should( + 'have.length', + 1 + ) + }) + + beforeEach(() => { + cy.get('button[name="Faucet"]') + .first() + .as('button') }) it('Faucet button is clickable when user is connected.', () => { - cy.get('button') + cy.get('@button') .contains('Request Ether') .should('not.be.disabled') }) it('Execute faucet call', () => { // Execute call - cy.get('button') + cy.get('@button') .contains('Request Ether') .click() // Verify that we got response from server