Skip to content

review changes#3

Merged
rev-doshi merged 9 commits intoamaanbs:wdio_percy_support_v8from
rev-doshi:wdio_percy_support_v8
Jan 9, 2024
Merged

review changes#3
rev-doshi merged 9 commits intoamaanbs:wdio_percy_support_v8from
rev-doshi:wdio_percy_support_v8

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

) {
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
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