From 5bde306ea488d1991c77a558332b5b985a4b62c5 Mon Sep 17 00:00:00 2001 From: aliraza556 Date: Tue, 19 Mar 2024 06:41:08 +0500 Subject: [PATCH] Added Cypress Test For View bounty modal --- cypress/e2e/4_openBountyModal.cy.ts | 69 +++++++++++++++++++++++++++++ cypress/support/commands.ts | 1 + src/people/utils/NameTag.tsx | 1 + 3 files changed, 71 insertions(+) create mode 100644 cypress/e2e/4_openBountyModal.cy.ts diff --git a/cypress/e2e/4_openBountyModal.cy.ts b/cypress/e2e/4_openBountyModal.cy.ts new file mode 100644 index 00000000..87a69238 --- /dev/null +++ b/cypress/e2e/4_openBountyModal.cy.ts @@ -0,0 +1,69 @@ +describe('View Bounty From Modal', () => { + const bounty: Cypress.Bounty = { + title: 'Ali Bounty', + category: 'Web development', + coding_language: ['Typescript', 'Javascript', 'Lightning'], + description: 'This is available', + amount: '844', + assign: 'carol', + deliverables: 'I can submit a pr within 2 days of taking the bounty', + tribe: '', + estimate_session_length: 'Less than 3 hour', + estimate_completion_date: '09/09/2024' + }; + + it('Should view the bounty modal after creating', () => { + const activeUser = 'alice'; + cy.login(activeUser); + cy.wait(1000); + + cy.create_bounty(bounty); + cy.wait(1000); + + cy.contains('Filter').click(); + cy.wait(600); + cy.contains('Open').click(); + cy.contains('Assigned').click(); + cy.wait(1000); + + cy.contains(bounty.title).click(); + cy.wait(1000); + + cy.get('[data-testid="owner_name"]').contains(activeUser).should('exist'); + cy.wait(1000); + + cy.contains(bounty.title).should('exist'); + cy.wait(1000); + + cy.contains(bounty.description).should('exist'); + cy.wait(1000); + + cy.contains(bounty.deliverables).should('exist'); + cy.wait(1000); + + cy.contains(bounty.assign).should('exist'); + cy.wait(1000); + + cy.contains(bounty.amount).should('exist'); + cy.wait(1000); + + cy.contains('Estimate:').should('exist'); + cy.contains('< 3 hrs').should('exist'); + cy.wait(1000); + + cy.contains('Copy Link').should('exist'); + cy.wait(600); + + cy.contains('Share to Twitter').should('exist'); + cy.wait(600); + + cy.contains('Mark as Paid').should('exist'); + cy.wait(600); + + cy.contains('Pay Bounty').should('exist'); + cy.wait(1000); + + cy.get('body').click(0, 0); + cy.logout(activeUser); + }); +}); diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index e6693269..7b6541e8 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -175,6 +175,7 @@ Cypress.Commands.add('create_bounty', (bounty, clickMethod = 'contains') => { if (bounty.assign) { cy.get('.SearchInput').type(bounty.assign); + cy.wait(1000); cy.get('.People').contains('Assign').click(); } else { cy.contains('Decide Later').click(); diff --git a/src/people/utils/NameTag.tsx b/src/people/utils/NameTag.tsx index 414920e4..80ce3eaa 100644 --- a/src/people/utils/NameTag.tsx +++ b/src/people/utils/NameTag.tsx @@ -158,6 +158,7 @@ function NameTag(props: NameTagProps) { }} > {