Skip to content

Commit c7dcbfe

Browse files
authored
V16 QA Publish Console Error Logs (#19417)
* Updated configuration * Updated pipeline * Updated nightly pipeline * Bumped version * updated if statement
1 parent 3f57da5 commit c7dcbfe

File tree

4 files changed

+86
-34
lines changed

4 files changed

+86
-34
lines changed

build/azure-pipelines.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,8 @@ stages:
567567
"UMBRACO_USER_LOGIN=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL)
568568
UMBRACO_USER_PASSWORD=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD)
569569
URL=$(ASPNETCORE_URLS)
570-
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json" | Out-File .env
570+
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json
571+
CONSOLE_ERRORS_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/console-errors.json" | Out-File .env
571572
displayName: Generate .env
572573
workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest
573574
@@ -650,6 +651,14 @@ stages:
650651
displayName: Copy Playwright results
651652
condition: succeededOrFailed()
652653
654+
# Copy console error log
655+
- pwsh: |
656+
if (Test-Path tests/Umbraco.Tests.AcceptanceTest/console-errors.json) {
657+
Copy-Item tests/Umbraco.Tests.AcceptanceTest/console-errors.json $(Build.ArtifactStagingDirectory)
658+
}
659+
displayName: Copy console error log
660+
condition: succeededOrFailed()
661+
653662
# Publish test artifacts
654663
- task: PublishPipelineArtifact@1
655664
displayName: Publish test artifacts
@@ -725,7 +734,8 @@ stages:
725734
"UMBRACO_USER_LOGIN=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL)
726735
UMBRACO_USER_PASSWORD=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD)
727736
URL=$(ASPNETCORE_URLS)
728-
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json" | Out-File .env
737+
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json
738+
CONSOLE_ERRORS_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/console-errors.json" | Out-File .env
729739
displayName: Generate .env
730740
workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest
731741
@@ -826,6 +836,14 @@ stages:
826836
displayName: Copy Playwright results
827837
condition: succeededOrFailed()
828838
839+
# Copy console error log
840+
- pwsh: |
841+
if (Test-Path tests/Umbraco.Tests.AcceptanceTest/console-errors.json) {
842+
Copy-Item tests/Umbraco.Tests.AcceptanceTest/console-errors.json $(Build.ArtifactStagingDirectory)
843+
}
844+
displayName: Copy console error log
845+
condition: succeededOrFailed()
846+
829847
# Publish test artifacts
830848
- task: PublishPipelineArtifact@1
831849
displayName: Publish test artifacts

build/nightly-E2E-test-pipelines.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ stages:
180180
"UMBRACO_USER_LOGIN=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL)
181181
UMBRACO_USER_PASSWORD=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD)
182182
URL=$(ASPNETCORE_URLS)
183-
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json" | Out-File .env
183+
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json
184+
CONSOLE_ERRORS_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/console-errors.json" | Out-File .env
184185
displayName: Generate .env
185186
workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest
186187
@@ -268,6 +269,14 @@ stages:
268269
displayName: Copy Playwright results
269270
condition: succeededOrFailed()
270271
272+
# Copy console error log
273+
- pwsh: |
274+
if (Test-Path tests/Umbraco.Tests.AcceptanceTest/console-errors.json) {
275+
Copy-Item tests/Umbraco.Tests.AcceptanceTest/console-errors.json $(Build.ArtifactStagingDirectory)
276+
}
277+
displayName: Copy console error log
278+
condition: succeededOrFailed()
279+
271280
# Publish
272281
- task: PublishPipelineArtifact@1
273282
displayName: Publish test artifacts
@@ -343,7 +352,8 @@ stages:
343352
"UMBRACO_USER_LOGIN=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL)
344353
UMBRACO_USER_PASSWORD=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD)
345354
URL=$(ASPNETCORE_URLS)
346-
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json" | Out-File .env
355+
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json
356+
CONSOLE_ERRORS_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/console-errors.json" | Out-File .env
347357
displayName: Generate .env
348358
workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest
349359
@@ -449,6 +459,14 @@ stages:
449459
displayName: Copy Playwright results
450460
condition: succeededOrFailed()
451461
462+
# Copy console error log
463+
- pwsh: |
464+
if (Test-Path tests/Umbraco.Tests.AcceptanceTest/console-errors.json) {
465+
Copy-Item tests/Umbraco.Tests.AcceptanceTest/console-errors.json $(Build.ArtifactStagingDirectory)
466+
}
467+
displayName: Copy console error log
468+
condition: succeededOrFailed()
469+
452470
# Publish
453471
- task: PublishPipelineArtifact@1
454472
displayName: Publish test artifacts

tests/Umbraco.Tests.AcceptanceTest/config.js

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -2,45 +2,48 @@ const prompt = require('prompt');
22
const fs = require('fs');
33

44
const properties = [
5-
{
6-
description: 'Enter your Umbraco superadmin username/email',
7-
name: 'username',
8-
required: true
9-
},
10-
{
11-
description: 'Enter your Umbraco superadmin password',
12-
name: 'password',
13-
hidden: true,
14-
required: true
15-
},
16-
{
17-
description: 'Enter CMS URL, or leave empty for default(https://localhost:44339)',
18-
name: 'baseUrl'
19-
}
5+
{
6+
description: 'Enter your Umbraco superadmin username/email',
7+
name: 'username',
8+
required: true
9+
},
10+
{
11+
description: 'Enter your Umbraco superadmin password',
12+
name: 'password',
13+
hidden: true,
14+
required: true
15+
},
16+
{
17+
description: 'Enter CMS URL, or leave empty for default(https://localhost:44339)',
18+
name: 'baseUrl'
19+
}
2020
];
2121

22+
const configPath = './.env';
2223

23-
const configPath = './.env'
24-
25-
console.log("Configure your Umbraco test environment")
24+
console.log("Configure your Umbraco test environment");
2625

2726
prompt.start();
2827

2928
prompt.get(properties, function (error, result) {
30-
if (error) { return onError(error); }
29+
if (error) {
30+
return onError(error);
31+
}
3132

32-
var fileContent = `UMBRACO_USER_LOGIN=${result.username}
33+
const fileContent = `UMBRACO_USER_LOGIN=${result.username}
3334
UMBRACO_USER_PASSWORD=${result.password}
3435
URL=${result.baseUrl || "https://localhost:44339"}
35-
STORAGE_STAGE_PATH=${__dirname.replace(/\\/g,'/')}/playwright/.auth/user.json`;
36+
STORAGE_STAGE_PATH=${__dirname.replace(/\\/g, '/')}/playwright/.auth/user.json
37+
CONSOLE_ERRORS_PATH=${__dirname.replace(/\\/g, '/')}/console-errors.json`;
38+
3639

37-
fs.writeFile(configPath, fileContent, function (error) {
38-
if (error) return console.error(error);
39-
console.log('Configuration saved');
40-
});
40+
fs.writeFile(configPath, fileContent, function (error) {
41+
if (error) return console.error(error);
42+
console.log('Configuration saved');
43+
});
4144
});
4245

4346
function onError(error) {
44-
console.error(error);
45-
return true;
47+
console.error(error);
48+
return true;
4649
}
Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
const fs = require('fs');
22

33
const configPath = './.env';
4+
const consoleErrorsPath = './console-errors.json';
45

56
try {
67
if (fs.existsSync(configPath)) {
7-
//file exists
8+
// file exists
89
console.log("Skips configuration as file already exists, run 'npm run config' to change your configuration.");
910
} else {
1011
require('./config.js');
1112
}
12-
} catch(err) {
13-
console.error(err)
13+
} catch (err) {
14+
console.error(err);
15+
}
16+
17+
try {
18+
if (!fs.existsSync(consoleErrorsPath)) {
19+
const consoleErrorsFileContent = `{
20+
"consoleErrors": []
21+
}`;
22+
23+
fs.writeFileSync(consoleErrorsPath, consoleErrorsFileContent);
24+
}
25+
} catch (err) {
26+
console.error(err);
1427
}

0 commit comments

Comments
 (0)