detox-allure2-adapter
Version:
Detox adapter for jest-allure2-reporter
66 lines • 2.35 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DetoxWebAtomMatcher = void 0;
const utils_1 = require("../../utils");
class DetoxWebAtomMatcher {
kind;
value;
constructor(kind, value) {
this.kind = kind;
this.value = value;
}
static matcherForId(id) {
return new DetoxWebAtomMatcher('id', id);
}
static matcherForClassName(className) {
return new DetoxWebAtomMatcher('class', className);
}
static matcherForCssSelector(cssSelector) {
return new DetoxWebAtomMatcher('css', cssSelector);
}
static matcherForName(name) {
return new DetoxWebAtomMatcher('name', name);
}
static matcherForXPath(xpath) {
return new DetoxWebAtomMatcher('xpath', xpath);
}
static matcherForLinkText(linkText) {
return new DetoxWebAtomMatcher('linkText', linkText);
}
static matcherForPartialLinkText(partialLinkText) {
return new DetoxWebAtomMatcher('partialLinkText', partialLinkText);
}
static matcherForTagName(tag) {
return new DetoxWebAtomMatcher('tag', tag);
}
toJSON() {
switch (this.kind) {
case 'id': {
return (0, utils_1.msg)(`#${this.value}`, { web_id: this.value });
}
case 'class': {
return (0, utils_1.msg)(`.${this.value}`, { web_class: this.value });
}
case 'css': {
return (0, utils_1.msg)(this.value, { web_selector: this.value });
}
case 'name': {
return (0, utils_1.msg)(`[name="${this.value}"]`, { web_name: this.value });
}
case 'xpath': {
return (0, utils_1.msg)(`xpath: ${this.value}`, { web_xpath: this.value });
}
case 'linkText': {
return (0, utils_1.msg)(`link "${this.value}"`, { web_text: this.value });
}
case 'partialLinkText': {
return (0, utils_1.msg)(`link containing "${this.value}"`, { web_text: this.value });
}
case 'tag': {
return (0, utils_1.msg)(this.value, { web_tag: this.value });
}
}
}
}
exports.DetoxWebAtomMatcher = DetoxWebAtomMatcher;
//# sourceMappingURL=DetoxWebAtomMatcher.js.map