[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.
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.
selectors should be defined as constants
| }); | ||
| }); | ||
| context('Test for Organization Filters', () => { | ||
| it('should have an arrow button', () => { |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
you can give a random value of date by moment.add or moment.subtract methods
| <div> | ||
| <App /> | ||
| <DevTools /> | ||
| {/* <DevTools /> */} |
There was a problem hiding this comment.
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.
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.
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.
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.
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.
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.
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.
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.