Skip to content

Upgrade cypress 10.6.0 devDependencies in ui#2743

Merged
pedrottimark merged 2 commits intomasterfrom
ui-devDependencies-cypress-10.6.0
Aug 22, 2022
Merged

Upgrade cypress 10.6.0 devDependencies in ui#2743
pedrottimark merged 2 commits intomasterfrom
ui-devDependencies-cypress-10.6.0

Conversation

@pedrottimark
Copy link
Contributor

@pedrottimark pedrottimark commented Aug 19, 2022

Description

Catch up with cypress after pause to fix intermittent test failures in OpenShift CI.

Welcome_to_Cypress

Choose_a_Browser

Click a name to run a test file
Specs

When the tests have finished, click the Specs button to run another test file
Results

Resources

  1. https://docs.cypress.io/guides/references/changelog#10-4-0
    • Upgraded electron from 18.3.0 to 19.0.8
    • Upgraded bundled Node.js version from 16.13.2 to 16.14.2
    • Upgraded bundled Chromium version from 100.0.4896.75 to 102.0.5005.148
  2. https://docs.cypress.io/guides/references/changelog#10-2-0
  3. https://docs.cypress.io/guides/references/changelog#10-0-0
  4. https://docs.cypress.io/guides/references/migration-guide#Migrating-to-Cypress-version-10-0
  5. https://docs.cypress.io/guides/references/configuration
  6. https://docs.cypress.io/guides/core-concepts/writing-and-organizing-tests#Support-file
    • To include code before your test files, supportFile is set to look for cypress/support/e2e.js

Changed files

  1. Replace ui/cypress.json with ui/cypress.config.js

    {
        "baseUrl": "https://localhost:3000", // e2e
        "blockHosts": ["*.*"],
        "chromeWebSecurity": false,
        "ignoreTestFiles": ["**/constants/**/*", "**/helpers/**/*"], // e2e specPattern
        "viewportWidth": 1440,
        "viewportHeight": 850,
        "numTestsKeptInMemory": 0,
        "pluginsFile": false, // not needed
        "retries": { // Global options: not needed because default value
            "runMode": 0,
            "openMode": 0
        }
    }
    const { defineConfig } = require('cypress');
    
    module.exports = defineConfig({
        blockHosts: ['*.*'], // Browser options
        chromeWebSecurity: false, // Browser options
        numTestsKeptInMemory: 0, // Global options
        viewportHeight: 850, // Viewport options
        viewportWidth: 1440, // Viewport options
    
        e2e: {
            baseUrl: 'https://localhost:3000',
            specPattern: 'cypress/integration/**/*.test.js',
        },
    });
  2. Replace attachFile with selectFile method:

    • network.test.js: 1 occurrence
    • policies/importPolicy.test.js: 4 occurrences
  3. Delete obsolete mainmenu.test.js

  4. Adjust support files

    • Rename cypress/support/index.js as cypress/support/e2e.js which is the new default for e2e test.
    • Edit cypress/support/commands.js to delete import 'cypress-file-upload'; which is superseded by selectFile method.
      Residue: Refactor network tests to call helper function instead of Cypress.Commands.add('getCytoscape', …) command.

Checklist

  • Investigated and inspected CI test results
  • Edited integration tests

Testing Performed

  1. yarn cypress-open in ui/apps/platform select an assortment of tests:
    • clusters/clusters.test.js
    • compliance/complianceDashboard.test.js
    • configmanagement/dashboard.test.js 1 test fails locally
    • integrations/externalBackups.test.js
    • integrations/general.test.js
    • integrations/imageIntegrations.test.js
    • integrations/notifiers.test.js
    • networkGraph/networkFlows.test.js 5 tests fail locally
    • networkGraph/networkGraph.test.js 1 test fails locally
    • policies/exportPolicy.test.js
    • policies/importPolicy.test.js has 4 occurrences of selectFile method
    • policies/policyWizardStep3.test.js
    • violations/violations.test.js
    • vulnmanagement/dashboard.test.js
    • risk/risk.test.js
    • general.test.js
    • network.test.js has 1 occurrence of selectFile method
    • productBranding.test.js
    • systemconfig.test.js

@pedrottimark
Copy link
Contributor Author

/test go-unit-tests

@ghost
Copy link

ghost commented Aug 19, 2022

Images are ready for the commit at 0abad1f.

To use with deploy scripts, first export MAIN_IMAGE_TAG=3.71.x-324-g0abad1f13f.

@pedrottimark
Copy link
Contributor Author

/test style-checks

@pedrottimark
Copy link
Contributor Author

The defineConfig helper function intended to provide automatic code completion for configuration in many popular code editors had subtle side-effect to cause some errors in unit test files:

ui/apps/platform/src/Containers/Dashboard/PatternFly/ScopeBar.test.tsx
56:29  error  Unsafe return of an `any` typed value  @typescript-eslint/no-unsafe-return
70:29  error  Unsafe return of an `any` typed value  @typescript-eslint/no-unsafe-return
120:29  error  Unsafe return of an `any` typed value  @typescript-eslint/no-unsafe-return
ui/apps/platform/src/services/cancellationUtils.test.ts
19:9  error  Unsafe return of an `any` typed value  @typescript-eslint/no-unsafe-return
27:9  error  Unsafe return of an `any` typed value  @typescript-eslint/no-unsafe-return

@openshift-ci
Copy link

openshift-ci bot commented Aug 19, 2022

@pedrottimark: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/gke-postgres-qa-e2e-tests 0abad1f link false /test gke-postgres-qa-e2e-tests

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@pedrottimark pedrottimark requested a review from dvail August 19, 2022 18:46
Copy link
Contributor

@dvail dvail left a comment

Choose a reason for hiding this comment

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

Amazing the seemingly unrelated tooling changes that cause issues in other parts of the code base. 🤷

@pedrottimark
Copy link
Contributor Author

Yeah, out of an abundance of caution, I will merge first thing Monday morning.

@pedrottimark pedrottimark merged commit beb4154 into master Aug 22, 2022
@pedrottimark pedrottimark deleted the ui-devDependencies-cypress-10.6.0 branch August 22, 2022 10:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants