[java-idp-integration-tests COMMIT] /trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java

noreply at shibboleth.net noreply at shibboleth.net
Mon Jun 1 16:48:58 EDT 2015


Author: tzeller
Date: Mon Jun  1 16:48:58 2015
New Revision: 62

URL: http://svn.shibboleth.net/view/java-idp-integration-tests?rev=62&view=rev
Log:
IDP-594 Some work on the local storage read flow, make the item key a variable.

Modified:
    trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java

Modified: trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java
URL: http://svn.shibboleth.net/view/java-idp-integration-tests/trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java?rev=62&r1=61&r2=62&view=diff
==============================================================================
--- trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java	(original)
+++ trunk/src/test/java/net/shibboleth/idp/test/localstorage/LocalStorageTest.java	Mon Jun  1 16:48:58 2015
@@ -18,13 +18,19 @@
 package net.shibboleth.idp.test.localstorage;
 
 import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.List;
 
 import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
 
 import net.shibboleth.idp.test.BaseIntegrationTest;
+import net.shibboleth.utilities.java.support.collection.Pair;
+import net.shibboleth.utilities.java.support.net.URLBuilder;
 
 import org.openqa.selenium.By;
 import org.openqa.selenium.WebDriver;
+import org.openqa.selenium.htmlunit.HtmlUnitDriver;
 import org.openqa.selenium.support.ui.ExpectedCondition;
 import org.openqa.selenium.support.ui.WebDriverWait;
 import org.slf4j.Logger;
@@ -41,11 +47,32 @@
     /** Title of local storage test view page. */
     public final static String LOCAL_STORAGE_TEST_VIEW_PAGE_TITLE = "Local Storage Test View";
 
+    /** Local storage exception identifier. */
+    @Nonnull public final static String LOCAL_STORAGE_EXCEPTION_ID = "localStorageException";
+
+    /** Local storage item key identifier. */
+    @Nonnull public final static String LOCAL_STORAGE_KEY_ID = "localStorageKey";
+
+    /** Local storage success identifier. */
+    @Nonnull public final static String LOCAL_STORAGE_SUCCESS_ID = "localStorageSuccess";
+
+    /** Local storage support identifier. */
+    @Nonnull public final static String LOCAL_STORAGE_SUPPORTED_ID = "localStorageSupported";
+
+    /** Local storage item value identifier. */
+    @Nonnull public final static String LOCAL_STORAGE_VALUE_ID = "localStorageValue";
+
+    /** Local storage version identifier. */
+    @Nonnull public final static String LOCAL_STORAGE_VERSION_ID = "localStorageVersion";
+
     /** Class logger. */
     @Nonnull private final Logger log = LoggerFactory.getLogger(LocalStorageTest.class);
 
-    /** Key used to retrieve serialized storage service from local storage. */
-    @Nonnull protected String key = "shib_idp_ls";
+    /** Test local storage item key. */
+    @Nonnull protected String testKey = "shib_idp_ls_test_key";
+
+    /** Test local storage item value. */
+    @Nonnull protected String testValue = "shib_idp_ls_test_key_value";
 
     /** URL of test flow to read from local storage. */
     @Nonnull protected String readURL = BASE_URL + "/idp/profile/test/local-storage/read";
@@ -81,51 +108,160 @@
         });
     }
 
+    /**
+     * Get the local storage exception from the test page.
+     * 
+     * @return the local storage exception
+     */
+    protected String getLocalStorageException() {
+        return driver.findElement(By.id(LOCAL_STORAGE_EXCEPTION_ID)).getText();
+    }
+
+    /**
+     * Get the local storage key from the test page.
+     * 
+     * @return the local storage key
+     */
+    protected String getLocalStorageKey() {
+        return driver.findElement(By.id(LOCAL_STORAGE_KEY_ID)).getText();
+    }
+
+    /**
+     * Get whether the attempt to read or write local storage was successful.
+     * 
+     * @return whether the attempt to read or write local storage was successful
+     */
+    protected String getLocalStorageSuccess() {
+        return driver.findElement(By.id(LOCAL_STORAGE_SUCCESS_ID)).getText();
+    }
+
+    /**
+     * Get whether local storage is supported from the test page.
+     * 
+     * @return whether local storage is supported
+     */
+    protected String getLocalStorageSupported() {
+        return driver.findElement(By.id(LOCAL_STORAGE_SUPPORTED_ID)).getText();
+    }
+
+    /**
+     * Get the local storage value from the test page via the test flow.
+     * 
+     * @return the local storage value via the test flow
+     */
+    protected String getLocalStorageValue() {
+        return driver.findElement(By.id(LOCAL_STORAGE_VALUE_ID)).getText();
+    }
+
+    /**
+     * Get the local storage value by executing JavaScript on the test page.
+     * 
+     * @return the local storage value via JavaScript
+     */
+    protected String getLocalStorageValueViaGetItem() {
+        return driver.findElement(By.id("localStorageGetItem")).getText();
+    }
+
+    /**
+     * Get the local storage value from the client directly by executing JavaScript.
+     * 
+     * @param key local storage item key

[... 129 lines stripped ...]


More information about the commits mailing list