Skip to content

Commit

Permalink
fix: add locator on the expected conditions result
Browse files Browse the repository at this point in the history
  • Loading branch information
iamkenos committed Jul 12, 2024
1 parent fb6e855 commit c306e23
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/conditions/expected-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class ExpectedConditions {
evaluations,
passed: failed === 0,
message: `${failed}/${total} expected conditions not met after waiting for ${this.timeout}ms:
Expression: ${this.name}
Expression: ${this.name}${this["locator"] ? `\n Locator: ${this["locator"]["__proto"]}` : ""}
${evaluations.map((result) => result.message).join("\n ------------------------------")}`
};
}
Expand Down
1 change: 0 additions & 1 deletion src/conditions/locator/locator-conditions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export class LocatorConditions extends ExpectedConditions {

constructor(locator: Locator, options?: ExpectedConditionOptions) {
super(options);
this.name = this.name + `\n With: ${locator}`;
this.locator = locator;
}

Expand Down
2 changes: 1 addition & 1 deletion src/conditions/page/condition/truthy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class Truthy extends PageCondition {
super(preferred);
this.expected = true;
this.truthy = truthy;
this.name = changecase.pascalCase((this.truthy as any)["name"] || this.name);
this.name = changecase.capitalCase((this.truthy as any)["name"] || this.name);
}

async evaluate() {
Expand Down
2 changes: 1 addition & 1 deletion src/core/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export abstract class World extends AllureWorld implements PrivateWorld {
}

findPageObjectProp<T = any>(page: string, prop: string, fallback?: T): T {
const [ fnOrProp, ...args] = prop.split("::").map(i => i.trim());
const [fnOrProp, ...args] = prop.split("::").map(i => i.trim());
const pageObject = this.findPageObject(page);
const result = pageObject[fnOrProp] || pageObject[changecase.camelCase(fnOrProp ?? "")] || fallback || fnOrProp;
return result instanceof Function ? result(...args) : result;
Expand Down

0 comments on commit c306e23

Please sign in to comment.