Forum Discussion

nastester's avatar
nastester
Regular Contributor
6 months ago

Switching between headless/non-headless execution

Is there a good way to do what the title says?

I have a switch statement that will launch my browser and login either headless or non-headless:

 

function chooseTestMode(mode)
{
  
      switch (mode) {

      case "non-headless":
      runNonHeadless();
      break;
        
      case "headless":
      runHeadless();
      break;
        
      default:
      runNonHeadless();
      
    }

}

This works but the tests that I actually want to run either headless or non-headless, may have navigate statements or other actions which will not for both test modes. 

What is a good way to handle this? Is there one? 

No RepliesBe the first to reply