-
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
Conversation
it('should have an arrow button', () => { | ||
cy.get( | ||
':nth-child(1) .Select .Select-control .Select-arrow-zone .Select-arrow', | ||
{ timeout: 30000 } |
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.
timeouts should be defined as constants
|
||
it('should select one option', () => { | ||
cy.get( | ||
':nth-child(1) .Select .Select-control .Select-arrow-zone .Select-arrow', |
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.
selectors should be defined as constants
}); | ||
}); | ||
context('Test for Organization Filters', () => { | ||
it('should have an arrow button', () => { |
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.
im not sure what this test is actually testing. We are looking to test functionality not design.
) | ||
.eq(0) | ||
.click(); | ||
cy.contains('Recurship').click(); //Selects the dropdown menu option |
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.
Since you are testing against our live environment, it would be better to make generic asserts like (list contains atleast one item).
':nth-child(7) .Select .Select-control .Select-arrow-zone .Select-arrow'; | ||
const kw= | ||
':nth-child(8) > .form-control'; | ||
|
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
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 comment
The 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(org, { timeout: delay }) | ||
.eq(0) | ||
.click(); | ||
cy.contains('Recurship').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.
same here, select random elements,
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 comment
The 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
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Don't commit this line.
context('Test for Filters Route', () => { | ||
it('Should be on Filters page', () => { | ||
cy.visit('/events'); | ||
cy.get('h3').should('contain', 'Welcome to Event Management'); |
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.
This heading will be removed in future, can you please assert something else
}); | ||
context('Test for Key Words filter', () => { | ||
it('should display 1 result', () => { | ||
cy.get(kw).type('const'); |
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.
make a data set for these values
cy.get(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 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
/* eslint no-undef: "error" */ | ||
|
||
import { constants } from '../dataSet'; | ||
const EVEND = Cypress.moment() |
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.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
constants.kw is not a good name.
.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 comment
The 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
); | ||
}); | ||
|
||
it('should cancel all the items at once', () => { |
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.
Each "it" statement needs to have an assertion. Otherwise its not very useful. In this case you need to assert that the state got reset
@Faria-Ejaz can you please fix the codacy issues in this |
No description provided.