Skip to content

Upgrade cypress to 14.4 and enable it on for PRs with chrome only, for all browsers on manual, push, schedule #9452

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

Merged

Conversation

jrafanie
Copy link
Member

@jrafanie jrafanie commented May 23, 2025

  • Upgrade cypress to 14.4

  • Run cypress via chrome only on pull requests

    Allow full cypress runs with all browsers on:

    • adhoc workflow_dispatch
    • pushes
    • schedule

TODO list:

  • Disable './miq_debug.js' in dev mode for cypress - currently blocked trying to detect if we're running under cypress via environment variable.
  • Consider dropping rate limit / rack attack entirely for cypress or change the configuration for cypress 'mode' so we don't need to do the hack in the UI rake task We will handle this as a followup
  • should we extract the 14.4 upgrade out of this PR? we will do it here

@jrafanie jrafanie requested a review from a team as a code owner May 23, 2025 17:42
@jrafanie jrafanie force-pushed the enable-cypress-on-push-pr-with-chrome-only branch 2 times, most recently from 43fce3b to 8da6be6 Compare May 23, 2025 22:11
This was referenced May 27, 2025
@jrafanie jrafanie force-pushed the enable-cypress-on-push-pr-with-chrome-only branch from 8da6be6 to f442479 Compare May 27, 2025 13:44
Comment on lines 21 to 22
#- firefox
#- edge
Copy link
Member

Choose a reason for hiding this comment

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

I know this PR is WIP, but I think we can keep these in place, and use conditionals like if: ${{ matrix.cypress-browser == 'chrome' && github.event_name == 'push' }} or something similar to enable it only in certain cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, just trying to figure out how to get the flakiness out... it's 2009 all over again

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok, pushed some changes... I can't access matrix early on to skip the whole workflow so I had to skip each step. To avoid having that logic copy / pasted everywhere, I added a step to contain the logic and reuse it later on.

@jrafanie jrafanie force-pushed the enable-cypress-on-push-pr-with-chrome-only branch from 47a81f6 to 2bf2dfd Compare May 27, 2025 21:35
exit $?.exitstatus unless system("bundle exec rails runner 'MiqServer.my_server.add_settings_for_resource(:server => {:rate_limiting => {:request => {:limit => 99999}}})'")
exit $?.exitstatus unless system("bundle exec rails runner 'MiqServer.my_server.add_settings_for_resource(:server => {:rate_limiting => {:request => {:limit => 99999}, :ui_login => {:limit => 99999}}})'")
Copy link
Member

Choose a reason for hiding this comment

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

Alternatively, maybe we can encode this into the rate limiter itself here with the numbers or here with the conditional in the first place? I never liked this line because it changes settings.

Copy link
Member Author

@jrafanie jrafanie May 28, 2025

Choose a reason for hiding this comment

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

Good idea. I threw this in to try to get green but you bring up a good point. Is there any reason in development to have rack attack configured? Clearly, we can do an exception for cypress but I wonder what's the benefit to having it in dev mode.

Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason to development has rack attack configured?

That's actually a great question. The only reason I can think of is since we disable in testing, then there's nothing else running through this code otherwise. If we get an upgrade to the gem that breaks something it won't be caught in dev or test otherwise (but probably would be caught in PEN test). Maybe the security suite should be updated to ensure it's working as intended?

@Fryguy Fryguy self-assigned this May 28, 2025
@jrafanie jrafanie force-pushed the enable-cypress-on-push-pr-with-chrome-only branch 2 times, most recently from af96e1a to dd3fd8a Compare May 28, 2025 16:20
@jrafanie jrafanie force-pushed the enable-cypress-on-push-pr-with-chrome-only branch 5 times, most recently from f131e58 to c1ebaf0 Compare May 28, 2025 20:02
- name: Set up system
run: bin/before_install
if: ${{ matrix.cypress-browser == 'chrome' || (matrix.cypress-browser != 'chrome' && github.event_name != 'pull_request') }}
Copy link
Member

@Fryguy Fryguy May 28, 2025

Choose a reason for hiding this comment

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

I know this is WIP, so future cleanup idea.

I'm thinking let's shove this into an ENV var with a sensible name, then use that later. Either that or run an initial step that sets an output to the result and use that. So for env idea, something like

    env:
      TEST_SUITE: spec:cypress
      RUN_CYPRESS: ${{ matrix.cypress-browser == 'chrome' || (matrix.cypress-browser != 'chrome' && github.event_name != 'pull_request') }}
      ...
    steps:
    ...
    - name: Set up system
      run: bin/before_install
      if: ${{ env.RUN_CYPRESS }}

Copy link
Member

Choose a reason for hiding this comment

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

LOL you read my mind.

Copy link
Member

Choose a reason for hiding this comment

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

Though I think env might be cleaner and I think it can support booleans

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 like the name. I think we might want pushes, manual / adhoc, and scheduled runs to be full browser support. Either way, we can tweak it once we have better ideas.

@jrafanie jrafanie force-pushed the enable-cypress-on-push-pr-with-chrome-only branch 3 times, most recently from d3bebb0 to 1318ebb Compare May 28, 2025 22:16
jrafanie added 2 commits May 29, 2025 09:55
Allow full cypress runs with all browsers on:
* adhoc workflow_dispatch
* pushes
* schedule

Currently, firefox is very slow, over 40 minutes, while chrome and edge
are under 20 minutes each.  For now, let's get chrome to verify PRs
while we upgrade cypress and try to improve the speed further.
jrafanie added 2 commits May 29, 2025 09:56
With this configuration, we expect each test to pass 1 out of 3 tries.
If it does, it passes.  We can track which tests often are flaky by watching
for retries, while also keeping the test suite green.
@jrafanie jrafanie force-pushed the enable-cypress-on-push-pr-with-chrome-only branch from 471cbf9 to 694c8ef Compare May 29, 2025 13:57
if (process.env.NODE_ENV === 'development' && process.env.CYPRESS !== 'true') {
require('./miq_debug.js');
require('./miq_debug.css');
}
Copy link
Member Author

Choose a reason for hiding this comment

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

TODO: this conditional doesn't work correctly as CYPRESS env variable is never defined. I tried REACT_APP_CYPRESS and other things such as trying to push it into webpack but nothing worked so for now, I have this removed in this PR as the notifications cause far too many sporadic test failures.

@Fryguy Fryguy force-pushed the enable-cypress-on-push-pr-with-chrome-only branch from 694c8ef to 995315c Compare May 29, 2025 15:02
@jrafanie jrafanie changed the title [WIP] Enable cypress on push pr with chrome only Enable cypress on push pr with chrome only May 29, 2025
@jrafanie jrafanie added spassky/yes and removed wip labels May 29, 2025
@jrafanie jrafanie changed the title Enable cypress on push pr with chrome only Upgrade cypress to 14.4 and enable it on for PRs with chrome only, for all browsers on manual, push, schedule May 29, 2025
@Fryguy Fryguy merged commit f235477 into ManageIQ:master May 29, 2025
18 checks passed
@jrafanie jrafanie deleted the enable-cypress-on-push-pr-with-chrome-only branch May 29, 2025 18:37
@Fryguy
Copy link
Member

Fryguy commented Jun 3, 2025

@jrafanie A conflict occurred during the backport of this pull request to spassky.

If this pull request is based on another pull request that has not been marked for backport, add the appropriate labels to the other pull request. Otherwise, please create a new pull request direct to the spassky branch in order to resolve this.

Conflict details:

diff --cc yarn.lock
index 033be2987d,fba156267c..0000000000
--- a/yarn.lock
+++ b/yarn.lock
@@@ -15837,12 -15837,12 +15837,18 @@@ __metadata
    languageName: node
    linkType: hard
  
++<<<<<<< HEAD
 +"semver@npm:^7.2.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.5.3":
 +  version: 7.7.1
 +  resolution: "semver@npm:7.7.1"
++=======
+ "semver@npm:^7.2.1, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.7.1":
+   version: 7.7.2
+   resolution: "semver@npm:7.7.2"
++>>>>>>> f2354776cc (Merge pull request #9452 from jrafanie/enable-cypress-on-push-pr-with-chrome-only)
    bin:
      semver: bin/semver.js
 -  checksum: 10/7a24cffcaa13f53c09ce55e05efe25cd41328730b2308678624f8b9f5fc3093fc4d189f47950f0b811ff8f3c3039c24a2c36717ba7961615c682045bf03e1dda
 +  checksum: 10/4cfa1eb91ef3751e20fc52e47a935a0118d56d6f15a837ab814da0c150778ba2ca4f1a4d9068b33070ea4273629e615066664c2cfcd7c272caf7a8a0f6518b2c
    languageName: node
    linkType: hard
  

@Fryguy
Copy link
Member

Fryguy commented Jun 3, 2025

Backported to spassky in commit 93cc8c7.

commit 93cc8c71de75fdf15db8f6b57bc34700be3f1b88
Author: Jason Frey <[email protected]>
Date:   Thu May 29 11:24:57 2025 -0400

    Merge pull request #9452 from jrafanie/enable-cypress-on-push-pr-with-chrome-only
    
    Upgrade cypress to 14.4 and enable it on for PRs with chrome only, for all browsers on manual, push, schedule
    
    (cherry picked from commit f2354776cc8e8b91090399336604709c1c6f3186)

Fryguy added a commit that referenced this pull request Jun 3, 2025
…-chrome-only

Upgrade cypress to 14.4 and enable it on for PRs with chrome only, for all browsers on manual, push, schedule

(cherry picked from commit f235477)
@jrafanie
Copy link
Member Author

jrafanie commented Jun 3, 2025

@Fryguy did you manually fix the conflict? Is there anything more to do here? I can test it later.

@Fryguy
Copy link
Member

Fryguy commented Jun 3, 2025

I figured out that we had to backport #9434 first

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

Successfully merging this pull request may close these issues.

3 participants