-
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 3 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,251 @@ | ||
/* 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 loc = | ||
':nth-child(4) .Select .Select-control .Select-arrow-zone .Select-arrow'; | ||
const spons = | ||
':nth-child(5) .Select .Select-control .Select-arrow-zone .Select-arrow'; | ||
const tag = | ||
':nth-child(6) .Select .Select-control .Select-arrow-zone .Select-arrow'; | ||
const time = | ||
':nth-child(7) .Select .Select-control .Select-arrow-zone .Select-arrow'; | ||
const kw= | ||
':nth-child(8) > .form-control'; | ||
|
||
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 Filter', () => { | ||
it('should have a clickable arrow button', () => { | ||
cy.get(org, { timeout: delay }) | ||
.eq(0) | ||
.dblclick(); //Clicks the toggle button | ||
// cy.get('div .Select').should('have.attr', 'is-open'); | ||
}); | ||
|
||
it('should have one item', () => { | ||
cy.get(org, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
cy.contains('NES').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. select a random first element instead of giving names because we won't have this name always in list. It would have different names for different events |
||
cy.get('.Select-value #react-select-2--value-0').should('contain', 'NES'); | ||
}); | ||
|
||
it('should deselect item', () => { | ||
cy.get(':nth-child(1)>.Select-value-icon').click(); | ||
}); | ||
|
||
it('should have multiple items', () => { | ||
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(); | ||
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. same here, select random elements, |
||
cy.get('.Select-value #react-select-2--value-1').should( | ||
'contain', | ||
'Recurship' | ||
); | ||
}); | ||
|
||
it('should cancel all the items at once', () => { | ||
cy.get( | ||
':nth-child(1)> .Select > .Select-control > .Select-clear-zone > .Select-clear' | ||
).click(); | ||
}); | ||
// cy.get('form .btn').click(); | ||
}); | ||
|
||
//BUGS FOUND | ||
//no validation on the YYYY [year] beacuse it's accepting more than 4 digits | ||
//event END date should not be less than the event START date | ||
|
||
context('Test for Date Filter', () => { | ||
it('should only accept a correct date format', () => { | ||
cy.get("input[name='filterDateTo']") | ||
.type('2018-01-09') | ||
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. you can give a random value of date by moment.add or moment.subtract methods |
||
.should('have.value', '2018-01-09'); //Start Event Date | ||
cy.get("input[name='filterDateFrom']") | ||
.type('2011-01-09') | ||
.should('have.value', '2011-01-09'); //End Event date | ||
}); | ||
}); | ||
|
||
context('Test for location filter ', () => { | ||
it('should only have single item', () => { | ||
cy.get(loc, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
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' | ||
); | ||
}); | ||
}); | ||
|
||
context('Test for sponsors filter', () => { | ||
it('should have one item', () => { | ||
cy.get(spons, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
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(); | ||
}); | ||
}); | ||
|
||
context('Test for Tags filter', () => { | ||
it('should have one item', () => { | ||
cy.get(tag, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
cy.contains('javascript').click(); | ||
cy.get('.Select-value #react-select-5--value-0').should( | ||
'contain', | ||
'javascript' | ||
); | ||
}); | ||
|
||
it('should deselect item', () => { | ||
cy.get('.Select-value-icon').click(); | ||
}); | ||
|
||
it('should have multiple items', () => { | ||
cy.get(tag, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
cy.contains('abc').click(); | ||
cy.get('.Select-value #react-select-5--value-0').should( | ||
'contain', | ||
'abc' | ||
); | ||
|
||
cy.get(tag, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
cy.contains('javascript').click(); | ||
cy.get('.Select-value #react-select-5--value-1').should( | ||
'contain', | ||
'javascript' | ||
); | ||
}); | ||
|
||
it('should cancel all the items at once', () => { | ||
cy.get( | ||
':nth-child(6) > .Select > .Select-control > .Select-clear-zone > .Select-clear' | ||
).click(); | ||
}); | ||
|
||
}) | ||
|
||
context('Test for Time filter', () => { | ||
it('should have one item', () => { | ||
cy.get(time, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
cy.contains('Noon').click(); | ||
cy.get('.Select-value #react-select-6--value-0').should( | ||
'contain', | ||
'Noon' | ||
); | ||
}); | ||
|
||
it('should deselect item', () => { | ||
cy.get('.Select-value-icon').click(); | ||
}); | ||
|
||
it('should have multiple items', () => { | ||
cy.get(time, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
cy.contains('Morning').click(); | ||
cy.get('.Select-value #react-select-6--value-0').should( | ||
'contain', | ||
'Morning' | ||
); | ||
|
||
cy.get(time, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
cy.contains('Evening').click(); | ||
cy.get('.Select-value #react-select-6--value-1').should( | ||
'contain', | ||
'Evening' | ||
); | ||
}); | ||
|
||
it('should cancel all the items at once', () => { | ||
cy.get( | ||
':nth-child(7) > .Select > .Select-control > .Select-clear-zone > .Select-clear' | ||
).click(); | ||
}); | ||
|
||
}) | ||
|
||
context('Test for Key Words filter', () => { | ||
it('should accept word ', () => { | ||
cy.get(kw).type('sasta') | ||
cy.get(kw).should('have.value','sasta') | ||
}); | ||
|
||
}); | ||
|
||
|
||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ import App from '../App/App'; | |
const Root = () => ( | ||
<div> | ||
<App /> | ||
<DevTools /> | ||
{/* <DevTools /> */} | ||
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. Don't commit this line. |
||
</div> | ||
); | ||
|
||
|
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.
it could be more generic if you make a function that take index and return selector with that index