UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

92 lines 4.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.WebhookUiHelper = void 0; const test_1 = require("@playwright/test"); const UiBaseLocators_1 = require("./UiBaseLocators"); const ConstantHelper_1 = require("./ConstantHelper"); class WebhookUiHelper extends UiBaseLocators_1.UiBaseLocators { webhookCreateBtn; webhookNameTxt; urlTxt; chooseEventBtn; chooseContentTypeBtn; enabledToggle; addHeadersBtn; headerNameTxt; headerValueTxt; deleteWebhookEntityAction; headerRemoveBtn; constructor(page) { super(page); this.webhookCreateBtn = page.getByTestId('collection-action:Umb.CollectionAction.Webhook.Create'); this.webhookNameTxt = page.locator('#name #input'); this.urlTxt = page.locator('umb-property-layout[label="URL"] #input'); this.chooseEventBtn = page.locator('umb-property-layout[label="Events"]').getByLabel('Choose'); this.chooseContentTypeBtn = page.locator('umb-property-layout[label="Content Type"]').getByLabel('Choose'); this.enabledToggle = page.locator('umb-property-layout[label="Enabled"] #toggle'); this.addHeadersBtn = page.locator('umb-property-layout[label="Headers"] #add'); this.headerNameTxt = page.locator('umb-input-webhook-headers').locator('[list="nameList"]'); this.headerValueTxt = page.locator('umb-input-webhook-headers').locator('[list="valueList"]'); this.deleteWebhookEntityAction = page.getByTestId('entity-action:Umb.EntityAction.Webhook.Delete'); this.headerRemoveBtn = page.locator('umb-input-webhook-headers').locator('[label="Remove"]'); } async goToWebhooks() { await this.goToSection(ConstantHelper_1.ConstantHelper.sections.settings); await this.goToSettingsTreeItem('Webhooks'); } async goToWebhookWithName(name) { await this.goToWebhooks(); await this.clickTextButtonWithName(name); } async clickWebhookCreateButton() { await (0, test_1.expect)(this.webhookCreateBtn).toBeVisible(); await this.webhookCreateBtn.click(); } async enterWebhookName(name) { await (0, test_1.expect)(this.webhookNameTxt).toBeVisible(); await this.webhookNameTxt.clear(); await this.webhookNameTxt.fill(name); } async enterUrl(url) { await (0, test_1.expect)(this.urlTxt).toBeVisible(); await this.urlTxt.clear(); await this.urlTxt.fill(url); } async clickChooseEventButton() { await (0, test_1.expect)(this.chooseEventBtn).toBeVisible(); await this.chooseEventBtn.click(); } async clickChooseContentTypeButton() { await (0, test_1.expect)(this.chooseContentTypeBtn).toBeVisible(); await this.chooseContentTypeBtn.click(); } async clickEnabledToggleButton() { await (0, test_1.expect)(this.enabledToggle).toBeVisible(); await this.enabledToggle.click(); } async clickAddHeadersButton() { await (0, test_1.expect)(this.addHeadersBtn).toBeVisible(); await this.addHeadersBtn.click(); } async enterHeaderName(name) { await (0, test_1.expect)(this.headerNameTxt).toBeVisible(); await this.headerNameTxt.clear(); await this.headerNameTxt.fill(name); } async enterHeaderValue(value) { await (0, test_1.expect)(this.headerValueTxt).toBeVisible(); await this.headerValueTxt.clear(); await this.headerValueTxt.fill(value); } async clickDeleteWebhookWithName(name) { const deleteLocator = this.page.locator('uui-table-row').filter({ has: this.page.getByText(name, { exact: true }) }).locator(this.deleteWebhookEntityAction); await (0, test_1.expect)(deleteLocator).toBeVisible(); await deleteLocator.click(); } async clickHeaderRemoveButton() { await (0, test_1.expect)(this.headerRemoveBtn).toBeVisible(); await this.headerRemoveBtn.click(); } } exports.WebhookUiHelper = WebhookUiHelper; //# sourceMappingURL=WebhookUiHelper.js.map