e2ed
Version:
E2E testing framework over Playwright
29 lines (28 loc) • 1.18 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.renderRetriesButtons = void 0;
const client_1 = require("../client");
const locator_1 = require("./locator");
const renderRetryButton_1 = require("./renderRetryButton");
/**
* Renders retries navigation buttons.
* @internal
*/
const renderRetriesButtons = ({ retries }) => {
const retryNumbers = retries.map(({ retryIndex }) => retryIndex);
const maxRetry = Math.max(...retryNumbers);
const buttons = [];
for (let index = 1; index <= maxRetry + 1; index += 1) {
const isRetry = retryNumbers.includes(index);
const isMeta = index === maxRetry + 1;
buttons[index] = (0, renderRetryButton_1.renderRetryButton)({
disabled: isMeta ? false : !isRetry,
name: isMeta ? 'Meta' : `Retry ${index}`,
retry: index,
selected: index === maxRetry,
});
}
return (0, client_1.createSafeHtmlWithoutSanitize) `
<div role="tablist" aria-label="Retries" class="nav-tabs" ${(0, locator_1.locatorAttributes)('RetriesButtons')}>${buttons.join('')}</div>`;
};
exports.renderRetriesButtons = renderRetriesButtons;