-
Notifications
You must be signed in to change notification settings - Fork 22
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
Week-1 task Completed #122
Conversation
cypress/integration/event/active.js
Outdated
|
||
beforeEach('Open the English Page', () => { | ||
cy.navigateToHomePage('/articles/english.html') | ||
cy.wait(2000) |
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.
never use waits unless absolutely needed, which is not the case here, delete them all.
cypress handles waits automatically
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.
The wait is required in my system as it takes time to load the changes. I have removed it while pushing the current changes.
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.
for slow networks u can use
https://docs.cypress.io/guides/references/configuration#Timeouts
in the configuration file cypress.json
to increase the timeout
cypress/support/index.js
Outdated
|
||
|
||
|
||
Cypress.on('uncaught:exception', (err, runnable) => { |
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.
why this?
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 is required when the preview reacts unexpectedly due to some issues(mainly connectivity issues as it delays the response ) so this command prevents the cypress test to fail due to the errors generated from our app.
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.
a test should always fail whenever something goes wrong, this shouldn't be used
cypress/support/commands.js
Outdated
const lang = tag.attr('lang') | ||
|
||
preview.Body().should('be.visible') | ||
.and('have.class','wikipediapreview-body-disambiguation') |
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 should be in a page-object, no selectors here that might be useful for other tests
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.
I do understand your concern. But those classes are added during runtime to render the different layouts. Thereby it is necessary to check whether they are added or not.
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.
so don't use commands.js for this, use page-objects elements that are only used searched for when needed.
avoid using commands.js for specific test logic, only when it's for actions on the app that always use present elements like we do here - https://github.com/wikimedia/wikipedia-kaios/blob/main/cypress/support/commands.js
u can delete most of ur commands.js code and move it to test and page-object files
cypress/support/commands.js
Outdated
// Custom Command to check the Preview in Offline Mode | ||
Cypress.Commands.add('CheckPreviewOffline' , () =>{ | ||
|
||
preview.Preview().should('be.visible') |
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.
tabs and spaces, format the code correctly
|
did u do steps 4 and 5 from my previous comment? |
cypress/page-objects/preview.js
Outdated
|
||
// Wikipedia Preview Footer | ||
getFooter() { | ||
return cy.get( 'div.wikipediapreview' ).find( ' div.wikipediapreview-footer' ) |
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.
why not do
cy.get('div.wikipediapreview-footer')
only instead of get+find?
you don't need the check.js class, delete it and add the methods to check for elements inside the preview page object. when u have a page object class, you can create a method inside that page object to check for the presence of the elements. if u don't understand what I mean we can talk about this during a meeting. P.S.: similarly to the kaios files, ur page objects need to end in |
* Week-1 task Completed (#122) * Week-1 task Completed * PR Review changes * PR Review Changes * PR Review changes * Layout Testing Changes * Offline Testing Functions * Delete expand-spec.js * add eslint package and run eslint * small fix, timeout increase * skiping failing tests * Update config.yml add cypress tests * PR Review Changes added * Removed Waits * Changes check Preview function to objects * Changes check Preview function to objects * check.js Removed and helpers folder created for network.js * Added page.js in Page-Object * final changes * bump cypress version, make code more clear * package.lock * package.json changed * Package.json Changed * package.json changed * config.yml changed * adding waits * adding waits Co-authored-by: Gabriel Pita <dvpita@gmail.com> * package lock * change circleci config * remove useless comments * linter fixes * fix * fix * eslint * fix comments Co-authored-by: Shailesh <41967175+shailesh1028@users.noreply.github.com>
Week-1 Task
Layout testing: Created test to check the different version/layout of preview based on the API data. This will help when we run the tests on different viewports.
Apart from this, added an event test that includes hovering and clicking over the span to generate the preview.
Error Found: The close button does not work in all other modes except in Standard mode.