package Tests.GlookoLogbook;

import Tests.AbstractBaseTests.TestBase;
import Util.Helpers;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import static Util.Helpers.*;

/**
 * Created by glookogeorge on 3/30/16.
 */
public class SignUpTests extends TestBase {

    @Override
    public String getName() {
        return "SignUp";
    }

    /**
     * Sets up the alert view page
     */
    @BeforeTest
    @Override
    public void setUpPage() {}

    @Test
    public void signup1() throws Exception {
        wait(for_radiobutton("QA"));
        element(for_radiobutton("QA")).click();
        wait(for_button("OK"));
        element(for_button("OK")).click();
        wait(for_id("com.glooko.logbook:id/sign_up"));
        element(for_id("com.glooko.logbook:id/sign_up")).click();
        wait(for_id("com.glooko.logbook:id/firstname_field"));
        element(for_id("com.glooko.logbook:id/firstname_field")).sendKeys("TestFirstName");
        element(for_id("com.glooko.logbook:id/lastname_field")).sendKeys("TestLastName");
        String email = generateEmail();
        element(for_id("com.glooko.logbook:id/username_field")).sendKeys(email);
        element(for_id("com.glooko.logbook:id/sign_up_button")).click();
        wait(for_text_exact("Are you compatible with Glooko?"));
    }

    /** wait wraps Helpers.wait **/
    public static WebElement wait(By locator) {
        return Helpers.wait(locator);
    }
}

@@ -566,20 +566,23 @@
  public 
-void
+boolean
  signup1
@@ -603,16 +603,65 @@
 ption %7B%0A
+        boolean passed = true;%0A        try %7B%0A    
         
@@ -689,32 +689,36 @@
 %22QA%22));%0A        
+    
 element(for_radi
@@ -733,32 +733,36 @@
 %22QA%22)).click();%0A
+    
         wait(for
@@ -777,32 +777,36 @@
 %22OK%22));%0A        
+    
 element(for_butt
@@ -824,32 +824,36 @@
 lick();%0A        
+   
+ 
 wait(for_id(%22com
@@ -879,24 +879,28 @@
 sign_up%22));%0A
+    
         elem
@@ -953,32 +953,36 @@
 lick();%0A        
+  
+  
 wait(for_id(%22com
@@ -1016,24 +1016,28 @@
 e_field%22));%0A
+    
         elem
@@ -1116,32 +1116,36 @@
 Name%22);%0A        
+ 
+   
 element(for_id(%22
@@ -1202,32 +1202,36 @@
 TestLastName%22);%0A
+    
         String e
@@ -1254,32 +1254,36 @@
 mail();%0A        
+    
 element(for_id(%22
@@ -1339,32 +1339,36 @@
 email);%0A        
+   
+ 
 element(for_id(%22
@@ -1416,32 +1416,36 @@
 lick();%0A        
+    
 wait(for_text_ex
@@ -1481,24 +1481,148 @@
 Glooko?%22));%0A
+        %7D catch (Exception e) %7B%0A            passed = false;%0A        %7D%0A        assert passed == true;%0A        return passed;%0A
     %7D%0A%0A    /

test now returning boolean, screen shot next