By using dismiss() method of Alerts class, we cancel or close alerts in Protractor.
Note: We have to switch the control to the alert using switchTo().alert() before cancel the alert.
browser.switchTo().alert().dismiss()
browser.switchTo().alert().dismiss()