cerner / terra-toolkit

Terra Toolkit is a monorepo that contains utility modules for use when developing using Terra components
https://engineering.cerner.com/terra-toolkit
Apache License 2.0
32 stars 37 forks source link

[functional-testing] Fixed WDIO test Failures due to negative width value and invalid Ip address #781

Closed supreethmr closed 1 year ago

supreethmr commented 1 year ago

Summary

  1. WDIO tests started failing on Jenkins with below error functional-testing. upon investigation we found that viewportSize.width is greater than windowSize.width. Due to this widthDiff and heightDiff were having negative values after calculation. Since browser.setWindowSize expects non negative integer wdio tests were failed with below error.
[2023-04-05T12:51:49.327Z] [internet explorer 11 windows #1-3] 1) [large] "before all" hook for [large]

[2023-04-05T12:51:49.327Z] [internet explorer 11 windows #1-3] setWindowSize expects width and height to be a number in the 0 to 2^31 − 1 range

[2023-04-05T12:51:49.327Z] [internet explorer 11 windows #1-3] Error: setWindowSize expects width and height to be a number in the 0 to 2^31 − 1 range

[2023-04-05T12:51:49.327Z] [internet explorer 11 windows #1-3]   at setViewportSize (/app/node_modules/@cerner/terra-functional-testing/lib/commands/utils/setViewportSize.js:14:18)

[2023-04-05T12:51:49.327Z] [internet explorer 11 windows #1-3]   at setViewport (/app/node_modules/@cerner/terra-functional-testing/lib/commands/utils/setViewport.js:22:3)

[2023-04-05T12:51:49.328Z] [internet explorer 11 windows #1-3]   at Context.<anonymous> (/app/node_modules/@cerner/terra-functional-testing/lib/commands/utils/describeViewports.js:27:9)
  1. WDIO tests started failing when connected to VPN. getIpAddress helper was returning invalid ipv4 address due to which WDIO tests were failing on local machine.

Additional Details

  1. Math.abs() function is used to get absolute value of negative values so that setWindowSize() function work as expected.
  2. updated getIpAddress() helper to return valid ipv4 address.

@cerner/terra