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 all 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
30 changes: 30 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,30 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

import { constants } from '../dataSet';

describe('Date Filter Testing', () => {
context('Test for Filters Route', () => {
it('Should be on Filters page', () => {
beforeEach(() => {
cy.homePage();
});
});
});

context('Test for Date Filter', () => {
it('should only accept a correct date format', () => {
cy.get("input[name='filterDateTo']")
.type(constants.EVENT_END_DATE)
.should('have.value', '2018-11-18'); //Event END Date
cy.get("input[name='filterDateFrom']")
.type(constants.EVENT_START_DATE)
.should('have.value', '2011-11-24'); //Event START date
cy.visit(constants.BASE_URL);
});
});
});
36 changes: 36 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,36 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

import { constants } from '../dataSet';

describe('KeyWords Filter Testing', () => {
context('Test for Filters Route', () => {
it('Should be on Home Page', () => {
beforeEach(() => {
cy.homePage();
});
});
});
context('Test for Key Words filter', () => {
it('should display less results', () => {
cy.get(constants.KEYWORDS_INPUT_FIELD).type('const');
cy.get(constants.KEYWORDS_INPUT_FIELD).should('have.value', 'const');
cy.get('.btn').click();
cy.get('.card-text').should('contain', 'const');
});
it('should display 2 result', () => {
cy.get(constants.KEYWORDS_INPUT_FIELD).type('ReactKHI');
cy.get(constants.KEYWORDS_INPUT_FIELD).should('have.value', 'ReactKHI');
cy.get('.btn').click();
// cy.get('.card div')
// .each($div => {
// cy.wrap($div)
// .get('.card > .card-body').should('contain','ReactKHI');
// });
});
});
});
56 changes: 56 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,56 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

import { constants } from '../dataSet';

describe('location Filter Testing', () => {
context('Test for Filters Route', () => {
it('Should be on Home page', () => {
beforeEach(() => {
cy.homePage();
});
});
});

context('Test for constants.location filter ', () => {
it('should only accept single item at a time', () => {
cy.get(constants.LOCATION_INPUT_FIELD, {
timeout: constants.WAITING_TIME,
})
.eq(0)
.click();
cy.get('div.Select-menu-outer').should('be.visible');
cy.get(constants.LOCATION_FIELD_OPTION_1).click();
cy.get('.Select-value #react-select-3--value-item').should(
'contain',
'NIC'
);
cy.get(constants.LOCATION_INPUT_FIELD, {
timeout: constants.WAITING_TIME,
})
.eq(0)
.click();
cy.get(constants.LOCATION_FIELD_OPTION_2).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(constants.BASE_URL);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

import { constants } from '../dataSet';

describe('constants.organisation Filter Testing', () => {
context('Test for Filters Route', () => {
it('Should be on Filters page', () => {
beforeEach(() => {
cy.homePage();
});
});
});

context('Test for constants.organization Filter', () => {
it('should have a clickable arrow button', () => {
cy.get(constants.ORGANISATION_INPUT_FIELD, {
timeout: constants.WAITING_TIME,
})
.eq(0)
.click(); //Clicks the toggle button
cy.get('div.Select-menu-outer').should('be.visible');
});

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

cy.get(constants.ORGANISATION_INPUT_FIELD, {
timeout: constants.WAITING_TIME,
})
.eq(0)
.click();
cy.get(constants.ORGANISATION_FIELD_OPTION_1).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');
cy.log('can cancel all the items at once');
cy.get(constants.ORGANISATION_FIELD_VALUE).should(
'have.class',
'Select-value'
);
cy.get(
':nth-child(1) > .Select > .Select-control > .Select-clear-zone > .Select-clear'
).click();
cy.get('.btn').click();
cy.get(constants.ORGANISATION_FIELD_VALUE).should(
'not.have.class',
'Select-value'
);
});
});
});
Empty file.
80 changes: 80 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,80 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

import { constants } from '../dataSet';

describe('Sponsors Filter Testing', () => {
context('Test for Filters Route', () => {
it('Should be on Filters page', () => {
beforeEach(() => {
cy.homePage();
});
});
});

context('Test for sponsors filter', () => {
it('should have one item', () => {
cy.get(constants.SPONSORS_INPUT_FIELD, {
timeout: constants.WAITING_TIME,
})
.eq(0)
.click();
cy.get('div.Select-menu-outer').should('be.visible');
cy.get(constants.SPONSORS_FIELD_OPTION_1).click();
cy.get('.Select-value #react-select-4--value-0').should(
'contain',
'tapal'
);
cy.log('should deselect item');
cy.get(constants.SPONSORS_FIELD_VALUE).should(
'have.class',
'Select-value'
);
cy.get('.Select-value-icon').click();
cy.get(constants.SPONSORS_FIELD_VALUE).should(
'not.have.class',
'Select-value'
);
});

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

cy.get(constants.SPONSORS_INPUT_FIELD, {
timeout: constants.WAITING_TIME,
})
.eq(0)
.click();
cy.get(constants.SPONSORS_FIELD_OPTION_2).click();
cy.get('.Select-value #react-select-4--value-1').should(
'contain',
'apple'
);
cy.log('can cancel all the items at once');
cy.get(constants.SPONSORS_FIELD_VALUE).should(
'have.class',
'Select-value'
);
cy.get(
':nth-child(5) > .Select > .Select-control > .Select-clear-zone > .Select-clear'
).click();
cy.get(constants.SPONSORS_FIELD_VALUE).should(
'not.have.class',
'Select-value'
);
});
});
});
73 changes: 73 additions & 0 deletions client/cypress/integration/event-manager/Filters/tags_spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/* global describe */
/* global context */
/* global it */
/* global expect */
/* global cy */
/* eslint no-undef: "error" */

import { constants } from '../dataSet';

describe('constants.tags Filter Testing', () => {
context('Test for Filters Route', () => {
it('Should be on Home page', () => {
beforeEach(() => {
cy.homePage();
});
});
});
context('Test for constants.tags filter', () => {
it('should have one item', () => {
cy.get(constants.TAGS_INPUT_FIELD, { timeout: constants.WAITING_TIME })
.eq(0)
.click();
cy.get('div.Select-menu-outer').should('be.visible');
cy.get(constants.TAGS_FIELD_OPTION_2).click();
cy.get('.Select-value #react-select-5--value-0').should(
'contain',
'javascript'
);
cy.get('.btn').click();
cy.get('#event-list a')
.should('have.attr', 'href')
.and('include', '/events/1')
.then(href => {
cy.visit(href);
cy.get('.container > :nth-child(5)').should('contain', 'javascript');
});
});

it('should have multiple items', () => {
cy.get(constants.TAGS_INPUT_FIELD, { timeout: constants.WAITING_TIME })
.eq(0)
.click();
cy.get(constants.TAGS_FIELD_OPTION_1).click();
cy.get('.Select-value #react-select-5--value-0').should('contain', 'abc');

cy.get(constants.TAGS_INPUT_FIELD, { timeout: constants.WAITING_TIME })
.eq(0)
.click();
cy.get(constants.TAGS_FIELD_OPTION_2).click();
cy.get('.Select-value #react-select-5--value-1').should(
'contain',
'javascript'
);
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');

cy.log('can cancel all the items at once');
cy.get(constants.TAG_FIELD_VALUE).should('have.class', 'Select-value');
cy.get(
':nth-child(6) > .Select > .Select-control > .Select-clear-zone > .Select-clear'
).click();
cy.get(constants.TAG_FIELD_VALUE).should('not.have.class', 'Select-value');
});
});
});
Loading