The frontend testing guide mentions frontend integration tests as a testing level between unit tests and system tests (spec/features/).
In Karma the distinction between frontend integration tests and unit tests is not clear and we have not framework that supports the former. Additionally we are aiming at migrating all Karma tests to Jest (&895 (closed)).
In Jest we are currently running all tests in JSDOM and not in a browser. This implies that certain scenarios cannot be tested or behave differently than in the real application. Additionally Jest does not provide a framework for integration level tests either.
This issue is meant to evaluate our options by implementing a proof of concept for frontend integration tests.
Old description
Support running Jest tests in browsers
Our Jest tests currently run with jsdom which is the default. We should look into ways to also make it run in real browsers.
I looked into running the existing Jest tests in a browser using jest-puppeteer following the official guide. As part of this I realized that we are remote controlling a browser (as the name puppeteer suggests) but not running our code in the browser environment. That means we would still test our units / components in a node.js environment and only use the DOM of a browser. To me this defeats the original intention behind this issue.
However I'd like to rescope this issue based on conversations I had with @pslaughter and @dennis:
Given that the overall goal is to test the integration of our frontend code with a browser environment, we should run these type of tests at the integration level separately from the unit testing level. That is: Unit tests will continue to run with Jest in JSDOM (spec/frontend/) and we will create a separate environment for running frontend integration tests in a browser environment (spec/frontend-integration/ ?). I will update the frontend testing guide to make this more clear (currently blocked by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/31852).
I have scheduled a call with @wlsf82 to discuss whether it makes more sense to leverage Jest for the integration tests (which does not ship with such a concept) or if we get more benefit from a tool like Cypress. Cypress in particular only runs in Chrome and Electron so far.
Since you are thinking about using Cypress, I have already experimented with it for some end-to-end tests on GitLab, and it works pretty well. See https://gitlab.com/wlsf82/gitlab-cypress.
@winh, as I have mentioned during our Zoom call, in this issue, I list some pros and cons of Cypress. I hope it helps you in deciding on using it or not.
GitLab is moving all development for both GitLab Community Edition
and Enterprise Edition into a single codebase. The current
gitlab-ce repository will become a read-only mirror, without any
proprietary code. All development is moved to the current
gitlab-ee repository, which we will rename to just gitlab in the
coming weeks. As part of this migration, issues will be moved to the
current gitlab-ee project.
If you have any questions about all of this, please ask them in our
dedicated FAQ issue.
Using "gitlab" and "gitlab-ce" would be confusing, so we decided to
rename gitlab-ce to gitlab-foss to make the purpose of this FOSS
repository more clear
I created a merge requests for CE, and this got closed. What do I
need to do?
Everything in the ee/ directory is proprietary. Everything else is
free and open source software. If your merge request does not change
anything in the ee/ directory, the process of contributing changes
is the same as when using the gitlab-ce repository.
Will you accept merge requests on the gitlab-ce/gitlab-foss project
after it has been renamed?
No. Merge requests submitted to this project will be closed automatically.
Will I still be able to view old issues and merge requests in
gitlab-ce/gitlab-foss?
Yes.
How will this affect users of GitLab CE using Omnibus?
No changes will be necessary, as the packages built remain the same.
How will this affect users of GitLab CE that build from source?
Once the project has been renamed, you will need to change your Git
remotes to use this new URL. GitLab will take care of redirecting Git
operations so there is no hard deadline, but we recommend doing this
as soon as the projects have been renamed.
Where can I see a timeline of the remaining steps?