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

review changes #3

Merged
merged 9 commits into from
Jan 9, 2024
Merged

review changes #3

merged 9 commits into from
Jan 9, 2024

Conversation

rev-doshi
Copy link
Collaborator

Proposed changes

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Checklist

  • I have read the CONTRIBUTING doc
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • I have added proper type definitions for new commands (if appropriate)

Further comments

Reviewers: @webdriverio/project-committers

Copy link
Collaborator

@sriteja777 sriteja777 left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -29,7 +29,7 @@ class _PercyHandler {
private _framework?: string
) {
this._isAppAutomate = isAppAutomate
if (!_percyAutoCaptureMode || !['click', 'auto', 'screenshot', 'manual', 'testcase'].includes(_percyAutoCaptureMode as string)) {
if (_percyAutoCaptureMode && !_percyAutoCaptureMode || !CAPTURE_MODES.includes(_percyAutoCaptureMode as string)) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Won't the first two conditions always evaluate to false?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, its correct, the variable is a string and it is null check, have tested it

Copy link
Collaborator

@sriteja777 sriteja777 Jan 8, 2024

Choose a reason for hiding this comment

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

I mean the first two conditions are _percyAutoCaptureMode && !_percyAutoCaptureMode. It's like a & !a which always evaluates to false. So is that condition even necessary?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It does always evaluate to undefined or false
But it is acting a null check for the next expression ->
CAPTURE_MODES.includes(_percyAutoCaptureMode as string)

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nope. It's not. It's evaluating to (a && b) || c. How is the above condition guaranteeing null check on a?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@@ -1,13 +1,14 @@
declare namespace WebdriverIO {
import PercyCaptureMap from '../Percy/PercyCaptureMap.js'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why it is not at top?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

https://www.typescriptlang.org/docs/handbook/namespaces-and-modules.html

namespaces/modules are used to organise code and declarations, import statement outside doesn't make sense and hence the build will fail too if we are to import outside

Copy link
Collaborator

Choose a reason for hiding this comment

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

I couldn't find any reference in the above link that says imports should be inside namespace declaration. What exact build error does it give if we do the imports outside?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed

@rev-doshi rev-doshi merged commit 7b07fa3 into amaanbs:wdio_percy_support_v8 Jan 9, 2024
6 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
3 participants