Handling environment-specific logic
If your application has environment-specific code or issues, use conditional checks or feature detection to handle them gracefully:
If (process.platform === 'mac'){ // do something specific thats mac only } else { // contine as usual }
Rule of thumb
Try not to get bogged down in getting All-Pass on every browser and operating system. Expand to one additional browser, then one additional operating system. It is best to only perform smoke testing on peripheral configurations. It can easily consume your time supporting logarithmically.
What if we have a new field that has been added to our testing environment but does not exist in production? Can we build a test that will support both? At this point, we can introduce a new set of IfExist()
custom commands. Each base method, including click()
, setValue()
, and select()
, will have a corresponding function: clickIfExist()
, setValueIfExist()
, and selectIfExist()
, respectively...