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

[Tech] Downgrade cypress to v12 #2721

Merged
merged 6 commits into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ jobs:
- name: Setup Firefox
uses: browser-actions/setup-firefox@latest
with:
firefox-version: 104.0.2
firefox-version: 119.0.1

- name: Check versions
run: |
Expand Down
Empty file.
9 changes: 9 additions & 0 deletions frontend/cypress/e2e/vessels/vessel_search.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,18 @@ context('VesselSearch', () => {
it('Vessel from last positions and vessels table Should be searched from the search bar', () => {
// When searching a vessel from the last positions table
cy.get('*[data-cy^="vessel-search-input"]', { timeout: 10000 }).type('Pheno')
cy.intercept('GET', `/bff/v1/vessels/find*`).as('firstVessel')
cy.get('*[data-cy^="vessel-search-item"]', { timeout: 10000 }).eq(0).click()
cy.wait('@firstVessel')
cy.wait(200)
cy.get('*[data-cy^="vessel-sidebar"]', { timeout: 10000 }).should('be.visible')

// We should be able to search again when the vessel sidebar is already opened
cy.get('*[data-cy^="vessel-search-selected-vessel-title"]', { timeout: 10000 }).click()
cy.get('*[data-cy^="vessel-search-input"]', { timeout: 10000 }).type('détacher')
cy.intercept('GET', `/bff/v1/vessels/find*`).as('secondVessel')
cy.get('*[data-cy^="vessel-search-item"]', { timeout: 10000 }).eq(0).click()
cy.wait('@secondVessel')

// Close the sidebar
cy.get('*[data-cy^="vessel-search-selected-vessel-close-title"]', { timeout: 10000 }).click()
Expand All @@ -29,11 +33,16 @@ context('VesselSearch', () => {
it('Vessel history Should be shown When having previously searched vessels', () => {
// Given
cy.get('*[data-cy^="vessel-search-input"]', { timeout: 10000 }).type('Pheno')
cy.intercept('GET', `/bff/v1/vessels/find*`).as('firstVessel')
cy.get('*[data-cy^="vessel-search-item"]', { timeout: 10000 }).eq(0).click()
cy.wait('@firstVessel')
cy.get('*[data-cy^="vessel-search-selected-vessel-close-title"]', { timeout: 10000 }).click()

cy.get('*[data-cy^="vessel-search-input"]', { timeout: 10000 }).type('détacher')

cy.intercept('GET', `/bff/v1/vessels/find*`).as('secondVessel')
cy.get('*[data-cy^="vessel-search-item"]', { timeout: 10000 }).eq(0).click()
cy.wait('@secondVessel')
cy.get('*[data-cy^="vessel-search-selected-vessel-close-title"]', { timeout: 10000 }).click()

// When
Expand Down
20 changes: 20 additions & 0 deletions frontend/cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,32 @@ Cypress.on('uncaught:exception', err => {
// We ignore uncaught exceptions `Error: ResizeObserver loop completed with undelivered notifications.`
// since they only seem to happen (sporadically) within e2e tests
if (err.message.includes('ResizeObserver loop completed with undelivered notifications.')) {
// eslint-disable-next-line no-console
console.log(`Error skipped: ${err}`)

return false
}

// We ignore uncaught exceptions `TypeError: NetworkError when attempting to fetch resource`
// if (err.message.includes('NetworkError when attempting to fetch resource') ) {
// console.log(`Error skipped: ${err}`)
// return false // return false to make test continue
// }

// We ignore uncaught exceptions `AbortError: The operation was aborted`
Copy link
Member

Choose a reason for hiding this comment

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

Un petit comment sur le genre de case ou ça arrive ?

if (err.message.includes('The operation was aborted')) {
// eslint-disable-next-line no-console
console.log(`Error skipped: ${err}`)

return false
}

// This React error does not reproduce in real life
// It might be a bug resolved in React 18 : https://github.com/facebook/react/issues/17355#issuecomment-1173055443
if (err.message.includes('Should not already be working')) {
// eslint-disable-next-line no-console
console.log(`Error skipped: ${err}`)

return false
}

Expand Down
11 changes: 11 additions & 0 deletions frontend/cypress/support/test_flaky_test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
counter=0
Copy link
Member

Choose a reason for hiding this comment

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

Tu veux laisser ce script ? Si oui, peut-être l'ajouter dans les scripts npm avec un petit arg pour donner le path du test ?

while true; do
if ./node_modules/.bin/cypress run --browser firefox --config-file ./config/cypress.config.ts --spec cypress/e2e/vessels/vessel_search.spec.ts; then
counter=$((counter+1))
echo "Test runned $counter times"
continue
else
echo "Test failed after $counter times"
break
fi
done
40 changes: 16 additions & 24 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"build:prod": "ENV_PROFILE=prod npm run build",
"build:local": "ENV_PROFILE=local npm run build",
"cypress:open": "cypress open --browser firefox --config-file ./config/cypress.config.ts --e2e",
"cypress:run": "cypress run --browser firefox --config-file ./config/cypress.config.ts --e2e",
"dev": "dotenv -e ../infra/configurations/frontend/.env.local vite --port 3000",
"bundle-sw": "esbuild src/workers/serviceWorker.ts --bundle --outfile=public/service-worker.js",
"prepare": "cd .. && ./frontend/node_modules/.bin/husky install ./frontend/config/husky",
Expand Down Expand Up @@ -101,7 +100,7 @@
"assert": "2.0.0",
"babel-eslint": "10.1.0",
"codecov": "3.8.3",
"cypress": "13.3.2",
"cypress": "12.11.0",
"cypress-mouse-position": "1.0.0",
"cypress-plugin-snapshots": "github:ivangabriele/cypress-plugin-snapshots",
"dotenv": "16.3.1",
Expand Down
Loading