From ad9a00d79d57b1969804d39bc214072c3415a0b3 Mon Sep 17 00:00:00 2001 From: williamlardier Date: Mon, 21 Oct 2024 11:06:33 +0200 Subject: [PATCH] Fixes Issue: ZENKO-4837 --- tests/ctst/steps/website/website.ts | 25 +++++++++++++++++++------ tests/ctst/world/Zenko.ts | 16 ++++++++++++++++ 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/tests/ctst/steps/website/website.ts b/tests/ctst/steps/website/website.ts index 91c9e948c..1bb3a4aaf 100644 --- a/tests/ctst/steps/website/website.ts +++ b/tests/ctst/steps/website/website.ts @@ -14,9 +14,14 @@ Given('an index html file', async function (this: Zenko) { }); When('the user puts the bucket website configuration', async function (this: Zenko) { - const bucketWebSiteConfiguration = - '' + - 'string'; + const bucketWebSiteConfiguration = JSON.stringify({ + IndexDocument: { + Suffix: 'index.html', + }, + ErrorDocument: { + Key: 'error.html', + }, + }); await S3.putBucketWebsite({ bucket: this.getSaved('bucketName'), @@ -31,7 +36,15 @@ When('the {string} endpoint is added to the overlay', async function (this: Zenk Then('the user should be able to load the index.html file from the {string} endpoint', async function (this: Zenko, endpoint: string) { const uri = `http://${this.getSaved('bucketName')}.${endpoint}`; - const response = await fetch(uri); - const content = await response.text(); - assert.strictEqual(content.includes(pageMessage), true); + try { + const response = await fetch(uri); + const content = await response.text(); + assert.strictEqual(content.includes(pageMessage), true); + } catch (err) { + this.logger.error('error when fetching the bucket website', { + err, + uri, + }); + throw err; + } }); diff --git a/tests/ctst/world/Zenko.ts b/tests/ctst/world/Zenko.ts index 44355f405..d31eb9c93 100644 --- a/tests/ctst/world/Zenko.ts +++ b/tests/ctst/world/Zenko.ts @@ -935,9 +935,25 @@ export default class Zenko extends World { }; try { const response: AxiosResponse = await axiosInstance(axiosConfig); + this.logger.debug('Management API request', { + method, + path, + headers, + payload, + response: response.data, + statusCode: response.status, + }); return { statusCode: response.status, data: response.data as object }; /* eslint-disable */ } catch (err: any) { + this.logger.debug('Error when making management API request', { + method, + path, + headers, + payload, + err: err.response.data, + status: err.response.status, + }); return { statusCode: err.response.status, err: err.response.data,