Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] filters e2e #182

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions client/cypress/integration/event-manager/filters_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

describe('Filters Testing', () => {
context('Test for Filters Route', () => {
it('Should be on Filters page', () => {
cy.visit('/events');
cy.get('h3').should('contain', 'Welcome to Event Management');
});
});
context('Test for Organization Filters', () => {
it('should have an arrow button', () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

im not sure what this test is actually testing. We are looking to test functionality not design.

cy.get(
':nth-child(1) .Select .Select-control .Select-arrow-zone .Select-arrow',
{ timeout: 30000 }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timeouts should be defined as constants

) //Gets the location of the Organisation field with a delay of 30000
.eq(0);
// .click(); //Clicks the toggle button
});

it('should select one option', () => {
cy.get(
':nth-child(1) .Select .Select-control .Select-arrow-zone .Select-arrow',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

selectors should be defined as constants

{ timeout: 30000 } //gets the location with a delay of 30000
)
.eq(0)
.click();
cy.contains('NES').click(); //Selects the dropdown menu option
});

it('should deselect option', () => {
cy.get(':nth-child(1)>.Select-value-icon').click(); //Deselects one of the option
});

it('should select multiple options', () => {
cy.get(
':nth-child(1) .Select .Select-control .Select-arrow-zone .Select-arrow',
{ timeout: 30000 } //gets the location with a delay of 30000
)
.eq(0)
.click();
cy.contains('NES').click(); //Selects the dropdown menu option
cy.get(
':nth-child(1) .Select .Select-control .Select-arrow-zone .Select-arrow',
{ timeout: 30000 } //gets the location with a delay of 30000
)
.eq(0)
.click();
cy.contains('Recurship').click(); //Selects the dropdown menu option
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since you are testing against our live environment, it would be better to make generic asserts like (list contains atleast one item).

});

it('should deselect all the options', () => {
cy.get(':nth-child(1)>.Select-value-icon').click(); //Deselects one of the option
cy.get('.Select-value-icon').click(); //Deselects both
});

// cy.get('form .btn').click();
});
});
3 changes: 2 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"build-storybook": "build-storybook -s public",
"commit": "git-cz",
"precommit": "lint-staged",
"e2e": "cypress open"
"e2e": "cypress open",
"cypress": "cypress run"
},
"lint-staged": {
"src/**/*.{js,json,css,jsx}": [
Expand Down