UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

32 lines 1.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ContentRenderUiHelper = void 0; const UiBaseLocators_1 = require("./UiBaseLocators"); const umbraco_config_1 = require("../../umbraco.config"); class ContentRenderUiHelper extends UiBaseLocators_1.UiBaseLocators { contentRenderValue; constructor(page) { super(page); this.contentRenderValue = page.getByTestId('content-render-value'); } async navigateToRenderedContentPage(contentURL) { await this.page.goto(umbraco_config_1.umbracoConfig.environment.baseUrl + contentURL); } async doesContentRenderValueContainText(text, isEqual = false) { if (isEqual) { return await this.hasText(this.contentRenderValue, text); } else { return await this.containsText(this.contentRenderValue, text); } } async doesContentRenderValueHaveImage(src, width, height) { const imageSrc = src + '?width=' + width.toString() + '&height=' + height.toString(); return await this.hasAttribute(this.contentRenderValue.locator('img'), 'src', imageSrc); } async doesContentRenderValueHaveLink(linkSrc) { return await this.hasAttribute(this.contentRenderValue.locator('a'), 'href', linkSrc); } } exports.ContentRenderUiHelper = ContentRenderUiHelper; //# sourceMappingURL=ContentRenderUiHelper.js.map