Skip to content

Commit

Permalink
Merge pull request stakwork#482 from MahtabBukhari/super-admin-bounty…
Browse files Browse the repository at this point in the history
…-filter-status-dropdown

super admin bounty filter status dropdown
  • Loading branch information
elraphty authored Mar 27, 2024
2 parents 0b47600 + b131fd1 commit 73f2a49
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions cypress/e2e/46_adminFIlterStatus.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
describe('Super Admin Bounty Filter Status Dropdown ', () => {
let activeUser = 'alice';

const bounty: Cypress.Bounty = {
title: 'Syed',
category: 'Web development',
description: 'This is available',
amount: '123',
assign: 'carol',
deliverables: 'We are good to go man'
};

beforeEach(() => {
cy.login(activeUser);
cy.wait(1000);
});

it('Should create six bounties with different status and verify that changing the bounties filter status displays only bounties with that specific status', () => {
for (let i = 1; i <= 4; i++) {
const updatedBounty = { ...bounty, title: `Syed${i}` };
cy.create_bounty(updatedBounty);
cy.wait(1000);
}

for (let i = 5; i <= 6; i++) {
const updatedBounty = { ...bounty, title: `Syed${i}`, assign: '' };
cy.create_bounty(updatedBounty);
cy.wait(1000);
}

cy.contains('Filter').click();
cy.contains('Open').click();
cy.contains('Assigned').click();
cy.wait(1000);

for (let i = 1; i <= 2; i++) {
cy.contains(`Syed${i}`).click();
cy.wait(1000);

cy.contains('Mark as Paid').click();
cy.wait(1000);

cy.contains('Next').click();
cy.wait(1000);

cy.contains('Skip and Mark Paid').click();
cy.wait(1000);

cy.get('body').click(0, 0);

cy.wait(1000);
}

cy.visit('http://localhost:3007/admin');
cy.wait(3000);

for (let i = 1; i <= 6; i++) {
cy.contains(`Syed${i}`, { timeout: 10000 }).should('exist');
}

cy.contains('Status').click();
cy.get('label[for="Open"]').click();
cy.contains('Apply').click();
cy.wait(1000);

for (let i = 5; i <= 6; i++) {
cy.contains(`Syed${i}`, { timeout: 10000 }).should('exist');
}

for (let i = 1; i <= 4; i++) {
cy.contains(`Syed${i}`, { timeout: 10000 }).should('not.exist');
}

cy.contains('Status').click();
cy.get('label[for="Open"]').click();
cy.get('label[for="Assigned"]').click();
cy.contains('Apply').click();
cy.wait(1000);

for (let i = 3; i <= 4; i++) {
cy.contains(`Syed${i}`, { timeout: 10000 }).should('exist');
}

for (let i = 1; i <= 2; i++) {
cy.contains(`Syed${i}`, { timeout: 10000 }).should('not.exist');
}

for (let i = 5; i <= 6; i++) {
cy.contains(`Syed${i}`, { timeout: 10000 }).should('not.exist');
}

cy.contains('Status').click();
cy.get('label[for="Assigned"]').click();
cy.get('label[for="Paid"]').click();
cy.contains('Apply').click();
cy.wait(1000);

for (let i = 1; i <= 2; i++) {
cy.contains(`Syed${i}`, { timeout: 10000 }).should('exist');
}

for (let i = 3; i <= 6; i++) {
cy.contains(`Syed${i}`, { timeout: 10000 }).should('not.exist');
}

cy.wait(1000);

cy.logout(activeUser);
});
});

0 comments on commit 73f2a49

Please sign in to comment.