package com.frameworkium.integration.github.pages.web.components;

import com.frameworkium.core.ui.annotations.Visible;
import com.frameworkium.core.ui.pages.PageFactory;
import com.frameworkium.core.ui.pages.Visibility;
import com.frameworkium.core.ui.tests.BaseTest;
import com.frameworkium.integration.github.pages.web.*;
import org.openqa.selenium.*;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.Wait;
import ru.yandex.qatools.allure.annotations.Step;
import ru.yandex.qatools.htmlelements.annotations.Name;
import ru.yandex.qatools.htmlelements.element.*;

import static org.openqa.selenium.support.ui.ExpectedConditions.visibilityOf;

@Name("Github Header")
@FindBy(css = "header")
public class HeaderComponent extends HtmlElement {

    @Visible
    @Name("Home Logo/Link")
    @FindBy(css = "a.header-logo-invertocat")
    private Link homeLink;

    @Name("Search Box")
    @FindBy(name = "q")
    private TextInput searchBox;

    @Visible
    @Name("Explore Link")
    @FindBy(css = "header nav a.nav-item-explore")
    private Link exploreLink;

    @Step("Go to the explore page")
    public ExplorePage clickExplore() {
        exploreLink.click();
        return PageFactory.newInstance(ExplorePage.class);
    }

    @Step("Search for the text '{0}'")
    public SearchResultsPage search(String searchText) {
        searchBox.sendKeys(searchText + Keys.ENTER);
        return PageFactory.newInstance(SearchResultsPage.class);
    }

    @Step("Testing Visibility.forceVisible()")
    public void testForceVisible() {
        Wait<WebDriver> wait = BaseTest.newDefaultWait();

        WebElement link = homeLink.getWrappedElement();
        // hide the home link
        BaseTest.getDriver().executeScript("arguments[0].style.visibility='hidden';", link);
        wait.until(ExpectedConditions.not(visibilityOf(link)));
        // test force visible works
        new Visibility().forceVisible(link);
        wait.until(visibilityOf(link));
    }
}

@@ -319,39 +319,201 @@
 web.
-*;%0Aimport org.openqa.selenium.*
+ExplorePage;%0Aimport com.frameworkium.integration.github.pages.web.SearchResultsPage;%0Aimport org.openqa.selenium.Keys;%0Aimport org.openqa.selenium.WebDriver;%0Aimport org.openqa.selenium.WebElement
 ;%0Aim
@@ -811,9 +811,182 @@
 ent.
-*
+Button;%0Aimport ru.yandex.qatools.htmlelements.element.HtmlElement;%0Aimport ru.yandex.qatools.htmlelements.element.Link;%0Aimport ru.yandex.qatools.htmlelements.element.TextInput
 ;%0A%0Ai
@@ -1360,31 +1360,121 @@
 hBox;%0A%0A    @
-Visible
+Name(%22Hamburger button%22)%0A    @FindBy(className = %22btn-link%22)%0A    private Button hamburgerButton;%0A
 %0A    @Name(%22
@@ -1511,37 +1511,30 @@
  = %22
-header nav a.nav-item-
+nav a%5Bhref='/
 explore
+'%5D
 %22)%0A 
@@ -1635,24 +1635,104 @@
 Explore() %7B%0A
+        if (hamburgerButton.isDisplayed())%0A            hamburgerButton.click();%0A
         expl

Fix ComponentExampleTest