-
Notifications
You must be signed in to change notification settings - Fork 3k
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 cypress support #1951
Add cypress support #1951
Conversation
Pull Request Test Coverage Report for Build 6657
💛 - Coveralls |
@@ -8,14 +8,15 @@ | |||
|
|||
describe('Check server availability', () => { | |||
it('Server web interface is available', () => { | |||
cy.visit('http://localhost:8080') | |||
cy.visit('/') | |||
cy.wait(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.
What is the usual practice here? Could you please quote its documentation?
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.
Cypress documentation about this: https://docs.cypress.io/api/commands/visit.html#Prefixes
I moved "baseUrl" parameter to the configuration file (cypress.json). This will make it easier to navigate in location, and if need to change it than only need to change it in one place.
Added "wait" for loading the preloader. This will help avoid errors in checking the availability of page elements when first visit the page after starting docker containers.
This may be reworked in the future when more tests are added.
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.
Hi, maybe try to play with visit
arguments: retryOnStatusCodeFailure
or retryOnNetworkFailure
and timeout
as cypress docs say:
https://docs.cypress.io/api/commands/visit.html#Arguments
Also from the docs about availability of page elements:
Can you see what Cypress is doing under the hood? It’s automatically waiting and retrying because it expects the content to eventually be found in the DOM. It doesn’t immediately fail!
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.
Hi, I removed the wait(). Locally, the test passed without this command.
@dvkruchinin , could you please modify CONTRIBUTION.md guide and add information how to run cypress tests locally? |
Done. Added information. |
Modifications: - .travis.yml: adding command for run testin via cypress - Dockerfile.ci: addin install necessary package for correct cypress works. Adding install cypress via npm. - docker-compose.ci.yml: Starting necessary docker containers for cypress testing. - tests/cypress.json: Cypress configuration file - tests/cypress/integration/auth_page.js: little bit fix. - CONTRIBUTING.md: add documentation how to run cypress tests locally
8dbf2dd
to
55a29f0
Compare
tests/cypress.json
Outdated
@@ -0,0 +1,4 @@ | |||
{ | |||
"video": false, | |||
"baseUrl": "http://cvat_ui" |
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 would suggest setup default baseUrl to "http://localhost:3000", create another file (like cypress_ci.json
) and add parameter --config-file=cypress_ci.json
to the command on CI. In this case users do not need change something by default (like described in CONTRIBUTING.md
)
https://docs.cypress.io/guides/references/configuration.html#Options
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.
Yes, I agree, thanks. This is the more correct way. I'll do it now.
Update CONTRIBUTING.md.
Motivation and context
Adding cypress support. And automation of running tests in CI.
How has this been tested?
Manual testing.
Checklist
develop
branchcvat-core, cvat-data and cvat-ui)
License
Feel free to contact the maintainers if that's a concern.