UNPKG

@umbraco/playwright-testhelpers

Version:

Test helpers for making playwright tests for Umbraco solutions

33 lines 1.51 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ContentRenderUiHelper = void 0; const test_1 = require("@playwright/test"); 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 (0, test_1.expect)(this.contentRenderValue).toHaveText(text); } else { return await (0, test_1.expect)(this.contentRenderValue).toContainText(text); } } async doesContentRenderValueHaveImage(src, width, height) { const imageSrc = src + '?width=' + width.toString() + '&height=' + height.toString(); return await (0, test_1.expect)(this.contentRenderValue.locator('img')).toHaveAttribute('src', imageSrc); } async doesContentRenderValueHaveLink(linkSrc) { return await (0, test_1.expect)(this.contentRenderValue.locator('a')).toHaveAttribute('href', linkSrc); } } exports.ContentRenderUiHelper = ContentRenderUiHelper; //# sourceMappingURL=ContentRenderUiHelper.js.map