Skip to content
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

chore: Add new method testIdAttributeName #32506

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

serialbandicoot
Copy link

Description:

This pull request introduces a new method, testIdAttributeName; this method will get the current TestIdAttributeName either set using Selectors.setTestIdAttribute or initially with the user config. Therefore this will introduce Selectors.testIdAttributeName

Motivation:

Knowing the most up-to date set testIdAttributeName. If the testAttributeName has been modified at runtime, this new method would allow the user to get this value. In my own use-case I want to get the value because across and within my projects, shared libraries need to know what the current testid is and a simple export via playwright.config.ts of the testIdAttribute value is not sufficient enough.

Changes:

Added functionality and a test to confirm the current testIdAttributeName

@serialbandicoot
Copy link
Author

@serialbandicoot please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="{your company}"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@microsoft-github-policy-service agree

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

@serialbandicoot serialbandicoot changed the title chore: Add new method testIdAttributeName to get the current TestIdAttributeName value chore: Add new method testIdAttributeName Sep 8, 2024

This comment has been minimized.

Copy link
Contributor

@dgozman dgozman left a comment

Choose a reason for hiding this comment

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

For any API changes, please file an issue first (probably a Feature request), so we can have a discussion there. This helps with visibility and code archeology in the future.

Copy link
Contributor

github-actions bot commented Sep 9, 2024

Test results for "tests 1"

2 failed
❌ [playwright-test] › runner.spec.ts:118:5 › should ignore subprocess creation error because of SIGINT
❌ [playwright-test] › babel.spec.ts:135:5 › should not transform external

2 flaky ⚠️ [chromium-library] › library/trace-viewer.spec.ts:1469:1 › should allow showing screenshots instead of snapshots
⚠️ [webkit-library] › library/download.spec.ts:698:3 › should convert navigation to a resource with unsupported mime type into download

29595 passed, 638 skipped
✔️✔️✔️

Merge workflow run.

@mxschmitt
Copy link
Member

Would it be possible to file an issue for it first? Usually Playwright expects the call side to know which values has been set (we don't have setters for everything) - so curious who changes the testIdAttribute in your case.

@serialbandicoot
Copy link
Author

serialbandicoot commented Sep 17, 2024

Hi @mxschmitt & @dgozman

Thanks for the replies...

I was going to recreate as Feature request, now I'm not clear which one. Originally I thought this was perhaps just a missing method, because the similarities in the server, (see link).

Happy switch to either Issue/Feature, but would appreciate follow up to which?

testIdAttributeName(): string {

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