UNPKG

html-reporter

Version:

Html-reporter and GUI for viewing and managing results of a tests run. Currently supports Testplane and Hermione.

25 lines 1.11 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SqliteImageStore = void 0; const constants_1 = require("./constants"); class SqliteImageStore { constructor(dbClient) { this._dbClient = dbClient; } getLastImageInfoFromDb(testResult, stateName) { const browserName = testResult.browserId; const suitePath = testResult.testPath; const suitePathString = JSON.stringify(suitePath); const imagesInfoResult = this._dbClient.query({ select: constants_1.DB_COLUMNS.IMAGES_INFO, where: `${constants_1.DB_COLUMNS.SUITE_PATH} = ? AND ${constants_1.DB_COLUMNS.NAME} = ?`, orderBy: constants_1.DB_COLUMNS.TIMESTAMP, orderDescending: true, noCache: true }, suitePathString, browserName); const imagesInfo = imagesInfoResult && JSON.parse(imagesInfoResult[constants_1.DB_COLUMNS.IMAGES_INFO]) || []; return imagesInfo.find(info => info.stateName === stateName); } } exports.SqliteImageStore = SqliteImageStore; //# sourceMappingURL=image-store.js.map