question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Inability to determine reason for invisibility

See original GitHub issue

Current behavior:

Per v3.8.0, one might receive a message stating EG. Cypress could not determine why this element '<button>' is not visible.

This is non-sensical, as there’s obviously some heuristic implemented that has determined the element to be invisible.

I understand that there’s a method getReasonIsHidden that is somewhat replicating the behavior of isHidden, but returning a human-readable string instead of a boolean value. I am however having a very hard time understanding why you would implement it like this.

Since there should be one, and only one, heuristic-implemention, why not make one a function of the other?

const getReasonIsHidden = function ($el) {
  // Implementation ...
}

const isHidden = ($el) => {
  return !!getReasonIsHidden($el);
}

Desired behavior:

Never to see such a non-informative error message.

Steps to reproduce: (app code and test code)

Doesn’t really matter here, but I can see if I can produce a minimal example.

Versions

Cypress v3.8.0, Arch Linux, Chrome 77.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:16 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
badeballcommented, Dec 18, 2019

Here’s an example of what I mean by sharing heuristic, without changing the current interface.

function determineVisibility ($el) {
  if ( /* some condition */ ) {
    return {
      visible: false,
      reason: "foobar"
    };
  }

  return {
    visible: true
  };
}

export function isHidden ($el) {
  return !determineVisibility($el).visible;
}

export function getReasonIsHidden ($el) {
  const visibility = determineVisibility($el);

  if (visibility.visible) {
    throw new Error("Erroneously invoked on a visible element");
  }

  return visibility.reason;
}
0reactions
jennifer-shehanecommented, Aug 4, 2020

Yah, there’s a larger issue to evaluate our error messages - showing why something is invisible or visible here: https://github.com/cypress-io/cypress/issues/677

As far as I have seen, there aren’t any open issues of a situation where the ambiguous error ‘could not determine why’ is showing for anyone in the current version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How do you define invisible disability?
The term we define invisible disability refers to symptoms such as debilitating pain, fatigue, dizziness, cognitive dysfunctions, brain injuries, learning ...
Read more >
Invisibility and interpretation - Frontiers
Instead, we argue that invisibility is due to purposeful interpretation, i.e., a goal rather than a limitation. Visibility and invisibility ...
Read more >
The Problem With Invisibility Is The Blindness - Atlas Obscura
But there is still one problem: if a person achieved true, perfect invisibility, they would probably be blind.
Read more >
Invisible Disabilities: List and General Information
An invisible disability is classified as a physical, mental, or neurological condition that is not visible from the outside yet can limit or ......
Read more >
What Are Invisible Illnesses? - Health
Invisible illnesses are chronic and affect those who look perfectly ... chronic illness is not a valid disability due to its invisibility.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found