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

feat: upgrade Cypress to v10.11.0 #6280

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
steps:
- run:
name: Run monitor-ci tests
command: API_KEY=${MONITOR_CI_API_KEY} PULL_REQUEST=${CIRCLE_PULL_REQUEST} MONITOR_CI_BRANCH="master" UI_BRANCH=${CIRCLE_BRANCH} UI_SHA=${CIRCLE_SHA1} SHA=${CIRCLE_SHA1} RUN_WORKFLOW="build" /run-monitor-ci-tests.bash
command: API_KEY=${MONITOR_CI_API_KEY} PULL_REQUEST=${CIRCLE_PULL_REQUEST} MONITOR_CI_BRANCH="fix_6273_upgrade_cypress_v10_11_0" UI_BRANCH=${CIRCLE_BRANCH} UI_SHA=${CIRCLE_SHA1} SHA=${CIRCLE_SHA1} RUN_WORKFLOW="build" /run-monitor-ci-tests.bash
- store_artifacts:
path: monitor-ci/test-artifacts/results/build-oss-image
destination: test_artifacts/results/build-oss-image
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ module.exports = {
files: [
'src/**/*.test.ts',
'src/**/*.test.tsx',
'cypress/**/*.test.ts',
'cypress/**/*.cy.ts',
'cypress/e2e/util/*.ts',
],
plugins: ['jest'],
Expand Down
27 changes: 27 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import {defineConfig} from 'cypress'

export default defineConfig({
retries: {
runMode: 2,
openMode: 0,
},
numTestsKeptInMemory: 25,
defaultCommandTimeout: 10000,
videoUploadOnPasses: false,
chromeWebSecurity: false,
blockHosts: [
'www.google-analytics.com',
'www.googletagmanager.com',
'www.honeybadger.io',
],
viewportWidth: 1400,
viewportHeight: 1000,
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
specPattern: 'cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
},
})
18 changes: 0 additions & 18 deletions cypress.json

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,13 @@ describe('Dashboard', () => {
'![](https://icatcare.org/app/uploads/2018/07/Thinking-of-getting-a-cat.png)'

cy.getByTestID('add-note--button').click()
cy.getByTestID('note-editor--overlay').within(() => {
cy.getByTestID('markdown-editor').within(() => {
cy.get('textarea').type(`${noteText}`, {force: true})
})
cy.getByTestID('note-editor--preview').contains(markdownImageWarning)
cy.getByTestID('note-editor--preview').should('not.contain', noteText)
cy.getByTestID('save-note--button').click()
})
cy.getByTestID('note-editor--overlay').should('be.visible')
cy.get('.view-line').should('be.visible')
cy.get('.view-line').click()
cy.get('.view-line').type(`${noteText}`)
cy.getByTestID('note-editor--preview').contains(markdownImageWarning)
cy.getByTestID('note-editor--preview').should('not.contain', noteText)
cy.getByTestID('save-note--button').click()
cy.getByTestID('cell--view-empty markdown').contains(markdownImageWarning)
})

Expand All @@ -55,13 +54,12 @@ describe('Dashboard', () => {
"<img src='https://icatcare.org/app/uploads/2018/07/Thinking-of-getting-a-cat.png'/>"

cy.getByTestID('add-note--button').click()
cy.getByTestID('note-editor--overlay').within(() => {
cy.getByTestID('markdown-editor').within(() => {
cy.get('textarea').type(`${noteText}`, {force: true})
})
cy.getByTestID('note-editor--preview').contains(noteText)
cy.getByTestID('save-note--button').click()
})
cy.getByTestID('note-editor--overlay').should('be.visible')
cy.get('.view-line').should('be.visible')
cy.get('.view-line').click()
cy.get('.view-line').type(`${noteText}`)
cy.getByTestID('note-editor--preview').contains(noteText)
cy.getByTestID('save-note--button').click()
cy.getByTestID('cell--view-empty markdown').contains(noteText)
})
})
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ describe('Flows', () => {
it('can use the dynamic flux function selector to build a query', () => {
cy.getByTestID('preset-script').first().click()

cy.getByTestID('flux-editor').should('be.visible')
cy.get('.view-line').should('be.visible')

cy.get('button[title="Function Reference"]').click()
Expand Down Expand Up @@ -215,6 +216,7 @@ describe('Flows', () => {
it('can use the dynamic flux function search bar to search by package or function name', () => {
cy.getByTestID('preset-script').first().click()

cy.getByTestID('flux-editor').should('be.visible')
cy.get('.view-line').should('be.visible')

cy.get('button[title="Function Reference"]').click()
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,17 @@ describe('Operator Page', () => {
})

describe('Operator Page should not be accessible for non-operator users', () => {
beforeEach(() =>
it('should render a 404', () => {
/*
The following error listener only applies in this test.
We have to ignore errors because non-operators
attempting to visit the operator page will throw errors in the console,
and consequently causes Cypress to fail the test if not handled
*/
cy.on('uncaught:exception', () => {
return false
})

cy.flush().then(() =>
cy.signin().then(() => {
cy.get('@org').then(() => {
Expand All @@ -249,9 +259,6 @@ describe('Operator Page should not be accessible for non-operator users', () =>
})
})
)
)

it('should render a 404', () => {
cy.getByTestID('not-found').should('exist')
cy.visit('/')
cy.getByTestID('nav-item--operator').should('not.exist')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
testEditRangeAnnotation,
testDeleteAnnotation,
RANGE_ANNOTATION_TEXT,
} from '../util/annotationsSetup'
} from '../../util/annotationsSetup'

describe('The Annotations UI functionality on a band plot graph type', () => {
const bandSuffix = 'band'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
checkAnnotationText,
setupData,
startEditingAnnotation,
} from '../util/annotationsSetup'
} from '../../util/annotationsSetup'
import * as moment from 'moment'

import {DEFAULT_TIME_FORMAT} from '../../../src/utils/datetime/constants'
Expand Down Expand Up @@ -263,7 +263,7 @@ describe('Annotations, but in a different test suite', () => {
.should($el => {
expect($el).to.have.length(1)
expect(Cypress.dom.isDetached($el)).to.be.false
// eslint-disable-next-line jest/unbound-method
// eslint-disable-next-line jest/unbound-method, @typescript-eslint/unbound-method
expect($el).not.to.be.disabled
})
.click()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
testEditRangeAnnotation,
testDeleteAnnotation,
RANGE_ANNOTATION_TEXT,
} from '../util/annotationsSetup'
} from '../../util/annotationsSetup'

describe('The Annotations UI functionality on a graph + single stat graph type', () => {
const singleStatSuffix = 'line-plus-single-stat'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
testEditRangeAnnotation,
testDeleteAnnotation,
RANGE_ANNOTATION_TEXT,
} from '../util/annotationsSetup'
} from '../../util/annotationsSetup'

describe('The Annotations UI functionality, on a graph (xy line) graph type', () => {
beforeEach(() => setupData(cy))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ Cypress.on('uncaught:exception', (err, _) => {
err.message.includes('The operation was aborted') ||
err.message.includes('NetworkError') ||
err.message.includes('path not found') ||
err.message.includes('Request aborted')
err.message.includes('Request aborted') ||
err.message.includes('Loading chunk')
)
})

Expand Down
2 changes: 1 addition & 1 deletion cypress/support/index.js → cypress/support/e2e.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// ***********************************************************
// This example support/index.js is processed and
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {Organization} from '../../../src/types'
import {points} from '../../support/commands'
import {Organization} from '../../src/types'
import {points} from '../support/commands'

export const ANNOTATION_TEXT = 'im a hippopotamus'
export const EDIT_ANNOTATION_TEXT = 'lets edit this annotation'
Expand Down Expand Up @@ -90,7 +90,7 @@ export const addAnnotation = (cy: Cypress.Chainable) => {
.should($el => {
expect($el).to.have.length(1)
expect(Cypress.dom.isDetached($el)).to.be.false
// eslint-disable-next-line jest/unbound-method
// eslint-disable-next-line jest/unbound-method, @typescript-eslint/unbound-method
expect($el).not.to.be.disabled
})
.click()
Expand Down Expand Up @@ -174,7 +174,7 @@ export const addRangeAnnotation = (
.should($el => {
expect($el).to.have.length(1)
expect(Cypress.dom.isDetached($el)).to.be.false
// eslint-disable-next-line jest/unbound-method
// eslint-disable-next-line jest/unbound-method, @typescript-eslint/unbound-method
expect($el).not.to.be.disabled
})
.click()
Expand Down Expand Up @@ -208,7 +208,7 @@ export const testEditAnnotation = (cy: Cypress.Chainable) => {
.should($el => {
expect($el).to.have.length(1)
expect(Cypress.dom.isDetached($el)).to.be.false
// eslint-disable-next-line jest/unbound-method
// eslint-disable-next-line jest/unbound-method, @typescript-eslint/unbound-method
expect($el).not.to.be.disabled
})
.click()
Expand Down Expand Up @@ -252,7 +252,7 @@ export const testEditRangeAnnotation = (
.should($el => {
expect($el).to.have.length(1)
expect(Cypress.dom.isDetached($el)).to.be.false
// eslint-disable-next-line jest/unbound-method
// eslint-disable-next-line jest/unbound-method, @typescript-eslint/unbound-method
expect($el).not.to.be.disabled
})
.click()
Expand Down
4 changes: 2 additions & 2 deletions docker/Dockerfile.cypress
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# The cypress image used here is a non-standard slim image
# and its definition and versions are maintained here:
# https://github.com/influxdata/cypress-slim
FROM quay.io/influxdb/cypress-slim:9.5.2-included
FROM quay.io/influxdb/cypress-slim:10.11.0-included

WORKDIR /repo

COPY ./package.json .

RUN yarn add cypress-circleci-reporter

COPY ./cypress.json ./cypress.json
COPY ./cypress.config.ts ./cypress.config.ts
COPY ./cypress ./cypress
COPY ./src/types ./src/types
COPY ./src/timeMachine/constants ./src/timeMachine/constants
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"cross-env": "^7.0.3",
"css-loader": "^5.2.7",
"css-unicode-loader": "^1.0.3",
"cypress": "^9.5.2",
"cypress": "^10.11.0",
"cypress-file-upload": "^5.0.8",
"cypress-log-to-output": "^1.1.2",
"cypress-pipe": "^2.0.0",
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4623,10 +4623,10 @@ cypress-plugin-tab@^1.0.5:
dependencies:
ally.js "^1.4.1"

cypress@^9.5.2:
version "9.5.3"
resolved "https://registry.npmjs.org/cypress/-/cypress-9.5.3.tgz"
integrity sha512-ItelIVmqMTnKYbo1JrErhsGgQGjWOxCpHT1TfMvwnIXKXN/OSlPjEK7rbCLYDZhejQL99PmUqul7XORI24Ik0A==
cypress@^10.11.0:
version "10.11.0"
resolved "https://registry.yarnpkg.com/cypress/-/cypress-10.11.0.tgz#e9fbdd7638bae3d8fb7619fd75a6330d11ebb4e8"
integrity sha512-lsaE7dprw5DoXM00skni6W5ElVVLGAdRUUdZjX2dYsGjbY/QnpzWZ95Zom1mkGg0hAaO/QVTZoFVS7Jgr/GUPA==
dependencies:
"@cypress/request" "^2.88.10"
"@cypress/xvfb" "^1.2.4"
Expand All @@ -4647,7 +4647,7 @@ cypress@^9.5.2:
dayjs "^1.10.4"
debug "^4.3.2"
enquirer "^2.3.6"
eventemitter2 "^6.4.3"
eventemitter2 "6.4.7"
execa "4.1.0"
executable "^4.1.1"
extract-zip "2.0.1"
Expand Down Expand Up @@ -5479,10 +5479,10 @@ etag@~1.8.1:
resolved "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz"
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=

eventemitter2@^6.4.3:
version "6.4.5"
resolved "https://registry.npmjs.org/eventemitter2/-/eventemitter2-6.4.5.tgz"
integrity sha512-bXE7Dyc1i6oQElDG0jMRZJrRAn9QR2xyyFGmBdZleNmyQX0FqGYmhZIrIrpPfm/w//LTo4tVQGOGQcGCb5q9uw==
[email protected].7:
version "6.4.7"
resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.7.tgz#a7f6c4d7abf28a14c1ef3442f21cb306a054271d"
integrity sha512-tYUSVOGeQPKt/eC1ABfhHy5Xd96N3oIijJvN3O9+TsC28T5V9yX9oEfEK5faP0EFSNVOG97qtAS68GBrQB2hDg==

eventemitter3@^4.0.0:
version "4.0.7"
Expand Down