package kurs.zadania.adressbook.appmanager;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;

public class NavigationHelper extends HelperBase{

  public NavigationHelper(WebDriver wd) {
    super(wd);
  }

 // public void gotoGroupPage() { click(By.linkText("groups")); }

/* sprawdzanie elementu na stronie i przejście po linku - wariant 1
  public void gotoGroupPage() {
    if (!isElementPresent(By.tagName("h1"))
            || !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            || !isElementPresent(By.name("new"))) {
      click(By.linkText("groups"));
    }
  }
*/
// sprawdzanie elementu na stronie i przejście po linku - wariant 2 lepszy

  public void gotoGroupPage() {
    if (isElementPresent(By.tagName("h1"))
            && !wd.findElement(By.tagName("h1")).getText().equals("Groups")
            && !isElementPresent(By.name("new"))) {
      return;
    }
      click(By.linkText("groups"));
    }

  public void gotoMainPage() {
    if (isElementPresent(By.id("maintable"))) {
      return;
    }
      click(By.linkText("home"));
  }
}

@@ -272,18 +272,16 @@
 ;%0A  %7D%0A%0A 
-//
  public 
@@ -306,803 +306,80 @@
 () %7B
- click(By.linkText(%22groups%22)); %7D%0A%0A/* sprawdzanie elementu na stronie i przej%C5%9Bcie po linku - wariant 1%0A  public void gotoGroupPage() %7B%0A    if (!isElementPresent(By.tagName(%22h1%22))%0A            %7C%7C !wd.findElement(By.tagName(%22h1%22)).getText().equals(%22Groups%22)%0A            %7C%7C !isElementPresent(By.name(%22new%22))) %7B%0A      click(By.linkText(%22groups%22));%0A    %7D%0A  %7D%0A*/%0A// sprawdzanie elementu na stronie i przej%C5%9Bcie po linku - wariant 2 lepszy%0A%0A  public void gotoGroupPage() %7B%0A    if (isElementPresent(By.tagName(%22h1%22))%0A            && !wd.findElement(By.tagName(%22h1%22)).getText().equals(%22Groups%22)%0A            && !isElementPresent(By.name(%22new%22))) %7B%0A      return;%0A    %7D%0A      click(By.linkText(%22groups%22));%0A    %7D%0A%0A  public void gotoMainPage() %7B%0A    if (isElementPresent(By.id(%22maintable%22))) %7B%0A      return;%0A    %7D
+%0A      click(By.linkText(%22groups%22));%0A  %7D%0A%0A  public void gotoMainPage() %7B
 %0A   
@@ -405,18 +405,19 @@
 t(%22home%22));%0A
+%0A
   %7D%0A%7D%0A

Revert "Revert "Revert "optimization of the transition between the pages"""