function clickButton(btnId) {
            var doc = $(testWindow.document),
                errorPopUp = doc.find(".error-dialog.instance"),
                btn = errorPopUp.find('.dialog-button'),
                openBtn,
                cancelBtn,
                clickBtn;
            if (btn[0].classList.contains("primary")) {
                openBtn = btn[0];
                cancelBtn = btn[1];
            }

            if (btn[1].classList.contains("primary")) {
                openBtn = btn[1];
                cancelBtn = btn[0];
            }
            clickBtn = cancelBtn;

            if(btnId === "OPEN") {
                clickBtn = openBtn;
            }

            if(clickBtn) {
                clickBtn.click();
                waitForMilliSeconds(3000);
                runs(function() {
                    expect(doc.find(".error-dialog.instance").length).toBe(0);
                });
            }
        }
Check the presence of a Button in Error Prompt
@param {String} btnId - Button OPEN or Cancel Button