From 3614b4f1d970756adaf16eb151f492798ccb1b90 Mon Sep 17 00:00:00 2001 From: MahtabBukhari Date: Tue, 19 Mar 2024 03:01:32 +0500 Subject: [PATCH] cypress unit test for view assigned bounties to a user --- cypress/e2e/28_viewAssignedBounties.cy.ts | 48 +++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 cypress/e2e/28_viewAssignedBounties.cy.ts diff --git a/cypress/e2e/28_viewAssignedBounties.cy.ts b/cypress/e2e/28_viewAssignedBounties.cy.ts new file mode 100644 index 00000000..8d2101d9 --- /dev/null +++ b/cypress/e2e/28_viewAssignedBounties.cy.ts @@ -0,0 +1,48 @@ +describe('View User Assigned Bounties', () => { + let activeUser = 'carol'; + + const bounty: Cypress.Bounty = { + title: 'Syed Bounty', + category: 'Web development', + coding_language: ['Typescript', 'Javascript', 'Lightning'], + description: 'This is available', + amount: '123', + tribe: 'Amazing Org Tribe', + estimate_session_length: 'Less than 3 hour', + estimate_completion_date: '09/09/2024', + deliverables: 'We are good to go man', + assign: 'alice' + }; + + beforeEach(() => { + cy.login(activeUser); + cy.wait(1000); + }); + + it('Should create three bounties and assigned to a user', () => { + for (let i = 1; i <= 3; i++) { + const updatedBounty = { ...bounty, title: `Syed Bounty${i}` }; + cy.create_bounty(updatedBounty); + cy.wait(1000); + } + + cy.visit('http://localhost:3007/p'); + cy.wait(1000); + + cy.get('input').type('alice'); + cy.wait(1000); + + cy.contains('alice').click(); + cy.wait(1000); + + cy.contains('Assigned Bounties').click(); + cy.wait(1000); + + for (let i = 1; i <= 3; i++) { + cy.contains(`Syed Bounty${i}`, { timeout: 10000 }).should('exist'); + } + + cy.get('body').click(0, 0); + cy.logout(activeUser); + }); +});