Skip to content

feat: other locators from playwright #4090

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const ElementNotFound = require('./errors/ElementNotFound');
const RemoteBrowserConnectionRefused = require('./errors/RemoteBrowserConnectionRefused');
const Popup = require('./extras/Popup');
const Console = require('./extras/Console');
const findReact = require('./extras/React');
const findReact = require('./extras/PlaywrightReactVueLocator');

let playwright;
let perfTiming;
Expand Down
9 changes: 0 additions & 9 deletions lib/helper/extras/PlaywrightReact.js

This file was deleted.

32 changes: 32 additions & 0 deletions lib/helper/extras/PlaywrightReactVueLocator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = async function findReact(matcher, locator) {
let _locator = `_react=${locator.react}`;
let props = '';

if (locator.props) {
props += propBuilder(locator.props);
_locator += props;
}

return matcher.locator(_locator).all();
};

module.exports = async function findVue(matcher, locator) {
let _locator = `_vue=${locator.vue}`;
let props = '';

if (locator.props) {
props += propBuilder(locator.props);
_locator += props;
}

return matcher.locator(_locator).all();
};

function propBuilder(props) {
let _props = '';

for (const [key, value] of Object.entries(props)) {
_props += `[${key} = "${value}"]`;
}
return _props;
}
2 changes: 1 addition & 1 deletion typings/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ declare namespace CodeceptJS {
| string
| ILocator
| Locator
| CustomLocators[keyof CustomLocators];
| CustomLocators;

type StringOrSecret = string | CodeceptJS.Secret;

Expand Down