From 57e62bb0cad8198a6e64840ce3702cd6041b97de Mon Sep 17 00:00:00 2001 From: Abdul Wahab Date: Wed, 27 Mar 2024 20:20:03 +0500 Subject: [PATCH 1/2] Added Cypress test for admin pagination bounties list --- cypress/e2e/49_adminPaginationNumber.cy.ts | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 cypress/e2e/49_adminPaginationNumber.cy.ts diff --git a/cypress/e2e/49_adminPaginationNumber.cy.ts b/cypress/e2e/49_adminPaginationNumber.cy.ts new file mode 100644 index 00000000..f7d5b076 --- /dev/null +++ b/cypress/e2e/49_adminPaginationNumber.cy.ts @@ -0,0 +1,44 @@ +describe('Super Admin Pagination Bounties List', () => { + let activeUser = 'alice'; + + const bounty: Cypress.Bounty = { + title: 'Pagination 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' + }; + + beforeEach(() => { + cy.login(activeUser); + cy.wait(1000); + }); + + it('Should create 25 bounties and verify they are listed in the admin page', () => { + for (let i = 1; i <= 25; i++) { + const updatedBounty = { ...bounty, title: `Pagination Bounty ${i}` }; + cy.create_bounty(updatedBounty); + cy.wait(1000); + } + + cy.visit('http://localhost:3007/admin'); + cy.wait(3000); + + for (let i = 25; i <= 6; i--) { + cy.contains(`Pagination Bounty ${i}`, { timeout: 10000 }).should('exist'); + } + + cy.contains(/^2$/).click(); + cy.wait(1000); + + for (let i = 5; i <= 1; i--) { + cy.contains(`Pagination Bounty ${i}`, { timeout: 10000 }).should('exist'); + } + + cy.logout(activeUser); + }); +}); From 4d62e805b989ecf1a5f1269812779f3f584db6b7 Mon Sep 17 00:00:00 2001 From: Abdul Wahab Date: Thu, 28 Mar 2024 15:27:20 +0500 Subject: [PATCH 2/2] Addressed Changes --- cypress/e2e/49_adminPaginationNumber.cy.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cypress/e2e/49_adminPaginationNumber.cy.ts b/cypress/e2e/49_adminPaginationNumber.cy.ts index f7d5b076..042caa0a 100644 --- a/cypress/e2e/49_adminPaginationNumber.cy.ts +++ b/cypress/e2e/49_adminPaginationNumber.cy.ts @@ -18,8 +18,8 @@ describe('Super Admin Pagination Bounties List', () => { cy.wait(1000); }); - it('Should create 25 bounties and verify they are listed in the admin page', () => { - for (let i = 1; i <= 25; i++) { + it('Should create 22 bounties and verify they are listed in the admin page', () => { + for (let i = 1; i <= 22; i++) { const updatedBounty = { ...bounty, title: `Pagination Bounty ${i}` }; cy.create_bounty(updatedBounty); cy.wait(1000); @@ -28,14 +28,14 @@ describe('Super Admin Pagination Bounties List', () => { cy.visit('http://localhost:3007/admin'); cy.wait(3000); - for (let i = 25; i <= 6; i--) { + for (let i = 22; i <= 3; i--) { cy.contains(`Pagination Bounty ${i}`, { timeout: 10000 }).should('exist'); } cy.contains(/^2$/).click(); cy.wait(1000); - for (let i = 5; i <= 1; i--) { + for (let i = 2; i <= 1; i--) { cy.contains(`Pagination Bounty ${i}`, { timeout: 10000 }).should('exist'); }