 
 
   test "should get cookies on page" do
-    navigate_to "http://localhost:9090/page1.html"
-    set_cookie(%{name: "example", value: "12v3q4rsdv"})
+    navigate_to "http://#{@domain}/page1.html"
+    safe_set_cookie(%{name: "example", value: "12v3q4rsdv"})
 
     assert length(cookies()) >= 1
   end
 
 
   test "should delete a cookie" do
-    navigate_to "http://localhost:9090/page1.html"
+    navigate_to "http://#{@domain}/page1.html"
     cart_id = "12v3q4rsdv"
-    set_cookie(%{name: "cart_id", value: cart_id})
-    set_cookie(%{name: "cart_status", value: "active"})
+    safe_set_cookie(%{name: "cart_id", value: cart_id})
+    safe_set_cookie(%{name: "cart_status", value: "active"})
 
 
     assert length(cookies()) >= 2



  test "should delete all cookies" do
    navigate_to "http://localhost:9090/page1.html"
    cart_id = "12v3q4rsdv"
    set_cookie(%{name: "cart_id", value: cart_id})
    set_cookie(%{name: "cart_status", value: "active"})

    assert length(cookies()) >= 2
    delete_cookies()
    assert length(cookies()) >= 0
  end
end



  test "should set a cookie" do
    navigate_to "http://#{@domain}/page1.html"
    cart_id = "12v3q4rsdv"
    safe_set_cookie(%{name: "cart_id", value: cart_id})
    valid_cookie = Enum.find(cookies(), fn(cookie)-> cookie["name"]=="cart_id" end)

    assert valid_cookie["value"] == cart_id
