diff --git a/cypress/e2e/0_createBounty.cy.ts b/cypress/e2e/0_createBounty.cy.ts index 4bab0b0a..db157107 100644 --- a/cypress/e2e/0_createBounty.cy.ts +++ b/cypress/e2e/0_createBounty.cy.ts @@ -1,24 +1,39 @@ describe('Alice tries to create a bounty', () => { - it('Create a bounty', () => { - let activeUser = 'alice'; - cy.login(activeUser); + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace1', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + + const bounty: Cypress.Bounty = { + workspace:'Workspace1', + title: 'My new Bounty', + category: 'Web development', + coding_language: ['Typescript', 'Javascript', 'Lightning'], + description: 'This is available', + amount: '123', + assign: 'carol', + deliverables: 'We are good to go man', + tribe: '', + estimate_session_length: 'Less than 3 hour', + estimate_completion_date: '09/09/2024' + }; + + beforeEach(() => { + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); cy.wait(1000); + }); + + it('Create a bounty', () => { - cy.create_bounty({ - title: 'My new Bounty', - category: 'Web development', - coding_language: ['Typescript', 'Javascript', 'Lightning'], - description: 'This is available', - amount: '123', - assign: 'carol', - deliverables: 'We are good to go man', - tribe: '', - estimate_session_length: 'Less than 3 hour', - estimate_completion_date: '09/09/2024' - }); + cy.create_bounty(bounty); cy.wait(1000); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/11_markAsPaid.cy.ts b/cypress/e2e/11_markAsPaid.cy.ts index d1fa3aa8..5b00987c 100644 --- a/cypress/e2e/11_markAsPaid.cy.ts +++ b/cypress/e2e/11_markAsPaid.cy.ts @@ -1,7 +1,17 @@ describe('Alice tries to Mark a Bounty as paid after creating a bounty', () => { const assignee = 'carol'; + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace8', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + + const bounty: Cypress.Bounty = { + workspace:'Workspace8', title: 'My new Bounty for unapaid user', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -14,10 +24,14 @@ describe('Alice tries to Mark a Bounty as paid after creating a bounty', () => { estimate_completion_date: '12/12/2024' }; - it('Create a bounty with an assignee then Mark as paid ', () => { - let activeUser = 'alice'; - cy.login(activeUser); + beforeEach(() => { + cy.login(workspace.loggedInAs); cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + }); + + it('Create a bounty with an assignee then Mark as paid ', () => { cy.create_bounty(bounty); cy.wait(1000); @@ -43,6 +57,6 @@ describe('Alice tries to Mark a Bounty as paid after creating a bounty', () => { // click outside the modal cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/12_markAsUnpaid.cy.ts b/cypress/e2e/12_markAsUnpaid.cy.ts index e9cacbb7..1770ebb0 100644 --- a/cypress/e2e/12_markAsUnpaid.cy.ts +++ b/cypress/e2e/12_markAsUnpaid.cy.ts @@ -1,7 +1,16 @@ describe('Alice tries to paid and unpaid a hunter after creating a bounty', () => { const assignee = 'carol'; + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace9', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + const bounty: Cypress.Bounty = { + workspace:'Workspace9', title: 'My new Bounty for unapaid user', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -14,10 +23,15 @@ describe('Alice tries to paid and unpaid a hunter after creating a bounty', () = estimate_completion_date: '09/09/2024' }; - it('Create a bounty with an assignee then paid and unpaid the user', () => { - let activeUser = 'alice'; - cy.login(activeUser); + beforeEach(() => { + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); cy.wait(1000); + }); + + + it('Create a bounty with an assignee then paid and unpaid the user', () => { cy.create_bounty(bounty); cy.wait(1000); @@ -48,6 +62,6 @@ describe('Alice tries to paid and unpaid a hunter after creating a bounty', () = // click outside the modal cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/15_profileCreateBounties.cy.ts b/cypress/e2e/15_profileCreateBounties.cy.ts index 48aa796b..a73d40ab 100644 --- a/cypress/e2e/15_profileCreateBounties.cy.ts +++ b/cypress/e2e/15_profileCreateBounties.cy.ts @@ -1,15 +1,29 @@ describe('Alice tries to create a bounty on the user profile page and view them', () => { - it('Create view bounties user profile page', () => { - let activeUser = 'alice'; - cy.login(activeUser); - cy.wait(1000); + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace10', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + + beforeEach(() => { + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + }); + + + it('Create view bounties user profile page', () => { - cy.contains(activeUser).click(); + cy.contains(workspace.loggedInAs).click(); cy.wait(1000); for (let i = 1; i <= 2; i++) { cy.create_bounty( { + workspace:'Workspace10', title: `Bounty Title ${i}`, category: 'Web development', coding_language: ['Typescript'], @@ -37,6 +51,6 @@ describe('Alice tries to create a bounty on the user profile page and view them' // click outside the modal cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/1_create20Bounties.cy.ts b/cypress/e2e/1_create20Bounties.cy.ts index 83b548eb..bf18385f 100644 --- a/cypress/e2e/1_create20Bounties.cy.ts +++ b/cypress/e2e/1_create20Bounties.cy.ts @@ -1,11 +1,24 @@ describe('Alice tries to create 20 bounties', () => { - it('Create 20 bounties', () => { - let activeUser = 'alice'; - cy.login(activeUser); + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace2', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + + beforeEach(() => { + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); cy.wait(1000); + }); + + it('Create 20 bounties', () => { for (let i = 1; i <= 20; i++) { cy.create_bounty({ + workspace:'Workspace2', title: `Title ${i}`, category: 'Web development', coding_language: ['Typescript'], @@ -21,6 +34,6 @@ describe('Alice tries to create 20 bounties', () => { cy.wait(1000); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/28_viewAssignedBounties.cy.ts b/cypress/e2e/28_viewAssignedBounties.cy.ts index 48d4b4e4..3d8a7e6f 100644 --- a/cypress/e2e/28_viewAssignedBounties.cy.ts +++ b/cypress/e2e/28_viewAssignedBounties.cy.ts @@ -1,7 +1,15 @@ describe('View User Assigned Bounties', () => { - let activeUser = 'carol'; + const workspace: Cypress.Workspace = { + loggedInAs: 'carol', + name: 'Workspace11', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + const bounty: Cypress.Bounty = { + workspace:'Workspace11', title: 'Syed Bounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -15,7 +23,9 @@ describe('View User Assigned Bounties', () => { }; beforeEach(() => { - cy.login(activeUser); + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); cy.wait(1000); }); @@ -43,6 +53,6 @@ describe('View User Assigned Bounties', () => { } cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/30_viewUserLoadMore.cy.ts b/cypress/e2e/30_viewUserLoadMore.cy.ts index 3f059761..0feb1b70 100644 --- a/cypress/e2e/30_viewUserLoadMore.cy.ts +++ b/cypress/e2e/30_viewUserLoadMore.cy.ts @@ -1,7 +1,14 @@ describe('Load More For Created And Assigned Bounties', () => { - let activeUser = 'carol'; + const workspace: Cypress.Workspace = { + loggedInAs: 'carol', + name: 'Workspace12', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; const bounty: Cypress.Bounty = { + workspace:'Workspace12', title: 'Syed Bounty', category: 'Web development', description: 'This is available', @@ -12,11 +19,14 @@ describe('Load More For Created And Assigned Bounties', () => { }; beforeEach(() => { - cy.login(activeUser); + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); cy.wait(1000); cy.viewport(1950, 1080); }); + it('Thirty bounties should be created and assigned to a user, and they should be visible on both sides', () => { for (let i = 1; i <= 22; i++) { const updatedBounty = { ...bounty, title: `Syed Bounty${i}` }; @@ -47,7 +57,7 @@ describe('Load More For Created And Assigned Bounties', () => { cy.contains(`Syed Bounty${i}`, { timeout: 10000 }).should('exist'); } - cy.contains(activeUser).click(); + cy.contains(workspace.loggedInAs).click(); cy.wait(1000); cy.get('[data-testid="Bounties-tab"]').click(); @@ -65,6 +75,6 @@ describe('Load More For Created And Assigned Bounties', () => { } cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/32_bountyModalNavigation.cy.ts b/cypress/e2e/32_bountyModalNavigation.cy.ts index 240e0b81..870eb44e 100644 --- a/cypress/e2e/32_bountyModalNavigation.cy.ts +++ b/cypress/e2e/32_bountyModalNavigation.cy.ts @@ -1,13 +1,27 @@ describe('Alice tries to create 8 bounties and then assert that he can go to the next and previous bounties', () => { - it('Create 8 bounties and assert next and previous bounties', () => { - let activeUser = 'alice'; - cy.login(activeUser); + + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace13', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + + beforeEach(() => { + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); cy.wait(1000); + }); + + it('Create 8 bounties and assert next and previous bounties', () => { const assignees = ['', '', '', 'carol', 'carol', 'carol', 'carol', 'carol']; for (let i = 0; i < 8; i++) { cy.create_bounty({ + workspace:'Workspace13', title: `Navigation Bounty Title ${i}`, category: 'Web development', coding_language: ['Typescript'], @@ -111,6 +125,6 @@ describe('Alice tries to create 8 bounties and then assert that he can go to the cy.wait(1000); cy.get('[data-testid="close-btn"]').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/33_workspaceBountyStatusFilter.cy.ts b/cypress/e2e/33_workspaceBountyStatusFilter.cy.ts index cafcfcf1..95bd7615 100644 --- a/cypress/e2e/33_workspaceBountyStatusFilter.cy.ts +++ b/cypress/e2e/33_workspaceBountyStatusFilter.cy.ts @@ -1,21 +1,23 @@ describe('filter by status for org bounty', () => { - it('should filter bounties according to the status selected', () => { - const workspaceName = 'E2EWorkspace3'; - - const workspace: Cypress.Workspace = { - loggedInAs: 'bob', - name: workspaceName, - description: 'A workspace focused on amazing projects.', - website: 'https://amazing.org', - github: 'https://github.com/amazing' - }; + const workspaceName = 'E2EWorkspace3'; + const workspace: Cypress.Workspace = { + loggedInAs: 'bob', + name: workspaceName, + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + + beforeEach(() => { cy.login(workspace.loggedInAs); cy.wait(1000); - cy.create_workspace(workspace); cy.wait(1000); + }); + + it('should filter bounties according to the status selected', () => { const bounty1: Cypress.Bounty = { workspace: workspaceName, title: 'Bounty1(open)', diff --git a/cypress/e2e/34_signoutPostBounty.cy.ts b/cypress/e2e/34_signoutPostBounty.cy.ts index 772d6fc4..9727ae39 100644 --- a/cypress/e2e/34_signoutPostBounty.cy.ts +++ b/cypress/e2e/34_signoutPostBounty.cy.ts @@ -1,7 +1,15 @@ describe('Signed Out Post Bounty Flow ', () => { - let activeUser = 'carol'; + + const workspace: Cypress.Workspace = { + loggedInAs: 'carol', + name: 'Workspace14', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; const bounty: Cypress.Bounty = { + workspace:'Workspace14', title: 'Syed Bounty', category: 'Web development', description: 'This is available', @@ -10,6 +18,15 @@ describe('Signed Out Post Bounty Flow ', () => { deliverables: 'We are good to go man' }; + beforeEach(() => { + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + cy.logout(workspace.loggedInAs); + cy.wait(1000); + }); + it('Validates sign-in requirements for posting a bounty, including modal display, signing in, and creating a bounty.', () => { cy.visit('http://localhost:3007/bounties'); cy.wait(1000); @@ -20,7 +37,7 @@ describe('Signed Out Post Bounty Flow ', () => { cy.contains('Sign in').click({ force: true }); cy.wait(1000); - cy.haves_phinx_login(activeUser); + cy.haves_phinx_login(workspace.loggedInAs); cy.wait(1000); cy.create_bounty(bounty); @@ -29,6 +46,6 @@ describe('Signed Out Post Bounty Flow ', () => { cy.contains(bounty.title).should('exist'); cy.wait(1000); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/36_icanhelpFLow.cy.ts b/cypress/e2e/36_icanhelpFLow.cy.ts index b9396a00..fdcc6402 100644 --- a/cypress/e2e/36_icanhelpFLow.cy.ts +++ b/cypress/e2e/36_icanhelpFLow.cy.ts @@ -1,8 +1,16 @@ describe('I Can Help Flow', () => { - let activeUser = 'alice'; let secondUser = 'carol'; + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace15', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + const bounty: Cypress.Bounty = { + workspace: 'Workspace15', title: 'UmerBounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -17,12 +25,14 @@ describe('I Can Help Flow', () => { beforeEach(() => { cy.clearCookies(); + cy.wait(1000); + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); }); it('Verify signup and user connection modals for bounties', () => { - cy.login(activeUser); - cy.wait(1000); - for (let i = 1; i <= 3; i++) { const updatedBounty = { ...bounty, title: `UmerBounty${i}` }; cy.create_bounty(updatedBounty); @@ -30,7 +40,7 @@ describe('I Can Help Flow', () => { } cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); cy.wait(3000); cy.contains('I can help').click(); diff --git a/cypress/e2e/37_bountyFilters.cy.ts b/cypress/e2e/37_bountyFilters.cy.ts index e4892b45..fe7e359b 100644 --- a/cypress/e2e/37_bountyFilters.cy.ts +++ b/cypress/e2e/37_bountyFilters.cy.ts @@ -1,9 +1,20 @@ describe('Alice tries to create 6 bounties and then assert filtered bounties', () => { - it('Create 6 bounties and assert filtered bounties', () => { - let activeUser = 'bob'; - cy.login(activeUser); - cy.wait(2000); + const workspace: Cypress.Workspace = { + loggedInAs: 'bob', + name: 'Workspace16', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + + beforeEach(() => { + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + }); + it('Create 6 bounties and assert filtered bounties', () => { const assignees = ['carol', 'carol', 'carol', 'carol', '', '']; const languages = ['Typescript', 'Lightning', 'PHP', 'Typescript', 'PHP', 'Typescript']; @@ -14,6 +25,7 @@ describe('Alice tries to create 6 bounties and then assert filtered bounties', ( for (let i = 0; i < 6; i++) { cy.create_bounty({ + workspace: 'Workspace16', title: `Filter Bounty Title ${i}`, category: 'Web development', coding_language: [languages[i]], @@ -52,7 +64,7 @@ describe('Alice tries to create 6 bounties and then assert filtered bounties', ( } } - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); cy.wait(1000); // check open filter diff --git a/cypress/e2e/45_adminBountyList.cy.ts b/cypress/e2e/45_adminBountyList.cy.ts index 7883114b..bb4befc6 100644 --- a/cypress/e2e/45_adminBountyList.cy.ts +++ b/cypress/e2e/45_adminBountyList.cy.ts @@ -2,6 +2,7 @@ describe('Super Admin Bounties List', () => { let activeUser = 'alice'; const bounty: Cypress.Bounty = { + workspace: 'Workspace1', title: 'AliRazaTask', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], diff --git a/cypress/e2e/46_adminFIlterStatus.cy.ts b/cypress/e2e/46_adminFIlterStatus.cy.ts index eed12077..3e356c9c 100644 --- a/cypress/e2e/46_adminFIlterStatus.cy.ts +++ b/cypress/e2e/46_adminFIlterStatus.cy.ts @@ -2,6 +2,7 @@ describe('Super Admin Bounty Filter Status Dropdown ', () => { let activeUser = 'alice'; const bounty: Cypress.Bounty = { + workspace: 'Workspace1', title: 'Syed', category: 'Web development', description: 'This is available', diff --git a/cypress/e2e/47_adminFIlterSortBy.cy.ts b/cypress/e2e/47_adminFIlterSortBy.cy.ts index f57e12ef..738ac16e 100644 --- a/cypress/e2e/47_adminFIlterSortBy.cy.ts +++ b/cypress/e2e/47_adminFIlterSortBy.cy.ts @@ -2,6 +2,7 @@ describe('Super Admin Bounty Filter SortBy', () => { let activeUser = 'alice'; const bounty: Cypress.Bounty = { + workspace: 'Workspace1', title: 'MirzaRef', category: 'Web development', description: 'This is available', diff --git a/cypress/e2e/48_adminBountyClick.cy.ts b/cypress/e2e/48_adminBountyClick.cy.ts index 3f2f26cc..1d8bbe07 100644 --- a/cypress/e2e/48_adminBountyClick.cy.ts +++ b/cypress/e2e/48_adminBountyClick.cy.ts @@ -2,6 +2,7 @@ describe('Super Admin Bounty Creation and Verification', () => { let activeUser = 'alice'; const bounty: Cypress.Bounty = { + workspace: 'Workspace1', title: 'saithsab', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], diff --git a/cypress/e2e/49_adminPaginationNumber.cy.ts b/cypress/e2e/49_adminPaginationNumber.cy.ts index f20521f4..faf929c4 100644 --- a/cypress/e2e/49_adminPaginationNumber.cy.ts +++ b/cypress/e2e/49_adminPaginationNumber.cy.ts @@ -2,6 +2,7 @@ describe('Super Admin Pagination Bounties List', () => { let activeUser = 'alice'; const bounty: Cypress.Bounty = { + workspace: 'Workspace1', title: 'Pagination Bounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], diff --git a/cypress/e2e/50_adminCustomDateSelect.cy.ts b/cypress/e2e/50_adminCustomDateSelect.cy.ts index 3d4a7b31..a2a04b05 100644 --- a/cypress/e2e/50_adminCustomDateSelect.cy.ts +++ b/cypress/e2e/50_adminCustomDateSelect.cy.ts @@ -2,6 +2,7 @@ describe('Admin Statistics Custom Date Range', () => { let activeUser = 'alice'; const bounty: Cypress.Bounty = { + workspace: 'Workspace1', title: 'UmerJobs', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], diff --git a/cypress/e2e/52_adminCustomDateInput.cy.ts b/cypress/e2e/52_adminCustomDateInput.cy.ts index 66b8ad3f..00c383ac 100644 --- a/cypress/e2e/52_adminCustomDateInput.cy.ts +++ b/cypress/e2e/52_adminCustomDateInput.cy.ts @@ -1,7 +1,14 @@ describe('Admin Custom Date Input', () => { - const activeUser = 'alice'; + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace22', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; const bounty: Cypress.Bounty = { + workspace: 'Workspace22', title: 'Admin', category: 'Web development', description: 'This is available', @@ -25,7 +32,9 @@ describe('Admin Custom Date Input', () => { .padStart(2, '0')}/${endDate.getFullYear()}`; beforeEach(() => { - cy.login(activeUser); + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); cy.wait(1000); }); @@ -77,7 +86,7 @@ describe('Admin Custom Date Input', () => { cy.contains(`Admin${i}`); } - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/5_deleteBountyFromModal.cy.ts b/cypress/e2e/5_deleteBountyFromModal.cy.ts index 281df4cc..9ab2b614 100644 --- a/cypress/e2e/5_deleteBountyFromModal.cy.ts +++ b/cypress/e2e/5_deleteBountyFromModal.cy.ts @@ -1,5 +1,14 @@ describe('Can Delete Bounty From Modal', () => { + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace3', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + const bounty: Cypress.Bounty = { + workspace:'Workspace3', title: 'Ali Bounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -11,10 +20,15 @@ describe('Can Delete Bounty From Modal', () => { deliverables: 'We are good to go man' }; - it('Can delete a bounty from modal', () => { - const activeUser = 'alice'; - cy.login(activeUser); + + beforeEach(() => { + cy.login(workspace.loggedInAs); cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + }); + + it('Can delete a bounty from modal', () => { cy.create_bounty(bounty); cy.wait(1000); @@ -37,6 +51,6 @@ describe('Can Delete Bounty From Modal', () => { cy.contains(bounty.title).should('not.exist'); cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/61_AssignBountiesStatus.cy.ts b/cypress/e2e/61_AssignBountiesStatus.cy.ts index b4750ce9..986dc4b9 100644 --- a/cypress/e2e/61_AssignBountiesStatus.cy.ts +++ b/cypress/e2e/61_AssignBountiesStatus.cy.ts @@ -1,6 +1,16 @@ describe('Verify Bounty Status Consistency', () => { const assignee = 'carol'; + + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace23', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + const bounty: Cypress.Bounty = { + workspace: 'Workspace23', title: 'Ali Bounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -13,11 +23,14 @@ describe('Verify Bounty Status Consistency', () => { estimate_completion_date: '09/09/2024' }; - it('Should display consistent bounty status in list and details views', () => { - const activeUser = 'alice'; - cy.login(activeUser); + beforeEach(() => { + cy.login(workspace.loggedInAs); cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + }); + it('Should display consistent bounty status in list and details views', () => { cy.create_bounty(bounty); cy.wait(1000); @@ -38,7 +51,7 @@ describe('Verify Bounty Status Consistency', () => { cy.get('body').click(0, 0); - cy.contains(activeUser).click(); + cy.contains(workspace.loggedInAs).click(); cy.wait(1000); cy.get('[data-testid="Bounties-tab"]').click(); @@ -49,6 +62,6 @@ describe('Verify Bounty Status Consistency', () => { cy.contains('Complete').should('exist'); cy.wait(1000); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/6_editBountyFromModal.cy.ts b/cypress/e2e/6_editBountyFromModal.cy.ts index 8d52495c..b74dfc4f 100644 --- a/cypress/e2e/6_editBountyFromModal.cy.ts +++ b/cypress/e2e/6_editBountyFromModal.cy.ts @@ -1,6 +1,16 @@ describe('Edit Bounty From Modal', () => { + + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace4', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + const assignee = 'carol'; const bounty: Cypress.Bounty = { + workspace:'Workspace4', title: 'My new Bounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -13,11 +23,14 @@ describe('Edit Bounty From Modal', () => { estimate_completion_date: '09/09/2024' }; - it('Can edit a bounty from modal', () => { - const activeUser = 'alice'; - cy.login(activeUser); + beforeEach(() => { + cy.login(workspace.loggedInAs); cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + }); + it('Can edit a bounty from modal', () => { cy.create_bounty(bounty); cy.wait(1000); @@ -44,6 +57,6 @@ describe('Edit Bounty From Modal', () => { cy.contains(newTitle).should('exist'); cy.contains(newDescription).should('exist'); cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/7_openBountyModal.cy.ts b/cypress/e2e/7_openBountyModal.cy.ts index 87a69238..f90403a7 100644 --- a/cypress/e2e/7_openBountyModal.cy.ts +++ b/cypress/e2e/7_openBountyModal.cy.ts @@ -1,5 +1,15 @@ describe('View Bounty From Modal', () => { + + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace5', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + const bounty: Cypress.Bounty = { + workspace:'Workspace5', title: 'Ali Bounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -12,11 +22,14 @@ describe('View Bounty From Modal', () => { estimate_completion_date: '09/09/2024' }; - it('Should view the bounty modal after creating', () => { - const activeUser = 'alice'; - cy.login(activeUser); + beforeEach(() => { + cy.login(workspace.loggedInAs); cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + }); + it('Should view the bounty modal after creating', () => { cy.create_bounty(bounty); cy.wait(1000); @@ -29,7 +42,7 @@ describe('View Bounty From Modal', () => { cy.contains(bounty.title).click(); cy.wait(1000); - cy.get('[data-testid="owner_name"]').contains(activeUser).should('exist'); + cy.get('[data-testid="owner_name"]').contains(workspace.loggedInAs).should('exist'); cy.wait(1000); cy.contains(bounty.title).should('exist'); @@ -64,6 +77,6 @@ describe('View Bounty From Modal', () => { cy.wait(1000); cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/8_assignHunter.cy.ts b/cypress/e2e/8_assignHunter.cy.ts index af55c7af..5cd85cb6 100644 --- a/cypress/e2e/8_assignHunter.cy.ts +++ b/cypress/e2e/8_assignHunter.cy.ts @@ -1,5 +1,14 @@ describe('Alice tries to assign a hunter after creating a bounty', () => { + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace6', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + const bounty: Cypress.Bounty = { + workspace:'Workspace6', title: 'My new Bounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -14,11 +23,15 @@ describe('Alice tries to assign a hunter after creating a bounty', () => { const assignee = 'carol'; - it('Creates a bounty without assignee', () => { - let activeUser = 'alice'; - cy.login(activeUser); + beforeEach(() => { + cy.login(workspace.loggedInAs); + cy.wait(1000); + cy.create_workspace(workspace); cy.wait(1000); + }); + + it('Creates a bounty without assignee', () => { cy.create_bounty(bounty); cy.wait(1000); @@ -37,6 +50,6 @@ describe('Alice tries to assign a hunter after creating a bounty', () => { // click outside the modal cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/cypress/e2e/9_unassignHunter.cy.ts b/cypress/e2e/9_unassignHunter.cy.ts index b7b38852..3a69bd38 100644 --- a/cypress/e2e/9_unassignHunter.cy.ts +++ b/cypress/e2e/9_unassignHunter.cy.ts @@ -1,7 +1,17 @@ describe('Alice tries to unassign a hunter after creating a bounty', () => { const assignee = 'carol'; + const workspace: Cypress.Workspace = { + loggedInAs: 'alice', + name: 'Workspace7', + description: 'A workspace focused on amazing projects.', + website: 'https://amazing.org', + github: 'https://github.com/amazing' + }; + + const bounty: Cypress.Bounty = { + workspace:'Workspace7', title: 'My new Bounty', category: 'Web development', coding_language: ['Typescript', 'Javascript', 'Lightning'], @@ -14,11 +24,15 @@ describe('Alice tries to unassign a hunter after creating a bounty', () => { estimate_completion_date: '09/09/2024' }; - it('Create a bounty with an assignee then unassign the user', () => { - let activeUser = 'alice'; - cy.login(activeUser); + beforeEach(() => { + cy.login(workspace.loggedInAs); cy.wait(1000); + cy.create_workspace(workspace); + cy.wait(1000); + }); + + it('Create a bounty with an assignee then unassign the user', () => { cy.create_bounty(bounty); cy.wait(1000); @@ -39,6 +53,6 @@ describe('Alice tries to unassign a hunter after creating a bounty', () => { // click outside the modal cy.get('body').click(0, 0); - cy.logout(activeUser); + cy.logout(workspace.loggedInAs); }); }); diff --git a/src/components/form/bounty/index.tsx b/src/components/form/bounty/index.tsx index b6f67fe5..4fa52127 100644 --- a/src/components/form/bounty/index.tsx +++ b/src/components/form/bounty/index.tsx @@ -223,51 +223,57 @@ function Form(props: FormProps) {