-
Notifications
You must be signed in to change notification settings - Fork 10
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
base: master
Are you sure you want to change the base?
[test] filters e2e #182
Changes from 5 commits
3814619
f055909
7a6790c
413b753
96f1d4c
1b3b029
325f5a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
/* global describe */ | ||
/* global context */ | ||
/* global it */ | ||
/* global expect */ | ||
/* global cy */ | ||
/* eslint no-undef: "error" */ | ||
|
||
import { constants } from '../dataSet'; | ||
const EVEND = Cypress.moment() | ||
.subtract('5', 'days') | ||
.format('YYYY-MM-DD'); | ||
const EVSTRT = Cypress.moment() | ||
.subtract('7', 'years') | ||
.format('YYYY-MM-DD'); | ||
|
||
describe('Date Filter Testing', () => { | ||
context('Test for Filters Route', () => { | ||
it('Should be on Filters page', () => { | ||
cy.visit('/events'); | ||
cy.get(':nth-child(2) > label').should('contain', 'Start Date'); | ||
}); | ||
}); | ||
|
||
context('Test for Date Filter', () => { | ||
it('should only accept a correct date format', () => { | ||
cy.get("input[name='filterDateTo']") | ||
.type(EVEND) | ||
.should('have.value', '2018-10-03'); //Event END Date | ||
cy.get("input[name='filterDateFrom']") | ||
.type(EVSTRT) | ||
.should('have.value', '2011-10-08'); //Event START date | ||
cy.visit(constants.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'); | ||
// }); | ||
// }); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* 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 Filters page', () => { | ||
cy.visit('/events'); | ||
cy.get('.btn').should('contain', 'Search'); | ||
}); | ||
}); | ||
context('Test for Key Words filter', () => { | ||
it('should display 1 result', () => { | ||
cy.get(constants.kw).type('const'); | ||
cy.get(constants.kw).should('have.value', 'const'); | ||
cy.get('.btn').click(); | ||
cy.get('.card-text').should('contain', 'const'); | ||
cy.visit(constants.URL); | ||
}); | ||
it('should display 2 result', () => { | ||
cy.get(constants.kw).type('sasta'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. constants.kw is not a good name. |
||
cy.get(constants.kw).should('have.value', 'sasta'); | ||
cy.get('.btn').click(); | ||
cy.get('.card div') | ||
.should('have.length', '2') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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'); | ||
}); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* 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 Filters page', () => { | ||
cy.visit('/events'); | ||
cy.get('.btn').should('contain', 'Search'); | ||
}); | ||
}); | ||
|
||
context('Test for constants.location filter ', () => { | ||
it('should only have single item', () => { | ||
cy.get(constants.loc, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get('div.Select-menu-outer').should('be.visible'); | ||
cy.get(constants.VAL5).click(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. VAL5 is not a good name, each name needs to define what is it for |
||
cy.get('.Select-value #react-select-3--value-item').should( | ||
'contain', | ||
'NIC' | ||
); | ||
cy.get(constants.loc, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get(constants.VAL6).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.URL); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/* 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', () => { | ||
cy.visit('/events'); | ||
cy.get('.legend').should('contain', 'Filters'); | ||
}); | ||
}); | ||
|
||
context('Test for constants.organization Filter', () => { | ||
it('should have a clickable arrow button', () => { | ||
cy.get(constants.org, { timeout: constants.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(constants.org, { timeout: constants.delay }).eq(0); | ||
cy.get(constants.VAL4).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(constants.URL); | ||
}); | ||
|
||
it('should display 2 results on 2 items selection', () => { | ||
cy.get(constants.org, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get(constants.VAL4).click(); | ||
cy.get('.Select-value #react-select-2--value-0').should('contain', 'NES'); | ||
|
||
cy.get(constants.org, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get(constants.VAL3).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( | ||
':nth-child(1)> .Select > .Select-control > .Select-clear-zone > .Select-clear' | ||
).click(); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* 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', () => { | ||
cy.visit('/events'); | ||
cy.get('.btn').should('contain', 'Search'); | ||
}); | ||
}); | ||
|
||
context('Test for sponsors filter', () => { | ||
it('should have one item', () => { | ||
cy.get(constants.spons, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get('div.Select-menu-outer').should('be.visible'); | ||
cy.get(constants.VAL7).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(constants.spons, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get(constants.VAL8).click(); | ||
cy.get('.Select-value #react-select-4--value-0').should( | ||
'contain', | ||
'nokia' | ||
); | ||
|
||
cy.get(constants.spons, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get(constants.VAL8).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(); | ||
}); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* 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 Filters page', () => { | ||
cy.visit('/events'); | ||
cy.get('.btn').should('contain', 'Search'); | ||
}); | ||
}); | ||
context('Test for constants.tags filter', () => { | ||
it('should have one item', () => { | ||
cy.get(constants.tag, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get('div.Select-menu-outer').should('be.visible'); | ||
cy.get(constants.VAL2).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'); | ||
}); | ||
cy.visit(constants.URL); | ||
}); | ||
|
||
it('should have multiple items', () => { | ||
cy.get(constants.tag, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get(constants.VAL1).click(); | ||
cy.get('.Select-value #react-select-5--value-0').should('contain', 'abc'); | ||
|
||
cy.get(constants.tag, { timeout: constants.delay }) | ||
.eq(0) | ||
.click(); | ||
cy.get(constants.VAL2).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'); | ||
}); | ||
|
||
it('should cancel all the items at once', () => { | ||
cy.get( | ||
':nth-child(6) > .Select > .Select-control > .Select-clear-zone > .Select-clear' | ||
).click(); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please use proper variable names, they can be as long as you want.