-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add_UI_Test/Cypress/Basic_tests #190
base: develop
Are you sure you want to change the base?
Conversation
…nto add-cypress
…into add-cypress
Delete user
…into add-cypress
delete-user\add-confirmation
delete-user/fix_comments
…into add-cypress
UI-tests/Add_cypress
…into add-cypress
Add cypress
Are cypress/support and cypress/plugins necessary? |
cypress/support handles all the logic of the commands (functions to doings things in the UI) and services (functions to doings things with requests - directly to the server) cypress/plugins in not necessary for now, but I'll continue to write tests when the most of the UI functionality will merge to dev so if it never be used I'll delete it. |
//cy.url().should('include', '/signIn') | ||
|
||
//cy.get('.signIn_input[name=email]') | ||
//.type('[email protected]') | ||
//.should('have.value', '[email protected]') |
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.
remove commented out code
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.
fixed
beforeEach(() => { | ||
//cy.logIn(true); | ||
}) | ||
|
||
after(() => { | ||
//cy.logOut(); | ||
}) |
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.
Is this needed? If not, remove the code
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 will be needed, I created the basic template for the tests after the functionality will come its going to be used
beforeEach(() => { | ||
//cy.logIn(true); | ||
}) | ||
|
||
after(() => { | ||
//cy.logOut(); | ||
}) |
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.
Is this needed? If not, remove the code
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.
like the comment above
@@ -0,0 +1,21 @@ | |||
/// <reference types="cypress" /> |
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.
Is this file needed?
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 will, if not ill remove it
// *********************************************** | ||
// This example commands.js shows you how to |
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.
Is this file needed?
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 will
Hey, another point which is worth fixing is the file names. The Google JavaScript Style Guide says:
So your files such as "ProfilePage/cy_User_Card_Actions.js" should be renamed and I'd say to lowercase, to match our *.py files. |
Cypress.Commands.add("loginError", (user,password) => { | ||
login(user,password); | ||
cy.get('.callout').should('contain', 'Incorrect username or password'); | ||
}) | ||
|
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.
If I understood this command correctly, it tests if the message contains that specific text. This test will fail if we translate the message (and we are). Can you check for status code instead maybe?
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.
when the login will merge ill check it, for now when we dont yet have login its not called
Cypress.Commands.add("logoutUI", () => { | ||
cy.get(".icon-account_circle").click(); | ||
cy.get(".icon-sign-out").click(); | ||
cy.get('.btn').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.
I looked at the Cypress documentation for their recommended best practices , and they list from worst to best how to select an element. They discourage selecting by tags, classes or IDs:
Targeting the element above by tag, class or id is very volatile and highly subject to change. You may swap out the element, you may refactor CSS and update ID’s, or you may add or remove classes that affect the style of the element.
Instead, adding the data-cy attribute to the element gives us a targeted selector that’s only used for testing.
The data-cy attribute will not change from CSS style or JS behavioral changes, meaning it’s not coupled to the behavior or styling of an element.
Additionally, it makes it clear to everyone that this element is used directly by test code.
I think we should follow their recommendation here, as I can already see how every small fix in the a css or id name will lead to errors here (I commented on this line, but this is a general comment for how we access selectors in the PR).
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.
we dont have logout yes, Ill add data-cy attribute when we will have logout functionality
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.
Great :) but that was just one example. In tests/tests-ui/cypress/support/enums/enums_profilePage.js you also use this style
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.
Great job! Please resolve the conflicts :)
…into add-cypress
Codecov Report
@@ Coverage Diff @@
## develop #190 +/- ##
===========================================
+ Coverage 95.15% 99.36% +4.21%
===========================================
Files 76 36 -40
Lines 3382 1418 -1964
===========================================
- Hits 3218 1409 -1809
+ Misses 164 9 -155
Continue to review full report at Codecov.
|
Conflicts fixed |
<<<<<<< HEAD | ||
new_user=Depends(get_placeholder_user), | ||
new_event=Depends(get_placeholder_event)): | ||
|
||
======= | ||
new_user=Depends(get_placeholder_user)): | ||
>>>>>>> b91708d299bde83bbd10ff93496b23af9d35dd8f |
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.
conflict.
No description provided.