You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using AI to generate Page Objects, it generates a number of them that start with simply locate() with no parameter passed.
According to the code, this is completely valid: Locator.build = (locator) => { if (!locator) return new Locator({ xpath: '//*' }); return new Locator(locator, 'css'); };
Typescript is upset there is nothing passed as the type is defined as: static build(locator: CodeceptJS.LocatorOrString): Locator;
Since the actual function doesn't care about having a 'locator' actually passed, this should be set to optional. static build(locator?: CodeceptJS.LocatorOrString): Locator;
Details
CodeceptJS version: 3.6.7
NodeJS Version:22.2.0
Operating System: Mac
Workaround
Add a locator parameter to the locate call.
The text was updated successfully, but these errors were encountered:
What are you trying to achieve?
When using AI to generate Page Objects, it generates a number of them that start with simply
locate()
with no parameter passed.According to the code, this is completely valid:
Locator.build = (locator) => { if (!locator) return new Locator({ xpath: '//*' }); return new Locator(locator, 'css'); };
Typescript is upset there is nothing passed as the type is defined as:
static build(locator: CodeceptJS.LocatorOrString): Locator;
Since the actual function doesn't care about having a 'locator' actually passed, this should be set to optional.
static build(locator?: CodeceptJS.LocatorOrString): Locator;
Details
Workaround
Add a locator parameter to the locate call.
The text was updated successfully, but these errors were encountered: