code: public void alertMatches(double seconds, String expectedAlertPattern) {
          try {
              double timeTook = popup(seconds);
              timeTook = popupMatches(seconds - timeTook, expectedAlertPattern);
              checkAlertMatches(expectedAlertPattern, seconds, timeTook);
          } catch (TimeoutException e) {
              checkAlertMatches(expectedAlertPattern, seconds, seconds);
          }
      }
docs: Waits up to the provided wait time for an alert present on the page has content matching the
  expected patten. This information will be logged and recorded, with a
  screenshot for traceability and added debugging support.
  
  @param expectedAlertPattern the expected text of the alert
  @param seconds              the number of seconds to wait