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 1 commit
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
74 changes: 74 additions & 0 deletions client/cypress/integration/event-manager/Filters/date_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

const URL = 'http://localhost:3000/events/';

describe('Date Filter Testing', () => {
context('Test for Filters Route', () => {
it('Should be on Filters page', () => {
cy.visit('/events');
cy.get('h3').should('contain', 'Welcome to Event Management');
Copy link
Collaborator

Choose a reason for hiding this comment

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

This heading will be removed in future, can you please assert something else

});
});

context('Test for Date Filter', () => {
it('should only accept a correct date format', () => {
cy.get("input[name='filterDateTo']")
.type('2018-10-03')
.should('have.value', '2018-10-03'); //Event END Date
cy.get("input[name='filterDateFrom']")
.type('2011-10-06')
.should('have.value', '2011-10-06'); //Event START date
cy.visit(URL);
});

//BUGS-NOT WORKING
// it('should display 1 result on Start date filter ', () => {
// cy.get("input[name='filterDateFrom']")
// .type('2018-10-03')
// .should('have.value', '2018-10-03'); //Start Event Date

// cy.get('.btn').click();
// cy.get('#event-list a')
// .should('have.attr', 'href')
// .and('include', '/events/2')
// .then(href => {
// cy.visit(href);
// cy.get(
// ':nth-child(3) > :nth-child(1) > .row > .col-md-10 > .text-dark'
// ).should('contain', 'Saturday, October 6, 2018 11:00 AM');
// });
// cy.visit('http://localhost:3000/events/');
// });

// it('should display 3 results on end date filter ', () => {
// cy.get("input[name='filterDateTo']")
// .type('2011-10-06')
// .should('have.value', '2011-10-06'); //End Event date

// cy.get('.btn').click();
// cy.get('#event-list a')
// .should('have.attr', 'href')
// .and('include', '/events/2')
// .then(href => {
// cy.visit(href);
// cy.get(
// ':nth-child(1) > .card > .card-body > .card-subtitle > .text-muted'
// ).should('contain', 'Saturday, October 6, 2018 11:00 AM');
// cy.get(
// ':nth-child(2) > .card > .card-body > .card-subtitle > .text-muted'
// ).should('contain', 'Wednesday, October 3, 2018 11:00 AM');
// cy.get(
// ':nth-child(3) > .card > .card-body > .card-subtitle > .text-muted'
// ).should('contain', 'Tuesday, October 2, 2018 11:00 AM');
// });
// });

});


});
39 changes: 39 additions & 0 deletions client/cypress/integration/event-manager/Filters/keywords_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

const kw = ':nth-child(8) > .form-control';
const URL = 'http://localhost:3000/events/';

describe('KeyWords Filter 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 Key Words filter', () => {
it('should display 1 result', () => {
cy.get(kw).type('const');
Copy link
Collaborator

Choose a reason for hiding this comment

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

make a data set for these values

cy.get(kw).should('have.value', 'const');
cy.get('.btn').click();
cy.get('.card-text').should('contain', 'const');
cy.visit(URL);
});
it('should display 2 result', () => {
cy.get(kw).type('sasta');
cy.get(kw).should('have.value', 'sasta');
cy.get('.btn').click();
cy.get('.card div')
.should('have.length', '2')
Copy link
Collaborator

Choose a reason for hiding this comment

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

add some generic tests. We are testing components which could have more than 2 results

.each($div => {
cy.wrap($div)
.get('.card > .card-body > .card-text')
.should('contain', 'sasta');
});
});
});
});
54 changes: 54 additions & 0 deletions client/cypress/integration/event-manager/Filters/location_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

const loc =
':nth-child(4) .Select .Select-control .Select-arrow-zone .Select-arrow';
const delay = 30000;
const URL = 'http://localhost:3000/events/';

describe('Location Filter 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 location filter ', () => {
it('should only have single item', () => {
cy.get(loc, { timeout: delay })
.eq(0)
.click();
cy.get('div.Select-menu-outer').should('be.visible');
cy.contains('NIC').click();
cy.get('.Select-value #react-select-3--value-item').should(
'contain',
'NIC'
);
cy.get(loc, { timeout: delay })
.eq(0)
.click();
cy.contains('neduet').click();
cy.get('.Select-value #react-select-3--value-item').should(
'contain',
'neduet'
);
cy.get('.btn').click();
cy.get('#event-list a')
.should('have.attr', 'href')
.and('include', '/events/2')
.then(href => {
cy.visit(href);
cy.get(':nth-child(3) > .row > .col-md-10 > .text-dark').should(
'contain',
'neduet johar'
);
});
cy.visit(URL);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

const delay = 30000;
const org =
':nth-child(1) .Select .Select-control .Select-arrow-zone .Select-arrow';
const URL = 'http://localhost:3000/events/';


describe('Organisation Filter 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 Filter', () => {
it('should have a clickable arrow button', () => {
cy.get(org, { timeout: delay })
.eq(0)
.click(); //Clicks the toggle button
cy.get('div.Select-menu-outer').should('be.visible');
});

it('should display 1 result on single item selection', () => {
cy.get(org, { timeout: delay }).eq(0);
cy.contains('NES').click();
cy.get('.Select-value #react-select-2--value-0').should('contain', 'NES');
cy.get('.btn').click();
cy.get('#event-list a')
.should('have.attr', 'href')
.and('include', '/events/2')
.then(href => {
cy.visit(href);
cy.get(
':nth-child(3) > :nth-child(4) > .row > .col-md-10 > a > .text-dark'
).should('contain', 'NES');
});
cy.visit(URL);
});

it('should display 2 results on 2 items selection', () => {
cy.get(org, { timeout: delay })
.eq(0)
.click();
cy.contains('NES').click();
cy.get('.Select-value #react-select-2--value-0').should('contain', 'NES');

cy.get(org, { timeout: delay })
.eq(0)
.click();
cy.contains('Recurship').click();
cy.get('.Select-value #react-select-2--value-1').should(
'contain',
'Recurship'
);
cy.get('.btn').click();
cy.get('#event-list a')
.eq(0)
.should('have.attr', 'href')
.and('include', '/events/1');

cy.get('#event-list a')
.eq(1)
.should('have.attr', 'href')
.and('include', '/events/2');
});

it('should cancel all the items at once', () => {
cy.get(org, { timeout: delay })
.eq(0)
.click();
cy.contains('NES').click();
cy.get('.Select-value #react-select-2--value-0').should('contain', 'NES');

cy.get(org, { timeout: delay })
.eq(0)
.click();
cy.contains('Recurship').click();
cy.get('.Select-value #react-select-2--value-1').should(
'contain',
'Recurship'
);
cy.get(
':nth-child(1)> .Select > .Select-control > .Select-clear-zone > .Select-clear'
).click();
});
});
});
Empty file.
63 changes: 63 additions & 0 deletions client/cypress/integration/event-manager/Filters/sponsors_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" */

const spons =
':nth-child(5) .Select .Select-control .Select-arrow-zone .Select-arrow';
const delay = 30000;

describe('Sponsors Filter 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 sponsors filter', () => {
it('should have one item', () => {
cy.get(spons, { timeout: delay })
.eq(0)
.click();
cy.get('div.Select-menu-outer').should('be.visible');
cy.contains('tapal').click();
cy.get('.Select-value #react-select-4--value-0').should(
'contain',
'tapal'
);
});

it('should deselect item', () => {
cy.get('.Select-value-icon').click();
});

it('should have multiple items', () => {
cy.get(spons, { timeout: delay })
.eq(0)
.click();
cy.contains('nokia').click();
cy.get('.Select-value #react-select-4--value-0').should(
'contain',
'nokia'
);

cy.get(spons, { timeout: delay })
.eq(0)
.click();
cy.contains('apple').click();
cy.get('.Select-value #react-select-4--value-1').should(
'contain',
'apple'
);
});

it('should cancel all the items at once', () => {
cy.get(
':nth-child(5) > .Select > .Select-control > .Select-clear-zone > .Select-clear'
).click();
});
});
});
Loading