/**
   * Closes the participant and leaves the owner alone in the room. Mutes the owner and then joins
   * new participant and checks the status of the mute icon. At the end unmutes to clear the state.
   */
  public void muteOwnerBeforeSecondParticipantJoins() {
    System.err.println("Start muteOwnerBeforeSecondParticipantJoins.");

    WebDriver owner = ConferenceFixture.getOwner();
    ConferenceFixture.close(ConferenceFixture.getSecondParticipant());

    // just in case wait
    TestUtils.waitMillis(1000);

    MeetUIUtils.clickOnToolbarButton(owner, "toolbar_button_mute");

    WebDriver secondParticipant = ConferenceFixture.startSecondParticipant();

    MeetUtils.waitForParticipantToJoinMUC(secondParticipant, 15);

    MeetUtils.waitForIceConnected(secondParticipant);

    MeetUIUtils.assertMuteIconIsDisplayed(
        secondParticipant,
        owner,
        true, // should be muted
        false, // audio
        "owner");

    // now lets unmute
    unMuteOwnerAndCheck();
  }
  /** Mutes the participant and checks at owner side. */
  public void muteThirdParticipantAndCheck() {
    MeetUIUtils.clickOnToolbarButton(ConferenceFixture.getThirdParticipant(), "mute");

    MeetUIUtils.verifyIsMutedStatus(
        "participant3",
        ConferenceFixture.getThirdParticipant(),
        ConferenceFixture.getOwner(),
        true);
  }
  /** UnMutes the participant and checks at owner side. */
  public void unMuteParticipantAndCheck() {
    MeetUIUtils.clickOnToolbarButton(ConferenceFixture.getSecondParticipant(), "mute");

    MeetUIUtils.verifyIsMutedStatus(
        "participant2",
        ConferenceFixture.getSecondParticipant(),
        ConferenceFixture.getOwner(),
        false);
  }
  /**
   * UnMutes once again the second participant and checks in the owner page does this change is
   * reflected.
   */
  public void participantUnMutesAfterOwnerMutedHimAndCheck() {
    MeetUIUtils.clickOnToolbarButton(ConferenceFixture.getSecondParticipant(), "mute");

    TestUtils.waitsForElementNotPresentByXPath(
        ConferenceFixture.getOwner(),
        "//span[@class='audioMuted']/i[@class='icon-mic-disabled']",
        5);

    // lets give time to the ui to reflect the change in the ui of the owner
    TestUtils.waits(1000);
  }
 /**
  * Toggles the mute state of a specific Meet conference participant and verifies that a specific
  * other Meet conference participants sees a specific mute state for the former.
  *
  * @param testName the name of test (to be logged)
  * @param testee the {@code WebDriver} which represents the Meet conference participant whose mute
  *     state is to be toggled
  * @param testeeName the name of {@code testee} to be displayed should the test fail
  * @param observer the {@code WebDriver} which represents the Meet conference participant to
  *     verify the mute state of {@code testee}
  * @param muted the mute state of {@code testee} expected to be observed by {@code observer}
  */
 private void toggleMuteAndCheck(
     String testName, WebDriver testee, String testeeName, WebDriver observer, boolean muted) {
   System.err.println("Start " + testName + ".");
   MeetUIUtils.clickOnToolbarButton(testee, "toolbar_button_mute");
   MeetUIUtils.assertMuteIconIsDisplayed(
       observer,
       testee,
       muted,
       false, // audio
       testeeName);
   MeetUIUtils.assertMuteIconIsDisplayed(
       testee,
       testee,
       muted,
       false, // audio
       testeeName);
 }
  /**
   * UnMutes once again the second participant and checks in the owner page does this change is
   * reflected.
   */
  public void participantUnMutesAfterOwnerMutedHimAndCheck() {
    System.err.println("Start participantUnMutesAfterOwnerMutedHimAndCheck.");

    TestUtils.waitMillis(1000);

    MeetUIUtils.clickOnToolbarButton(
        ConferenceFixture.getSecondParticipant(), "toolbar_button_mute");

    TestUtils.waitMillis(1000);

    MeetUIUtils.assertMuteIconIsDisplayed(
        ConferenceFixture.getOwner(),
        ConferenceFixture.getSecondParticipant(),
        false, // should be unmuted
        false, // audio
        "participant2");

    // lets give time to the ui to reflect the change in the ui of the owner
    TestUtils.waitMillis(1000);
  }
  /**
   * Closes the participant and leaves the owner alone in the room. Mutes the owner and then joins
   * new participant and checks the status of the mute icon. At the end unmutes to clear the state.
   */
  public void muteOwnerBeforeSecondParticipantJoins() {
    ConferenceFixture.quit(ConferenceFixture.getSecondParticipant());

    // just in case wait
    TestUtils.waits(1000);

    MeetUIUtils.clickOnToolbarButton(ConferenceFixture.getOwner(), "mute");

    ConferenceFixture.startParticipant();

    ConferenceFixture.checkParticipantToJoinRoom(ConferenceFixture.getSecondParticipant(), 10);

    ConferenceFixture.waitsParticipantToJoinConference(ConferenceFixture.getSecondParticipant());

    TestUtils.waitsForElementByXPath(
        ConferenceFixture.getSecondParticipant(),
        "//span[@class='audioMuted']/i[@class='icon-mic-disabled']",
        5);

    // now lets unmute
    unMuteOwnerAndCheck();
  }