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

chore: [Multi-domain] Break out separate CI tasks to test the driver with experimentalSessionAndOrigin on #21148

Merged
merged 20 commits into from Apr 21, 2022

Conversation

mjhenkes
Copy link
Member

  • Closes

User facing changelog

n/a

Additional details

This pr creates 4 new CI jobs to run driver tests with the experimentalSessionAndOrigin feature flag enabled.

They are creatively named:

  • driver-integration-tests-firefox-experimentalSessionAndOrigin
  • driver-integration-tests-chrome-experimentalSessionAndOrigin
  • driver-integration-tests-chrome-beta-experimentalSessionAndOrigin
  • driver-integration-tests-electron-experimentalSessionAndOrigin

These jobs only run tests in the 'e2e/multi-domain' folder

The standard jobs have be updated to run all tests not in the 'e2e/multi-domain' folder.

Before

driver-integration-tests-chrome test count was 4748

After

driver-integration-tests-chrome test count is 4419

driver-integration-tests-chrome-experimentalSessionAndOrigin test count is 329

for a total of 4748 (4419 + 329)

How has the user experience changed?

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@mjhenkes mjhenkes added the topic: cy.origin Problems or enhancements related to cy.origin command label Apr 20, 2022
@mjhenkes mjhenkes self-assigned this Apr 20, 2022
@mjhenkes mjhenkes requested a review from a team as a code owner April 20, 2022 14:09
@cypress-bot
Copy link
Contributor

cypress-bot bot commented Apr 20, 2022

Thanks for taking the time to open a PR!

@mjhenkes mjhenkes removed the request for review from a team April 20, 2022 14:09
@@ -2306,32 +2280,6 @@ describe('src/cy/commands/navigation', () => {
return null
})
})

it('does not wait for stability at the end of the command queue when not stable with experimentalSessionAndOrigin', (done) => {
Copy link
Member Author

Choose a reason for hiding this comment

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

test moved to the stability test file

Copy link
Member Author

Choose a reason for hiding this comment

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

Now it's been combined with the test here, so it flexes the test based on the experimental flag

})
})

context('#page loading', () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

this test was added from the navigation test file.

@@ -5,7 +5,9 @@
"scripts": {
"clean-deps": "rm -rf node_modules",
"cypress:open": "node ../../scripts/cypress open",
"cypress:run": "node ../../scripts/cypress run",
"cypress:run": "node ../../scripts/cypress run --spec \"cypress/integration/*/*\",\"cypress/integration/*/!(multi-domain)/**/*\"",
Copy link
Member Author

Choose a reason for hiding this comment

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

I had to do this in two passes. The first glob includes all test files at the level of the multi-domain folder, the second glob includes all tests files beyond the multi-domain folder but not including it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the serialization unit tests outside the multi-domain directory will run twice once #20949 makes it way in. They should work in both scenarios with the flag on/off, but one of the runs will be redundant. I don't think it's a big deal, but I figure I would surface it here.

"cypress:run": "node ../../scripts/cypress run",
"cypress:run": "node ../../scripts/cypress run --spec \"cypress/integration/*/*\",\"cypress/integration/*/!(multi-domain)/**/*\"",
"cypress:open-experimentalSessionAndOrigin": "node ../../scripts/cypress open --config experimentalSessionAndOrigin=true",
"cypress:run-experimentalSessionAndOrigin": "node ../../scripts/cypress run --config experimentalSessionAndOrigin=true --spec \"cypress/integration/e2e/multi-domain/**/*\"",
Copy link
Member Author

Choose a reason for hiding this comment

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

the 'multi-domain' folder should probably be renamed, but that is a task for another PR

Co-authored-by: Matt Schile <mschile@gmail.com>
Copy link
Contributor

@flotwig flotwig left a comment

Choose a reason for hiding this comment

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

This implementation does not spark joy. We are creating 4 new jobs bringing us to 90 jobs once 10.0-release merges, and there is a hard limit of 100. Also, it's just... not the most elegant solution 😄

@mjhenkes tells me that the target date for x-origin is ~2 months out, so it's not the worst thing to have this temporarily. But if this was for longer-term, I'd prefer to see a neater solution, like using an internal Cypress.backend() to signal to the proxy that cy.origin is enabled for these tests.


@mjhenkes I see that this doesn't revert most of the changes made to the driver-integration test suite in feature-multidomain, will there be a future PR to revert those changes?

@cypress
Copy link

cypress bot commented Apr 20, 2022



Test summary

38414 0 465 4Flakiness 1


Run details

Project cypress
Status Passed
Commit c832235
Started Apr 21, 2022 1:02 PM
Ended Apr 21, 2022 1:19 PM
Duration 16:48 💡
OS Linux Debian - 10.10
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

cypress/integration/cypress/proxy-logging_spec.ts Flakiness
1 Proxy Logging > request logging > xhr log has response body/status code when xhr response is logged second

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

Copy link
Contributor

@AtofStryker AtofStryker left a comment

Choose a reason for hiding this comment

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

I think the e2e cross origin navigation system tests and some of the other cy.origin system needs needs to still be system tests because they may completely fail depending on whether the experimentalSessionAndOrigin is on or off, but we can migrate these tests back into integration tests once we have a solution similar to what @flotwig is talking about?

@@ -5,7 +5,9 @@
"scripts": {
"clean-deps": "rm -rf node_modules",
"cypress:open": "node ../../scripts/cypress open",
"cypress:run": "node ../../scripts/cypress run",
"cypress:run": "node ../../scripts/cypress run --spec \"cypress/integration/*/*\",\"cypress/integration/*/!(multi-domain)/**/*\"",
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the serialization unit tests outside the multi-domain directory will run twice once #20949 makes it way in. They should work in both scenarios with the flag on/off, but one of the runs will be redundant. I don't think it's a big deal, but I figure I would surface it here.

driver-integration-tests-firefox-experimentalSessionAndOrigin:
<<: *defaults
resource_class: medium
parallelism: 5
Copy link
Member

Choose a reason for hiding this comment

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

Should we bump this to 6 or 7 since so many tests for multi-domain since we were concerned with longer CI times?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's hard to get a direct comparison but with current parallelization the CI job seems to run for roughly the same duration as our existing job. So I don't think we need to bump these right now.

@mjhenkes
Copy link
Member Author

@flotwig

@mjhenkes I see that this doesn't revert most of the changes made to the driver-integration test suite in feature-multidomain, will there be a future PR to revert those changes?

I was not planning on reverting changes made to the driver-integration test suite that were not addressed in this PR. The changes made are preparing us to be able to enable this feature flag in the future and in general align with our best practice stance of isolating tests from each other. Additionally, with this setup we are proving that the tests will work with the feature flag both on and off.

@flotwig
Copy link
Contributor

flotwig commented Apr 20, 2022

The changes made are preparing us to be able to enable this feature flag in the future and in general align with our best practice stance of isolating tests from each other

@mjhenkes It does change the nature of a lot of assertions though... I don't really think it's a good idea to change a bunch of unrelated tests in a PR. If we're merging the experimental version of a feature, why would it need to change tests for non-experimental code? We can always cherry-pick the test changes back in, not like we'd lose much.

Also, it was a conscious choice to not follow "best practices" of using cy.visit() in each test for some of the changed tests, a lot of the integration tests are very small and simple and take an unnecessary amount of time to run with a cy.visit() that doesn't add additional coverage. I'm not particularly married to the idea of doing it this way, but there is a reason.

@mjhenkes mjhenkes requested a review from a team as a code owner April 20, 2022 18:18
@mjhenkes
Copy link
Member Author

@flotwig

It does change the nature of a lot of assertions though

Could you point out some examples of this? The changes to enable sessions should in theory largely be visiting for each test instead of visiting once in a before. If we're changing what we're asserting on, we should give that a deeper look.

It does change the nature of a lot of assertions though... I don't really think it's a good idea to change a bunch of unrelated tests in a PR.

You're right. If we could do it over we would have made these changes in develop then merged them down into our brach. Unfortunately at this point we're running up against a time constraint, and while I don't think it's ideal to have these test changes, I also don't think it should prevent the PR from being merged as we have test case coverage.

If we're merging the experimental version of a feature, why would it need to change tests for non-experimental code? We can always cherry-pick the test changes back in, not like we'd lose much.

We do need these changes, with this PR we are running all driver tests with experimentalSessionAndOrigin enabled as well as a subset (minus the 'multi-domain' folder) with the flag disabled. This gives us excellent coverage and reduces friction to enable the feature flag as any added feature tests will have to pass with the flag in both states. I see this as a feature of this approach.

Also, it was a conscious choice to not follow "best practices" of using cy.visit() in each test for some of the changed tests, a lot of the integration tests are very small and simple and take an unnecessary amount of time to run with a cy.visit() that doesn't add additional coverage. I'm not particularly married to the idea of doing it this way, but there is a reason.

I pass no judgement on either approach, however, once cy.sessions is enabled you will no longer be able to visit once in a before block and run multiple tests against it. This decision was made before my time. If you have strong feelings about this, we should make sure to address them before this feature becomes generally available. I think bringing up these topics is another feature of this approach 😀

I also really really wish github would let me respond to general comments so I didn't have to do all this quoting nonsense. 😞

@mjhenkes mjhenkes removed the request for review from a team April 21, 2022 14:24
@mjhenkes mjhenkes merged commit e3161a0 into feature-multidomain Apr 21, 2022
@mjhenkes mjhenkes deleted the mo-isolate-multi-domain-tests branch April 21, 2022 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: cy.origin Problems or enhancements related to cy.origin command
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants