UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

65 lines 3.12 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; healthCheckResultTag; 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.healthCheckResultTag = page.locator(`${this.positiveTag}, ${this.warningTag}, ${this.dangerTag}`); this.headline = page.locator('#headline'); this.healthCheckGroup = page.locator('umb-dashboard-health-check-group'); } async clickHealthCheckTab() { await this.click(this.healthCheckTab); } async checkHealthCheckGroupCount() { await this.isVisible(this.healthCheckGroupBox.first()); return this.healthCheckGroupBox.count(); } async clickPerformanceAllChecksButton() { await this.click(this.performanceAllChecksBtn); } async clickPerformAllChecksButtonAndWaitForResults() { await this.click(this.performanceAllChecksBtn); await this.waitForVisible(this.healthCheckResultTag.first()); } async clickHeathCheckGroupByName(groupName) { await this.click(this.page.getByRole('link', { name: groupName })); } async isHealthCheckGroupVisible(groupName) { await this.isVisible(this.healthCheckGroupBox.getByText(groupName)); } 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 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