test: Order attachments by participant. (#16663)

This commit is contained in:
bgrozev
2025-11-17 16:12:58 -06:00
committed by GitHub
parent ef97778158
commit 615bbdc39b
2 changed files with 26 additions and 11 deletions

View File

@@ -152,7 +152,7 @@ describe('Desktop sharing', () => {
await checkForScreensharingTile(p1, p3); await checkForScreensharingTile(p1, p3);
await checkForScreensharingTile(p2, p3); await checkForScreensharingTile(p2, p3);
// Add another particpant to verify multiple screenshares are visible without gaps in filmstrip. // Add another participant to verify multiple screenshares are visible without gaps in filmstrip.
await ensureFourParticipants({ await ensureFourParticipants({
configOverwrite: { configOverwrite: {
filmstrip: { filmstrip: {

View File

@@ -382,24 +382,25 @@ export const config: WebdriverIO.MultiremoteConfig = {
})); }));
const allProcessing: Promise<any>[] = []; const allProcessing: Promise<any>[] = [];
const attachments: { content: string | Buffer; filename: string; type: string; }[] = [];
multiremotebrowser.instances.forEach((instance: string) => { multiremotebrowser.instances.forEach((instance: string) => {
const bInstance = multiremotebrowser.getInstance(instance); const bInstance = multiremotebrowser.getInstance(instance);
allProcessing.push(bInstance.takeScreenshot().then(shot => { allProcessing.push(bInstance.takeScreenshot().then(shot => {
AllureReporter.addAttachment( attachments.push({
`Screenshot-${instance}`, filename: `${instance}-screenshot`,
Buffer.from(shot, 'base64'), content: Buffer.from(shot, 'base64'),
'image/png'); type: 'image/png' });
})); }));
// @ts-ignore // @ts-ignore
allProcessing.push(bInstance.execute(() => typeof APP !== 'undefined' && APP.connection?.getLogs()) allProcessing.push(bInstance.execute(() => typeof APP !== 'undefined' && APP.connection?.getLogs())
.then(logs => .then(logs =>
logs && AllureReporter.addAttachment( logs && attachments.push({
`debug-logs-${instance}`, filename: `${instance}-debug-logs`,
JSON.stringify(logs, null, ' '), content: JSON.stringify(logs, null, ' '),
'text/plain')) type: 'text/plain' }))
.catch(e => console.error('Failed grabbing debug logs', e))); .catch(e => console.error('Failed grabbing debug logs', e)));
allProcessing.push( allProcessing.push(
@@ -408,15 +409,29 @@ export const config: WebdriverIO.MultiremoteConfig = {
saveLogs(bInstance, res); saveLogs(bInstance, res);
} }
AllureReporter.addAttachment(`console-logs-${instance}`, getLogs(bInstance) || '', 'text/plain'); attachments.push({
filename: `${instance}-console-logs`,
content: getLogs(bInstance) || '',
type: 'text/plain' });
})); }));
allProcessing.push(bInstance.getPageSource().then(source => { allProcessing.push(bInstance.getPageSource().then(source => {
AllureReporter.addAttachment(`html-source-${instance}`, pretty(source), 'text/plain'); attachments.push({
filename: `${instance}-html-source`,
content: pretty(source),
type: 'text/plain' });
})); }));
}); });
await Promise.allSettled(allProcessing); await Promise.allSettled(allProcessing);
attachments.sort(
(a, b) => {
return a.filename < b.filename ? -1 : 1;
}).forEach(
a => {
AllureReporter.addAttachment(a.filename, a.content, a.type);
}
);
} }
}, },