UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

58 lines 2.69 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.HealthCheckUiHelper = void 0; 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 this.isVisible(this.healthCheckGroupBox.first()); 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 this.isVisible(this.healthCheckGroupBox.getByText(groupName)); } async doesHeathCheckGroupHaveSuccessItemsCount(healthCheckGroupName, count) { return this.hasText(this.healthCheckGroupBox.filter({ has: this.page.getByText(healthCheckGroupName) }).locator(this.positiveTag), count.toString()); } async doesHeathCheckGroupHaveWarningItemsCount(healthCheckGroupName, count) { return this.hasText(this.healthCheckGroupBox.filter({ has: this.page.getByText(healthCheckGroupName) }).locator(this.warningTag), count.toString()); } async doesHeathCheckGroupHaveErrorItemsCount(healthCheckGroupName, count) { return this.hasText(this.healthCheckGroupBox.filter({ has: this.page.getByText(healthCheckGroupName) }).locator(this.dangerTag), count.toString()); } async isCheckNameVisible(name) { return await this.isVisible(this.headline.filter({ hasText: name })); } async isCheckDescriptionVisible(description) { return await this.isVisible(this.healthCheckGroup.getByText(description)); } } exports.HealthCheckUiHelper = HealthCheckUiHelper; //# sourceMappingURL=HealthCheckUiHelper.js.map