UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

59 lines 2.86 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthCheckUiHelper = void 0; const test_1 = require("@playwright/test"); const UiBaseLocators_1 = require("./UiBaseLocators"); class HealthCheckUiHelper extends UiBaseLocators_1.UiBaseLocators { healthCheckTab; healthCheckGroupBox; performanceAllChecksBtn; positiveTag; warningTag; dangerTag; headline; healthCheckGroup; constructor(page) { super(page); this.healthCheckTab = page.getByRole('tab', { name: 'Health Check' }); this.healthCheckGroupBox = page.locator('umb-health-check-group-box-overview'); this.performanceAllChecksBtn = page.getByLabel('Perform all checks'); this.positiveTag = 'uui-tag[color="positive"]'; this.warningTag = 'uui-tag[color="warning"]'; this.dangerTag = 'uui-tag[color="danger"]'; this.headline = page.locator('#headline'); this.healthCheckGroup = page.locator('umb-dashboard-health-check-group'); } async clickHealthCheckTab() { await this.healthCheckTab.click(); } async checkHealthCheckGroupCount() { await (0, test_1.expect)(this.healthCheckGroupBox.first()).toBeVisible(); return this.healthCheckGroupBox.count(); } async clickPerformanceAllChecksButton() { await this.performanceAllChecksBtn.click(); } async clickHeathCheckGroupByName(groupName) { await this.page.getByRole('link', { name: groupName }).click(); } async isHealthCheckGroupVisible(groupName) { return await (0, test_1.expect)(this.healthCheckGroupBox.getByText(groupName)).toBeVisible(); } async doesHeathCheckGroupHaveSuccessItemsCount(healthCheckGroupName, count) { return (0, test_1.expect)(this.healthCheckGroupBox.filter({ has: this.page.getByText(healthCheckGroupName) }).locator(this.positiveTag)).toHaveText(count.toString()); } async doesHeathCheckGroupHaveWarningItemsCount(healthCheckGroupName, count) { return (0, test_1.expect)(this.healthCheckGroupBox.filter({ has: this.page.getByText(healthCheckGroupName) }).locator(this.warningTag)).toHaveText(count.toString()); } async doesHeathCheckGroupHaveErrorItemsCount(healthCheckGroupName, count) { return (0, test_1.expect)(this.healthCheckGroupBox.filter({ has: this.page.getByText(healthCheckGroupName) }).locator(this.dangerTag)).toHaveText(count.toString()); } async isCheckNameVisible(name) { return await (0, test_1.expect)(this.headline.filter({ hasText: name })).toBeVisible(); } async isCheckDescriptionVisible(description) { return await (0, test_1.expect)(this.healthCheckGroup.getByText(description)).toBeVisible(); } } exports.HealthCheckUiHelper = HealthCheckUiHelper; //# sourceMappingURL=HealthCheckUiHelper.js.map