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

feat(playwright-html-report): added global checkbox for enabling/disabling html snippets to Playwright Report #35203

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

Conversation

agamjots05
Copy link

@agamjots05 agamjots05 commented Mar 15, 2025

fixes #34052

Before:
before

After:
Not Showing Snippets:
afterNotShowing

Showing Snippets
afterShowing

agamjots05 and others added 2 commits March 14, 2025 20:29
Added functionality such that enabling the checkbox shows snippets, while disabling, hides snippets

Co-authored-by: Asher Alacar <[email protected]>
Co-authored-by: Jiayi Chen <[email protected]>
…box state

Co-authored-by: Agamjot Singh <[email protected]>
Co-authored-by: Jiayi Chen <[email protected]>

This comment has been minimized.

Copy link
Contributor

Test results for "tests 1"

3 flaky ⚠️ [firefox-page] › tests/page/page-evaluate.spec.ts:403:3 › should throw for too deep reference chain @firefox-ubuntu-22.04-node18
⚠️ [playwright-test] › tests/ui-mode-trace.spec.ts:341:5 › should work behind reverse proxy @macos-latest-node18-1
⚠️ [webkit-page] › tests/page/page-screenshot.spec.ts:345:5 › page screenshot › should work while navigating @webkit-ubuntu-22.04-node18

38771 passed, 808 skipped
✔️✔️✔️

Merge workflow run.

@agamjots05 agamjots05 changed the title feat(playwright-html-report): added checkbox for enabling/disabling html snippets to Playwright Report feat(playwright-html-report): added global checkbox for enabling/disabling html snippets to Playwright Report Mar 16, 2025
@agamjots05 agamjots05 marked this pull request as draft March 17, 2025 22:43
@agamjots05 agamjots05 marked this pull request as ready for review March 17, 2025 22:43
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.

@agamjots05 Could you please include a screenshot that demonstrates the new feature? It is particularly important for UI changes, because it's hard to assess otherwise.

@@ -0,0 +1,21 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

The copyright seems to omit empty lines for some reason.

See the License for the specific language governing permissions and
limitations under the License.
*/
.setting {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please format the source consistently with other files, keeping the same indentation?

@@ -0,0 +1,47 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here about the copyright being off.

};

export const CheckBox: React.FunctionComponent<{
checkBoxSettings: Check<boolean>[];
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are there multiple "settings" passed to a single checkbox?

import * as React from 'react';
import './checkbox.css';

export type Check<T> = {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here, please format consistently.

@@ -71,6 +72,7 @@ export const TestResultView: React.FC<{
test: TestCase,
result: TestResult,
}> = ({ test, result }) => {
const [showSnippets, setShowSnippets] = React.useState(true);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this should be a global setting applying to all test results, so it must live somewhere higher up in the components tree.

await thirdTreeItem.click();

const codeSnippets = page.locator('[data-testid="test-snippet"]');
await expect(codeSnippets.first()).toBeVisible();
Copy link
Contributor

Choose a reason for hiding this comment

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

It is better to use toHaveCount(3) with the right number here, and toHaveCount(0) to check that snippets are hidden.

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.

[Feature]: Add a parameter in the test.step() method to hide code in report
3 participants