From f2e00d16ee207386d5e87ce1ddf7cddab0988ad7 Mon Sep 17 00:00:00 2001 From: Kevin Ormbrek Date: Sat, 4 Oct 2014 22:39:00 -0500 Subject: [PATCH 1/2] change extension --- test/acceptance/keywords/{cookies.txt => cookies.robot} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename test/acceptance/keywords/{cookies.txt => cookies.robot} (100%) diff --git a/test/acceptance/keywords/cookies.txt b/test/acceptance/keywords/cookies.robot similarity index 100% rename from test/acceptance/keywords/cookies.txt rename to test/acceptance/keywords/cookies.robot From 89c8eb7e1aa7327b240d34aeced77054ac720aca Mon Sep 17 00:00:00 2001 From: Kevin Ormbrek Date: Sat, 4 Oct 2014 22:44:07 -0500 Subject: [PATCH 2/2] Stop using private browsing --- .../resources/firefoxprofile/prefs.js | 1 - test/acceptance/keywords/cookies.robot | 51 ++++++++++++------- test/resources/html/cookies.html | 38 ++++++++++++++ test/resources/testserver/testserver.py | 2 - 4 files changed, 71 insertions(+), 21 deletions(-) create mode 100644 test/resources/html/cookies.html diff --git a/src/Selenium2Library/resources/firefoxprofile/prefs.js b/src/Selenium2Library/resources/firefoxprofile/prefs.js index 3cd67d9d2..44dfbd55b 100644 --- a/src/Selenium2Library/resources/firefoxprofile/prefs.js +++ b/src/Selenium2Library/resources/firefoxprofile/prefs.js @@ -18,7 +18,6 @@ user_pref("browser.migration.version", 1); user_pref("browser.places.importBookmarksHTML", false); user_pref("browser.places.smartBookmarksVersion", 2); user_pref("browser.preferences.advanced.selectedTabIndex", 3); -user_pref("browser.privatebrowsing.autostart", true); user_pref("browser.safebrowsing.enabled", false); user_pref("browser.safebrowsing.malware.enabled", false); user_pref("browser.search.update", false); diff --git a/test/acceptance/keywords/cookies.robot b/test/acceptance/keywords/cookies.robot index 9468b7f93..c205528e5 100644 --- a/test/acceptance/keywords/cookies.robot +++ b/test/acceptance/keywords/cookies.robot @@ -1,28 +1,43 @@ -*Setting* -Resource ../resource.txt -Suite Setup Run Keywords Add Cookies Go To Page "index.html" -Suite Teardown Delete All Cookies +*** Setting *** +Suite Setup Go To Page "cookies.html" +Suite Teardown Delete All Cookies +Test Setup Add Cookies +Resource ../resource.txt +*** Test Cases *** +Get Cookies + ${cookies}= Get Cookies + Should Match Regexp ${cookies} ^(test=seleniumlibrary; another=value)|(another=value; test=seleniumlibrary)$ -*Test Cases* +Get Cookie Value Set By Selenium + ${value}= Get Cookie Value another + Should Be Equal ${value} value -Get Cookies - ${cookies} = Get Cookies - Should Be Equal ${cookies} test=seleniumlibrary; another=value +Get Cookie Value Set By App + Click Link Add cookie + ${cookie}= Get Cookie Value spam + Should Be Equal ${cookie} eggs -Get Cookie Value - ${value} = Get Cookie Value another - Should Be Equal ${value} value +App Sees Cookie Set By Selenium + Add Cookie setbyselenium true + Click Link Check cookie + Element Text Should Be output Cookie found with value 'true'! Delete Cookie - Delete Cookie test - ${cookies} = Get Cookies - Should Be Equal ${cookies} another=value + Delete Cookie test + ${cookies} = Get Cookies + Should Be Equal ${cookies} another=value -*Keyword* +Non-existent Cookie + Run Keyword And Expect Error ValueError: Cookie with name missing not found. Get Cookie Value missing -Add Cookies +Get Cookies When There Are None Delete All Cookies - Add Cookie test seleniumlibrary - Add Cookie another value + ${cookies}= Get Cookies + Should Be Equal ${cookies} ${EMPTY} +*** Keyword *** +Add Cookies + Delete All Cookies + Add Cookie test seleniumlibrary + Add Cookie another value diff --git a/test/resources/html/cookies.html b/test/resources/html/cookies.html new file mode 100644 index 000000000..b7637e29a --- /dev/null +++ b/test/resources/html/cookies.html @@ -0,0 +1,38 @@ + + + (root)/index.html + + + + Add cookie
+ Check cookie
+
Click Check cookie to check
+ + diff --git a/test/resources/testserver/testserver.py b/test/resources/testserver/testserver.py index f476946d9..3d33a24ca 100644 --- a/test/resources/testserver/testserver.py +++ b/test/resources/testserver/testserver.py @@ -65,8 +65,6 @@ def send_head(self): fs = os.fstat(f.fileno()) self.send_header("Content-Length", str(fs[6])) self.send_header("Last-Modified", self.date_time_string(fs.st_mtime)) - self.send_header("Set-Cookie", "test=seleniumlibrary;") - self.send_header("Set-Cookie", "another=value;") self.end_headers() return f