From cdfa5663044ea683422232ae51613939a3b66044 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Thu, 2 Nov 2023 17:56:18 +0100 Subject: [PATCH] fix(cypress): Add timeout for waiting on Nextcloud server Signed-off-by: Ferdinand Thiessen --- cypress/dockerNode.ts | 10 +++++++++- package-lock.json | 10 ++++++++++ package.json | 1 + 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cypress/dockerNode.ts b/cypress/dockerNode.ts index 790200b9c2103..38bc86d9c5f39 100644 --- a/cypress/dockerNode.ts +++ b/cypress/dockerNode.ts @@ -233,7 +233,15 @@ export const getContainerIP = async function( // https://github.com/cypress-io/cypress/issues/22676 export const waitOnNextcloud = async function(ip: string) { console.log('├─ Waiting for Nextcloud to be ready... ⏳') - await waitOn({ resources: [`http://${ip}/index.php`] }) + await waitOn({ + resources: [`http://${ip}/index.php`], + // wait for nextcloud to be up and return any non error status + validateStatus: (status) => status >= 200 && status < 400, + // timout in ms + timeout: 5 * 60 * 1000, + // timeout for a single HTTP request + httpTimeout: 60 * 1000, + }) console.log('└─ Done') } diff --git a/package-lock.json b/package-lock.json index ce96bd3ae297e..a40a7e6735746 100644 --- a/package-lock.json +++ b/package-lock.json @@ -106,6 +106,7 @@ "@testing-library/vue": "^5.8.3", "@types/dockerode": "^3.3.21", "@types/jest": "^29.5.2", + "@types/wait-on": "^5.3.3", "@vue/test-utils": "^1.3.5", "@vue/tsconfig": "^0.4.0", "@vue/vue2-jest": "^29.2.6", @@ -6160,6 +6161,15 @@ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-2.0.7.tgz", "integrity": "sha512-cputDpIbFgLUaGQn6Vqg3/YsJwxUwHLO13v3i5ouxT4lat0khip9AEWxtERujXV9wxIB1EyF97BSJFt6vpdI8g==" }, + "node_modules/@types/wait-on": { + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/@types/wait-on/-/wait-on-5.3.3.tgz", + "integrity": "sha512-I8EnhU/DuvV2LODzBcLw85FPFFZ9mBvtgqfsgXbhkbo5IZYfIne5qxPTv4PGbD8d5uDQJG5g/pGwGdpM8lQ6Lg==", + "dev": true, + "dependencies": { + "@types/node": "*" + } + }, "node_modules/@types/web-bluetooth": { "version": "0.0.17", "resolved": "https://registry.npmjs.org/@types/web-bluetooth/-/web-bluetooth-0.0.17.tgz", diff --git a/package.json b/package.json index 94c03bbcacea9..7771e16ce2462 100644 --- a/package.json +++ b/package.json @@ -133,6 +133,7 @@ "@testing-library/vue": "^5.8.3", "@types/dockerode": "^3.3.21", "@types/jest": "^29.5.2", + "@types/wait-on": "^5.3.3", "@vue/test-utils": "^1.3.5", "@vue/tsconfig": "^0.4.0", "@vue/vue2-jest": "^29.2.6",