Skip to content

Commit

Permalink
cypress fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Vayras committed Nov 15, 2024
1 parent 31d8691 commit f8e2055
Showing 1 changed file with 26 additions and 11 deletions.
37 changes: 26 additions & 11 deletions cypress/e2e/31_editBountyBySearch.cy.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
describe('Edit Bounty By Searching, Change Workspace And Assignee', () => {
const WorkspaceName1 = 'jointOrg';
const WorkspaceName2 = 'jointOrg';
const NewAssignee = 'carol';
const NewAmount = '200';
const NewCodingLanguages = ['Python', 'Rust'];

let generatedWorkspaceName; // Variable to store the generated workspace name

const workSpace: Cypress.Workspace = {
loggedInAs: 'alice',
name: 'UmerWorkspaceT',
description: 'An workspace focused on amazing projects.',
name: '', // Initialize without a name
description: 'A workspace focused on amazing projects.',
website: 'https://amazing.org',
github: 'https://github.com/amazing'
};

const bounty: Cypress.Bounty = {
workspace: WorkspaceName1,
workspace: '', // Initialize without a workspace name
title: 'UmerBounty',
category: 'Web development',
coding_language: ['Typescript', 'Javascript', 'Lightning'],
Expand All @@ -28,13 +28,19 @@ describe('Edit Bounty By Searching, Change Workspace And Assignee', () => {
};

beforeEach(() => {
// Generate a unique workspace name
generatedWorkspaceName = `Workspace_${Math.random().toString(36).substring(7)}`;
workSpace.name = generatedWorkspaceName;
bounty.workspace = generatedWorkspaceName; // Set bounty's workspace to the generated name

cy.login(workSpace.loggedInAs);
cy.wait(1000);
cy.contains(workSpace.loggedInAs).click();
cy.wait(1000);

// Create two workspaces
for (let i = 1; i <= 2; i++) {
const updatedName = `jointOrg${i}`;
const updatedWorkspace = { ...workSpace, name: updatedName };
const updatedWorkspace = { ...workSpace, name: `${generatedWorkspaceName}_${i}` };
cy.create_workspace(updatedWorkspace);
cy.wait(1000);
}
Expand All @@ -44,6 +50,7 @@ describe('Edit Bounty By Searching, Change Workspace And Assignee', () => {
cy.create_bounty(bounty);
cy.wait(1000);

// Search for the bounty
cy.get('input').type(bounty.title);
cy.wait(1000);

Expand All @@ -60,40 +67,48 @@ describe('Edit Bounty By Searching, Change Workspace And Assignee', () => {
cy.contains('Edit').click();
cy.wait(1000);

// Attempt to change the workspace
cy.get('[data-testid="org_uuid"]').click({ force: true });
cy.wait(600);

cy.contains(WorkspaceName2).click({ force: true });
// Log the workspace name for debugging
cy.log('Changing to workspace:', bounty.workspace);

// Select the dynamically generated workspace
cy.get('[data-testid="org_uuid"]').should('exist').click({ force: true }).wait(5000);
cy.wait(1000);
cy.contains(bounty.workspace).should('exist').click({ force: true });

// Assign a new assignee
cy.get('.SearchInput').type(NewAssignee);
cy.wait(1000);

cy.get('.People').contains('Assign').click();
cy.wait(600);

// Change coding languages
cy.contains('Coding Language').click({ force: true });
bounty.coding_language.forEach((language: any) => {
cy.get('.CheckboxOuter').contains(language).scrollIntoView().click({ force: true });
});

NewCodingLanguages.forEach((language: any) => {
cy.get('.CheckboxOuter').contains(language).scrollIntoView().click({ force: true });
});

cy.contains('Coding Language').click({ force: true });
cy.wait(600);

// Update the bounty amount
cy.get('input.inputText#price').eq(0).clear({ force: true }).type(NewAmount);
cy.wait(600);

// Save the changes
cy.contains('Save').click();
cy.wait(1000);

cy.get('[data-testid="close-btn"]').click(0, 0);
cy.visit('http://localhost:3007/bounties');
cy.wait(1000);

// Verify the bounty changes
cy.get('input').type(bounty.title);
cy.wait(1000);

Expand Down

0 comments on commit f8e2055

Please sign in to comment.