From b509e5b347bb1e06b7148cc458474b4ab011ed19 Mon Sep 17 00:00:00 2001 From: Joe Tsang <30622993+jtsang586@users.noreply.github.com> Date: Wed, 2 Aug 2023 16:37:55 +0100 Subject: [PATCH] test(explorer): e2e proposal test (#4379) Co-authored-by: Matthew Russell --- .../src/integration/proposal.cy.js | 46 +++++++++++++++++++ apps/trading/.env.mainnet | 2 +- 2 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 apps/explorer-e2e/src/integration/proposal.cy.js diff --git a/apps/explorer-e2e/src/integration/proposal.cy.js b/apps/explorer-e2e/src/integration/proposal.cy.js new file mode 100644 index 000000000..46225c5da --- /dev/null +++ b/apps/explorer-e2e/src/integration/proposal.cy.js @@ -0,0 +1,46 @@ +context('Proposal page', { tags: '@smoke' }, function () { + describe('Verify elements on page', function () { + const proposalHeading = 'proposals-heading'; + const dateTimeRegex = + /(\d{1,2})\/(\d{1,2})\/(\d{4}), (\d{1,2}):(\d{1,2}):(\d{1,2})/gm; + const proposalTitle = 'Add Lorem Ipsum market'; + + before('Create market proposal', function () { + cy.visit('/'); + cy.createMarket(); + }); + + it('Able to view proposal', function () { + cy.navigate_to('governanceProposals'); + cy.getByTestId(proposalHeading).should('be.visible'); + // get first proposal in list + cy.get('[row-index="0"]').within(() => { + cy.get_element_by_col_id('title').should('have.text', proposalTitle); + cy.get_element_by_col_id('type').should('have.text', 'NewMarket'); + cy.get_element_by_col_id('state').should('have.text', 'Enacted'); + cy.getByTestId('vote-progress').should('be.visible'); + cy.get('[col-id="cDate"]') + .invoke('text') + .should('match', dateTimeRegex); + cy.get('[col-id="eDate"]') + .invoke('text') + .should('match', dateTimeRegex); + cy.getByTestId('external-link') + .should('have.attr', 'href') + .and('contains', 'https://governance.fairground.wtf/proposals/'); + cy.contains('View terms').should('exist').click(); + }); + cy.getByTestId('dialog-title').should('have.text', proposalTitle); + cy.get('.language-json').should('exist'); + }); + + it('Proposal page displayed on mobile', function () { + cy.common_switch_to_mobile_and_click_toggle(); + cy.navigate_to('governanceProposals', true); + cy.getByTestId(proposalHeading).should('be.visible'); + cy.get('[row-index="0"]').within(() => { + cy.get_element_by_col_id('title').should('have.text', proposalTitle); + }); + }); + }); +}); diff --git a/apps/trading/.env.mainnet b/apps/trading/.env.mainnet index 1e8df7ff6..c3168a19e 100644 --- a/apps/trading/.env.mainnet +++ b/apps/trading/.env.mainnet @@ -20,4 +20,4 @@ NX_APP_VERSION=v0.20.21-core-0.71.6 NX_SUCCESSOR_MARKETS=false NX_STOP_ORDERS=false # NX_ICEBERG_ORDERS -# NX_PRODUCT_PERPETUALS \ No newline at end of file +# NX_PRODUCT_PERPETUALS