Skip to content
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

Open
wants to merge 42 commits into
base: develop
Choose a base branch
from

Conversation

Lisafiluz
Copy link

No description provided.

Lisaf Iluz and others added 30 commits January 16, 2021 11:08
delete-user\add-confirmation
@yammesicka
Copy link
Member

Are cypress/support and cypress/plugins necessary?

@Lisafiluz
Copy link
Author

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.

Comment on lines 23 to 27
//cy.url().should('include', '/signIn')

//cy.get('.signIn_input[name=email]')
//.type('[email protected]')
//.should('have.value', '[email protected]')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove commented out code

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Comment on lines +5 to +11
beforeEach(() => {
//cy.logIn(true);
})

after(() => {
//cy.logOut();
})
Copy link
Contributor

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

Copy link
Author

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

Comment on lines +6 to +12
beforeEach(() => {
//cy.logIn(true);
})

after(() => {
//cy.logOut();
})
Copy link
Contributor

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

Copy link
Author

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" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file needed?

Copy link
Author

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

Comment on lines +1 to +2
// ***********************************************
// This example commands.js shows you how to
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this file needed?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it will

@Gonzom
Copy link
Contributor

Gonzom commented Feb 4, 2021

Hey, another point which is worth fixing is the file names. The Google JavaScript Style Guide says:

File names must be all lowercase and may include underscores (_) or dashes (-), but no additional punctuation. Follow the convention that your project uses.

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.

Comment on lines +10 to +14
Cypress.Commands.add("loginError", (user,password) => {
login(user,password);
cy.get('.callout').should('contain', 'Incorrect username or password');
})

Copy link
Contributor

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?

Copy link
Author

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

Comment on lines +25 to +30
Cypress.Commands.add("logoutUI", () => {
cy.get(".icon-account_circle").click();
cy.get(".icon-sign-out").click();
cy.get('.btn').should('be.visible');

})
Copy link
Contributor

@Gonzom Gonzom Feb 4, 2021

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).

Copy link
Author

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

Copy link
Contributor

@Gonzom Gonzom Feb 4, 2021

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

Copy link
Member

@yammesicka yammesicka left a 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 :)

README.md Show resolved Hide resolved
@codecov-io
Copy link

codecov-io commented Feb 23, 2021

Codecov Report

Merging #190 (7dbe7af) into develop (b91708d) will increase coverage by 4.21%.
The diff coverage is n/a.

Impacted file tree graph

@@             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     
Impacted Files Coverage Δ
app/database/database.py 100.00% <ø> (ø)
app/database/models.py 95.83% <0.00%> (-1.31%) ⬇️
app/dependencies.py 100.00% <0.00%> (ø)
app/telegram/bot.py 100.00% <0.00%> (ø)
app/routers/email.py 100.00% <0.00%> (ø)
app/internal/email.py 100.00% <0.00%> (ø)
app/routers/agenda.py 100.00% <0.00%> (ø)
app/routers/export.py 100.00% <0.00%> (ø)
app/routers/search.py 100.00% <0.00%> (ø)
app/internal/search.py 100.00% <0.00%> (ø)
... and 67 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b91708d...b8cd8d3. Read the comment docs.

@Lisafiluz
Copy link
Author

Conflicts fixed

Comment on lines +44 to +50
<<<<<<< HEAD
new_user=Depends(get_placeholder_user),
new_event=Depends(get_placeholder_event)):

=======
new_user=Depends(get_placeholder_user)):
>>>>>>> b91708d299bde83bbd10ff93496b23af9d35dd8f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants