expect-protractor
Advanced tools
Comparing version 1.0.6 to 1.0.7
declare namespace jasmine { | ||
interface Matchers<T> { | ||
toBeDisplayed(): Promise<void>; | ||
} | ||
} | ||
interface Matchers<T> { | ||
toBeDisplayed(): Promise<void>; | ||
toBePresent(): Promise<void>; | ||
toHaveText(expectedText: string): Promise<void>; | ||
toContainText(expectedText: string): Promise<void>; | ||
} | ||
} |
@@ -6,10 +6,10 @@ "use strict"; | ||
toBeDisplayed() { | ||
const result = { | ||
pass: false, | ||
message: '', | ||
}; | ||
return { | ||
compare(element) { | ||
const result = { | ||
pass: false, | ||
message: '', | ||
}; | ||
result.pass = utils_1.isElementDisplayed(element); | ||
result.message = `Expected element '${element.locator().value}' to be displayed on the page`; | ||
result.pass = utils_1.isElementDisplayed(element); | ||
return result; | ||
@@ -19,3 +19,46 @@ }, | ||
}, | ||
toBePresent() { | ||
return { | ||
compare(element) { | ||
const result = { | ||
pass: false, | ||
message: '', | ||
}; | ||
result.pass = utils_1.isElementPresent(element); | ||
result.message = `Expected element '${element.locator().value}' to be present on the page`; | ||
return result; | ||
}, | ||
}; | ||
}, | ||
toHaveText() { | ||
return { | ||
compare(element, expectedText) { | ||
const result = { | ||
pass: false, | ||
message: '', | ||
}; | ||
result.pass = utils_1.getElementText(element).then((actualText) => { | ||
result.message = `Expected text '${actualText}' to be ${expectedText}`; | ||
return actualText === expectedText; | ||
}); | ||
return result; | ||
}, | ||
}; | ||
}, | ||
toContainText() { | ||
return { | ||
compare(element, expectedText) { | ||
const result = { | ||
pass: false, | ||
message: '', | ||
}; | ||
result.pass = utils_1.getElementText(element).then((actualText) => { | ||
result.message = `Expected text '${actualText}' to contain ${expectedText}`; | ||
return actualText.includes(expectedText); | ||
}); | ||
return result; | ||
}, | ||
}; | ||
}, | ||
}; | ||
module.exports = customMatchers; |
@@ -12,3 +12,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isElementDisplayed = void 0; | ||
exports.getElementText = exports.isElementPresent = exports.isElementDisplayed = void 0; | ||
function isElementDisplayed(element) { | ||
@@ -26,1 +26,13 @@ return __awaiter(this, void 0, void 0, function* () { | ||
exports.isElementDisplayed = isElementDisplayed; | ||
function isElementPresent(element) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return element.isPresent(); | ||
}); | ||
} | ||
exports.isElementPresent = isElementPresent; | ||
function getElementText(element) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return element.getText(); | ||
}); | ||
} | ||
exports.getElementText = getElementText; |
{ | ||
"name": "expect-protractor", | ||
"version": "1.0.6", | ||
"version": "1.0.7", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
6143
106