mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
prevent failure screenshot names from being over 100 characters in length
This commit is contained in:
parent
67376ed53e
commit
410f5cd369
1 changed files with 5 additions and 1 deletions
|
@ -9,6 +9,7 @@
|
|||
import { resolve } from 'path';
|
||||
import { writeFile, mkdir } from 'fs';
|
||||
import { promisify } from 'util';
|
||||
import Uuid from 'uuid';
|
||||
|
||||
import del from 'del';
|
||||
import { FtrProviderContext } from '../../ftr_provider_context';
|
||||
|
@ -49,7 +50,10 @@ export async function FailureDebuggingProvider({ getService }: FtrProviderContex
|
|||
|
||||
async function onFailure(_: any, test: Test) {
|
||||
// Replace characters in test names which can't be used in filenames, like *
|
||||
const name = test.fullTitle().replace(/([^ a-zA-Z0-9-]+)/g, '_');
|
||||
let name = test.fullTitle().replace(/([^ a-zA-Z0-9-]+)/g, '_');
|
||||
if (name.length > 100) {
|
||||
name = `truncated-${name.slice(-100)}-${Uuid.v4()}`;
|
||||
}
|
||||
|
||||
await Promise.all([screenshots.takeForFailure(name), logCurrentUrl(), savePageHtml(name)]);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue