diff --git a/cypress/e2e/24_createOrgPageBounty.cy.ts b/cypress/e2e/24_createOrgPageBounty.cy.ts index 6a6d20d0..e0ed230b 100644 --- a/cypress/e2e/24_createOrgPageBounty.cy.ts +++ b/cypress/e2e/24_createOrgPageBounty.cy.ts @@ -1,5 +1,5 @@ -describe('View Organization Bounties', () => { - const OrgName = 'AliSoftTech'; +describe('Create org bounty from Organization Page', () => { + const OrgName = 'Ali SoftDev'; const org: Cypress.Organization = { loggedInAs: 'alice', @@ -45,7 +45,7 @@ describe('View Organization Bounties', () => { cy.wait(1000); }); - it('should verify bounty tile displays the organization label is clickable and redirects the user to the organizations bounty page.', () => { + it('should verify bounty tile displays the organization label is clickable and redirects the user to the organizations bounty page and create a new bounty', () => { cy.create_bounty(bounty); cy.wait(5000); @@ -67,14 +67,15 @@ describe('View Organization Bounties', () => { cy.get('[data-testid="Organization"]').contains(org.name).should('exist').and('be.visible'); cy.wait(1000); - cy.get('body').click(0, 0); - cy.wait(600); - // cy.create_bounty(orgPageBounty); - // cy.wait(5000); - // - // cy.contains(bounty.title).should('exist').and('be.visible'); - // cy.wait(5000); + cy.get('[data-testid="close-btn"]').click(); + cy.wait(1000); + + cy.create_orgBounty(orgPageBounty); + cy.wait(5000); + + cy.contains(orgPageBounty.title).should('exist').and('be.visible'); + cy.wait(5000); - // cy.logout(org.loggedInAs); + cy.logout(org.loggedInAs); }); }); diff --git a/cypress/global.d.ts b/cypress/global.d.ts index 3534a6a4..fd4af043 100644 --- a/cypress/global.d.ts +++ b/cypress/global.d.ts @@ -3,6 +3,7 @@ declare namespace Cypress { login(userAlias: string): void; logout(userAlias: string): void; create_bounty(bounty: Bounty, clickMethod?: 'contains' | 'testId'): void; + create_orgBounty(orgBounty: Bounty): void; lnurl_login(): void; create_org(Organization: Organization): void; pay_invoice(details: InvoiceDetail): void; diff --git a/cypress/support/commands.ts b/cypress/support/commands.ts index e6b850b2..3ba3a385 100644 --- a/cypress/support/commands.ts +++ b/cypress/support/commands.ts @@ -184,6 +184,71 @@ Cypress.Commands.add('create_bounty', (bounty, clickMethod = 'contains') => { cy.contains('Finish').click(); }); +Cypress.Commands.add('create_orgBounty', (orgBounty) => { + cy.wait(1000); + cy.contains('Post a Bounty').click(); + cy.contains('Start').click(); + + cy.contains('label', 'Bounty Title').type(orgBounty.title); + cy.wait(600); + if (orgBounty.github_issue_url) { + cy.get('[data-testid="Github"]').type(orgBounty.github_issue_url); + } + + cy.wait(1000); + + if (orgBounty.coding_language && orgBounty.coding_language.length > 0) { + cy.contains('Coding Language').click(); + + for (let i = 0; i < orgBounty.coding_language.length; i++) { + cy.get('.CheckboxOuter').contains(orgBounty.coding_language[i]).scrollIntoView().click(); + } + cy.contains('Coding Language').click(); + } + + cy.get('[data-testid="Category *"]').click(); + cy.get('[data-testid="Category *"]').contains(orgBounty.category).click(); + + cy.contains('Next').click(); + + cy.get('.euiTextArea').type(orgBounty.description); + cy.contains('Next').click(); + + cy.contains('label', 'Price (Sats)').type(orgBounty.amount); + + if (orgBounty.estimate_session_length) { + cy.get('[data-testid="Estimate Session Length"]').find('button').click(); + + cy.get('[data-testid="Estimate Session Length"]') + .contains(orgBounty.estimate_session_length) + .click(); + } + + if (orgBounty.estimate_completion_date) { + cy.get('.react-datepicker__input-container > .euiDatePicker').click(); + cy.get('.react-datepicker__input-container > .euiDatePicker').type('{selectAll}'); + cy.wait(100); + cy.get('.react-datepicker__input-container > .euiDatePicker').type( + orgBounty.estimate_completion_date + ); + } + + if (orgBounty.deliverables) { + cy.get('textarea.inputText').type(orgBounty.deliverables); + } + + cy.contains('Next').click(); + + if (orgBounty.assign) { + cy.get('.SearchInput').type(orgBounty.assign); + cy.wait(1000); + cy.get('.People').contains('Assign').click(); + } else { + cy.contains('Decide Later').click(); + } + + cy.contains('Finish').click(); +}); Cypress.Commands.add('lnurl_login', () => { cy.visit('http://localhost:3007'); cy.contains('Sign in').click();