@atomic-testing/core
Advanced tools
Comparing version 0.36.0 to 0.37.0
@@ -13,3 +13,4 @@ "use strict"; | ||
const actualLocator = driver.prototype.overrideLocatorRelativePosition() != null | ||
? __1.locatorUtil.overrideLocatorRelativePosition(locator, driver.prototype.overrideLocatorRelativePosition()) | ||
? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
__1.locatorUtil.overrideLocatorRelativePosition(locator, driver.prototype.overrideLocatorRelativePosition()) | ||
: locator; | ||
@@ -16,0 +17,0 @@ const componentLocator = __1.locatorUtil.append(locatorContext, actualLocator); |
@@ -25,3 +25,2 @@ "use strict"; | ||
exports.getListItemIterator = exports.getListItemByIndex = void 0; | ||
const __1 = require(".."); | ||
const locators_1 = require("../locators"); | ||
@@ -42,3 +41,2 @@ const locatorUtil_1 = require("../utils/locatorUtil"); | ||
const itemLocator = (0, locatorUtil_1.append)(itemLocatorBase, nthLocator); | ||
const selector = yield __1.locatorUtil.toCssSelector(itemLocator, host.interactor); | ||
const exists = yield host.interactor.exists(itemLocator); | ||
@@ -45,0 +43,0 @@ if (exists) { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ItemNotFoundError = exports.ItemNotFoundErrorId = void 0; | ||
const locatorUtil_1 = require("../utils/locatorUtil"); | ||
const ErrorBase_1 = require("./ErrorBase"); | ||
exports.ItemNotFoundErrorId = 'ItemNotFoundError'; | ||
function getErrorMessage(locator) { | ||
return `Item not found. Locator: ${locator}`; | ||
const selector = (0, locatorUtil_1.getLocatorInfoForErrorLog)(locator); | ||
return `Item not found. Locator: ${selector}`; | ||
} | ||
@@ -9,0 +11,0 @@ class ItemNotFoundError extends ErrorBase_1.ErrorBase { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WaitForFailureError = exports.WaitForFailureErrorId = void 0; | ||
const locatorUtil_1 = require("../utils/locatorUtil"); | ||
const ErrorBase_1 = require("./ErrorBase"); | ||
exports.WaitForFailureErrorId = 'WaitForFailureError'; | ||
function getErrorMessage(locator, option) { | ||
const cssLocator = `${locator}`; | ||
return `Wait for element to be ${option.condition} failed after ${option.timeoutMs}ms: ${cssLocator}`; | ||
const selector = (0, locatorUtil_1.getLocatorInfoForErrorLog)(locator); | ||
return `Wait for element to be ${option.condition} failed after ${option.timeoutMs}ms: ${selector}`; | ||
} | ||
@@ -10,0 +11,0 @@ class WaitForFailureError extends ErrorBase_1.ErrorBase { |
@@ -30,1 +30,9 @@ import { Optional } from '../dataTypes'; | ||
export declare function overrideLocatorRelativePosition(locator: PartLocator, relative: LocatorRelativePosition, option?: Partial<Readonly<OverrideLocatorRelativePositionOption>>): PartLocator; | ||
/** | ||
* Display a rough description of the locators for error logging | ||
* this is an estimate, not a precise description with the absence of interactor | ||
* locators such as LinkedCssLocator would not be interpreted correctly | ||
* @param locator | ||
* @returns | ||
*/ | ||
export declare function getLocatorInfoForErrorLog(locator: PartLocator): string; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.overrideLocatorRelativePosition = exports.defaultOverrideLocatorRelativePositionOption = exports.getLocatorStatement = exports.getLinkedCssLocatorMatchingTargetValue = exports.getLinkedCssLocator = exports.toCssSelector = exports.getEffectiveLocator = exports.toPrimitiveLocators = exports.findRootLocatorIndex = exports.append = exports.toChain = exports.isChain = void 0; | ||
exports.getLocatorInfoForErrorLog = exports.overrideLocatorRelativePosition = exports.defaultOverrideLocatorRelativePositionOption = exports.getLocatorStatement = exports.getLinkedCssLocatorMatchingTargetValue = exports.getLinkedCssLocator = exports.toCssSelector = exports.getEffectiveLocator = exports.toPrimitiveLocators = exports.findRootLocatorIndex = exports.append = exports.toChain = exports.isChain = void 0; | ||
const locators_1 = require("../locators"); | ||
@@ -149,2 +149,18 @@ const LinkedCssLocator_1 = require("../locators/LinkedCssLocator"); | ||
exports.overrideLocatorRelativePosition = overrideLocatorRelativePosition; | ||
/** | ||
* Display a rough description of the locators for error logging | ||
* this is an estimate, not a precise description with the absence of interactor | ||
* locators such as LinkedCssLocator would not be interpreted correctly | ||
* @param locator | ||
* @returns | ||
*/ | ||
function getLocatorInfoForErrorLog(locator) { | ||
const locators = Array.isArray(locator) ? locator : [locator]; | ||
const selectors = []; | ||
for (const loc of locators) { | ||
selectors.push(loc.selector); | ||
} | ||
return selectors.join(', '); | ||
} | ||
exports.getLocatorInfoForErrorLog = getLocatorInfoForErrorLog; | ||
//# sourceMappingURL=locatorUtil.js.map |
{ | ||
"name": "@atomic-testing/core", | ||
"version": "0.36.0", | ||
"version": "0.37.0", | ||
"description": "Core library for atomic-testing", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -25,3 +25,4 @@ import { locatorUtil, PartLocator } from '..'; | ||
driver.prototype.overrideLocatorRelativePosition() != null | ||
? locatorUtil.overrideLocatorRelativePosition(locator, driver.prototype.overrideLocatorRelativePosition()!) | ||
? // eslint-disable-next-line @typescript-eslint/no-unsafe-argument | ||
locatorUtil.overrideLocatorRelativePosition(locator, driver.prototype.overrideLocatorRelativePosition()!) | ||
: locator; | ||
@@ -28,0 +29,0 @@ |
@@ -1,2 +0,1 @@ | ||
import { locatorUtil } from '..'; | ||
import { byCssSelector, CssLocator, LocatorRelativePosition, PartLocator } from '../locators'; | ||
@@ -24,3 +23,2 @@ import { ComponentDriverClass } from '../partTypes'; | ||
const itemLocator = append(itemLocatorBase, nthLocator); | ||
const selector = await locatorUtil.toCssSelector(itemLocator, host.interactor); | ||
const exists = await host.interactor.exists(itemLocator); | ||
@@ -27,0 +25,0 @@ if (exists) { |
import { ComponentDriver } from '../drivers/ComponentDriver'; | ||
import { PartLocator } from '../locators'; | ||
import { getLocatorInfoForErrorLog } from '../utils/locatorUtil'; | ||
import { ErrorBase } from './ErrorBase'; | ||
@@ -8,3 +9,4 @@ | ||
function getErrorMessage(locator: PartLocator): string { | ||
return `Item not found. Locator: ${locator}`; | ||
const selector = getLocatorInfoForErrorLog(locator); | ||
return `Item not found. Locator: ${selector}`; | ||
} | ||
@@ -11,0 +13,0 @@ |
import { ComponentDriver } from '../drivers/ComponentDriver'; | ||
import { WaitForOption } from '../drivers/WaitForOption'; | ||
import { PartLocator } from '../locators'; | ||
import { getLocatorInfoForErrorLog } from '../utils/locatorUtil'; | ||
import { ErrorBase } from './ErrorBase'; | ||
@@ -9,4 +10,4 @@ | ||
function getErrorMessage(locator: PartLocator, option: WaitForOption): string { | ||
const cssLocator = `${locator}`; | ||
return `Wait for element to be ${option.condition} failed after ${option.timeoutMs}ms: ${cssLocator}`; | ||
const selector = getLocatorInfoForErrorLog(locator); | ||
return `Wait for element to be ${option.condition} failed after ${option.timeoutMs}ms: ${selector}`; | ||
} | ||
@@ -13,0 +14,0 @@ |
@@ -156,1 +156,19 @@ import { Optional } from '../dataTypes'; | ||
} | ||
/** | ||
* Display a rough description of the locators for error logging | ||
* this is an estimate, not a precise description with the absence of interactor | ||
* locators such as LinkedCssLocator would not be interpreted correctly | ||
* @param locator | ||
* @returns | ||
*/ | ||
export function getLocatorInfoForErrorLog(locator: PartLocator): string { | ||
const locators = Array.isArray(locator) ? locator : [locator]; | ||
const selectors: string[] = []; | ||
for (const loc of locators) { | ||
selectors.push(loc.selector); | ||
} | ||
return selectors.join(', '); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
191988
3743