Skip to content

Commit

Permalink
Some selectors don't like spaces (#4)
Browse files Browse the repository at this point in the history
* Some selectors don't like spaces

Preveting:
Error: InvalidSelectorError: Error while parsing selector ` ` - unexpected symbol

* Bump version
  • Loading branch information
abdala authored Oct 2, 2024
1 parent a4a8a1b commit a581baf
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion assert/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/assert",
"version": "0.2.1",
"version": "0.2.2",
"description": "Extra assert library",
"type": "module",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion dtc-aws-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-aws-plugin",
"version": "0.2.1",
"version": "0.2.2",
"description": "AWS plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion dtc-mysql-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-mysql-plugin",
"version": "0.2.1",
"version": "0.2.2",
"description": "MySQL plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion dtc-playwright-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc-playwright-plugin",
"version": "0.2.1",
"version": "0.2.2",
"description": "Playwright plugin for Declarative TestCases",
"repository": {
"type": "git",
Expand Down
11 changes: 6 additions & 5 deletions dtc-playwright-plugin/src/PlaywrightPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,20 @@ const executeActions = async (actions: PlaywrightAction[], page: Page) => {
if (selectorMatch && selectorMatch.length > 0) {
element = page.locator(act.target)
} else {
const targetWithoutSpaces = act.target.replaceAll(/\s/g,'')
element =
(await page.getByTestId(act.target).count()) > 0
? page.getByTestId(act.target)
: (await page.getByPlaceholder(act.target).count()) > 0
(await page.getByPlaceholder(act.target).count()) > 0
? page.getByPlaceholder(act.target)
: (await page.getByText(act.target).count()) > 0
? page.getByText(act.target)
: (await page.getByTitle(act.target).count()) > 0
? page.getByTitle(act.target)
: (await page.getByLabel(act.target).count()) > 0
? page.getByLabel(act.target)
: (await page.getByRole(act.target as 'status').count()) > 0
? page.getByRole(act.target as 'status')
: (await page.getByTestId(targetWithoutSpaces).count()) > 0
? page.getByTestId(targetWithoutSpaces)
: (await page.getByRole(targetWithoutSpaces as 'status').count()) > 0
? page.getByRole(targetWithoutSpaces as 'status')
: page.locator(act.target)
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion dtc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/dtc",
"version": "0.2.1",
"version": "0.2.2",
"description": "Declarative TestCases",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion nock-aws/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/nock-aws",
"version": "0.2.1",
"version": "0.2.2",
"description": "AWS Request mocker based on Nock",
"repository": {
"type": "git",
Expand Down
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion yaml/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cgauge/yaml",
"version": "0.2.1",
"version": "0.2.2",
"description": "YAML parser with extra tags",
"repository": {
"type": "git",
Expand Down

0 comments on commit a581baf

Please sign in to comment.