Skip to content

Conversation

@sonic16x
Copy link
Contributor

No description provided.

@sonic16x sonic16x force-pushed the users/rocketraccoon/TESTPLANE-635.publish-testing-library branch 4 times, most recently from 0d093af to 644394c Compare July 29, 2025 05:56
@sonic16x sonic16x force-pushed the users/rocketraccoon/TESTPLANE-635.publish-testing-library branch from 644394c to 9a2d1df Compare July 29, 2025 07:31
Copy link
Member

@shadowusr shadowusr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks really cool overall, but a few fixes are needed! Great job!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not related to this file: having .nvmrc is a must. Right now after checking out this repo it's not clear which Node version should be used for development.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

package.json Outdated
"license": "MIT",
"homepage": "https://github.com/gemini-testing/testplane-testing-library#readme",
"peerDependencies": {
"testplane": "^8.29.6"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this requirement so high? Wouldn't it work with 8.0.0? Ideally, it should. Can you please check & lower this requirement if possible?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Set to 8.25.3. and tested

package.json Outdated
"eslint": "^9.26.0",
"globals": "^16.1.0",
"prettier": "^3.5.3",
"serve-handler": "^6.1.6",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where do we use this package?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed

"watch": "tsc --watch",
"reformat": "prettier --write .",
"check-formatting": "prettier --check .",
"lint": "eslint ."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's useful to have "prepack": "npm run build" script here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

README.md Outdated
@@ -1,0 +1,54 @@
# Testplane testing library
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's adopt a unified README style that we use across our repos. Here are logos for this repo:

Other things like badges you may copy from our mcp repo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed for logo

README.md Outdated
## Introduction
[Testing-library](https://testing-library.com/) is a collection of tools for testing web application user interfaces, focused on creating reliable and maintainable tests by emphasizing user behavior. The main advantage of `testing-library` is its focus on interaction with interface elements. And in testplane, you can use the element search methods provided by the `testing-library` itself.

## Connection
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think connection has a slightly different meaning, imo "installation" fits better here, but not critical to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

README.md Outdated

## Connection

1. Install the npm package `@testplane/testing-library`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

colon is missing at the end of the line (not critical)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed


## Usage

After configuring, you will be able to use the search by selectors from `testing-library`, as described in the [official documentation](https://testing-library.com/docs/queries/about/). For example, searching for an element by its text:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a disclaimer here that as of now all testing-library selectors return a promise and cannot be chained (like browser.getByText().click() — this is not possible). Each testing-library selector must be awaited before performing any actions on it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

// eslint-disable-next-line @typescript-eslint/no-namespace
namespace WebdriverIO {
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
interface Element extends TestplaneQueries {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Browser should be extended here as well. I am getting this error now when trying to use any method:

Image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another issue I've stumbled upon when trying to use this package is ENOENT error. Here's what I did:

  1. checked out this repo, npm ci + npm run build + npm pack to get tgz of this package.
  2. switched to my testing project and installed this tgz like this npm i -D @testplane/[email protected]
  3. Written this test:
it('should take a screenshot', async ({browser}) => {
    await browser.url('https://example.com/');

    const element = await (browser as any).getByText('Example Domain');

    await element.assertView('target-block');
});

Got this error:

Promise: Promise {
  <rejected> Error: ENOENT: no such file or directory, open '/Users/shadowusr/dev/tp-ts-playground/node_modules/@testplane/testing-library/node_modules/@testing-library/dom/dist/@testing-library/dom.umd.js'
      at Object.openSync (node:fs:573:18)
      at Object.readFileSync (node:fs:452:35)
      at Object.<anonymous> (/Users/shadowusr/dev/tp-ts-playground/node_modules/@testplane/testing-library/build/index.js:32:46)
      at Module._compile (node:internal/modules/cjs/loader:1469:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
      at Object.require.extensions.<computed> [as .js] (/Users/shadowusr/dev/tp-ts-playground/node_modules/ts-node/src/index.ts:1608:43)
      at Module.load (node:internal/modules/cjs/loader:1288:32)
      at Function.Module._load (node:internal/modules/cjs/loader:1104:12)
      at Module.require (node:internal/modules/cjs/loader:1311:19)
      at require (node:internal/modules/helpers:179:18)
      at Object.<anonymous> (/Users/shadowusr/dev/tp-ts-playground/.testplane.conf.ts:2:1)
      at Module._compile (node:internal/modules/cjs/loader:1469:14)
      at Module.m._compile (/Users/shadowusr/dev/tp-ts-playground/node_modules/ts-node/src/index.ts:1618:23)
      at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
      at Object.require.extensions.<computed> [as .ts] (/Users/shadowusr/dev/tp-ts-playground/node_modules/ts-node/src/index.ts:1621:12)
      at Module.load (node:internal/modules/cjs/loader:1288:32) {
    errno: -2,
    code: 'ENOENT',
    syscall: 'open',
    path: '/Users/shadowusr/dev/tp-ts-playground/node_modules/@testplane/testing-library/node_modules/@testing-library/dom/dist/@testing-library/dom.umd.js'
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@sonic16x sonic16x force-pushed the users/rocketraccoon/TESTPLANE-635.publish-testing-library branch from b5ead1c to 445950f Compare August 1, 2025 12:17
@sonic16x sonic16x merged commit e5080a1 into master Aug 1, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants