From eee85c231b71f96bc6b012c3973d4a0388a7bc14 Mon Sep 17 00:00:00 2001 From: daro-maj <119658839+daro-maj@users.noreply.github.com> Date: Thu, 23 Feb 2023 11:16:22 +0100 Subject: [PATCH] test(trading): improved a dropdown verification test (#2969) --- .github/workflows/cypress-live-test.yml | 6 ++++-- apps/trading-e2e/src/integration/markets.cy.ts | 14 ++++++++++---- apps/trading-e2e/src/integration/navbar.cy.ts | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cypress-live-test.yml b/.github/workflows/cypress-live-test.yml index 68d9bc457..8b9426db1 100644 --- a/.github/workflows/cypress-live-test.yml +++ b/.github/workflows/cypress-live-test.yml @@ -18,9 +18,11 @@ jobs: - name: Checkout uses: actions/checkout@v2 - - uses: actions/setup-node@v3 + - name: Use Node.js 16 + id: Node + uses: actions/setup-node@v2 with: - node-version: 16 + node-version: 16.15.1 - name: Run Cypress tests uses: cypress-io/github-action@v4 diff --git a/apps/trading-e2e/src/integration/markets.cy.ts b/apps/trading-e2e/src/integration/markets.cy.ts index 5a8baf735..e4c1a321d 100644 --- a/apps/trading-e2e/src/integration/markets.cy.ts +++ b/apps/trading-e2e/src/integration/markets.cy.ts @@ -4,6 +4,7 @@ import { marketsQuery } from '@vegaprotocol/mock'; import { getDateTimeFormat } from '@vegaprotocol/react-helpers'; const dialogCloseBtn = 'dialog-close'; +const popoverTrigger = 'popover-trigger'; describe('markets table', { tags: '@smoke' }, () => { beforeEach(() => { @@ -173,8 +174,13 @@ describe('markets table', { tags: '@smoke' }, () => { }); function openMarketDropDown() { - cy.getByTestId(dialogCloseBtn).should('be.visible'); - cy.getByTestId(dialogCloseBtn).click(); - cy.getByTestId('popover-trigger').click(); - cy.contains('Loading market data...').should('not.exist'); + cy.getByTestId(dialogCloseBtn).then((button) => { + if (button.is(':visible')) { + cy.get('[data-testid^="market-link-"]').should('not.be.empty'); + cy.getByTestId(dialogCloseBtn).click(); + cy.get('[data-testid^="ask-vol-"]').should('be.visible'); + cy.getByTestId(popoverTrigger).click({ force: true }); + cy.contains('Loading market data...').should('not.exist'); + } + }); } diff --git a/apps/trading-e2e/src/integration/navbar.cy.ts b/apps/trading-e2e/src/integration/navbar.cy.ts index c3c1b0c28..d489775b8 100644 --- a/apps/trading-e2e/src/integration/navbar.cy.ts +++ b/apps/trading-e2e/src/integration/navbar.cy.ts @@ -1,6 +1,6 @@ import { mockConnectWallet } from '@vegaprotocol/cypress'; -beforeEach(() => { +before(() => { cy.mockTradingPage(); cy.mockSubscription(); cy.visit('/');