From e4875401a04c9c0de1cfda32d24525be3cecbe4e Mon Sep 17 00:00:00 2001 From: James Fellows Date: Thu, 26 Feb 2015 22:14:01 +0000 Subject: [PATCH 1/5] Add automatic soft isolation to Session docs Includes reference to Selenium limitation which results in cookies bleeding between multi-domain scenarios. --- guides/session.rst | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/guides/session.rst b/guides/session.rst index 24893dd..f9ee573 100644 --- a/guides/session.rst +++ b/guides/session.rst @@ -183,10 +183,16 @@ Resetting the Session --------------------- The primary aim for Mink is to provide a single consistent web browsing API -for acceptance tests. But a very important part in testing is isolation. - -Mink provides two very useful methods to isolate tests, which can be used -in your test's ``teardown`` methods: +for acceptance tests. But a very important part in testing is isolation. +Mink tries to automatically "soft" isolate Scenarios from each other without +slowing-down test runs with a full driver restart, but in some cases this is not +possible: + * Selenium will not allow cookies to be cleared from anything other than + the current domain - so a scenario that runs across different domains (for + example PayPal's sandbox) cannot be automatically isolated. + +So Mink provides two very useful methods to isolate tests, which can be used +in your tests' ``teardown`` methods: .. code-block:: php From 5b071bec1f2012c6efcd7ecb4a872afdda9cfca8 Mon Sep 17 00:00:00 2001 From: James Fellows Date: Tue, 3 Mar 2015 14:59:19 +0000 Subject: [PATCH 2/5] Update session.rst Remove invalid indentation and reference to Scenarios --- guides/session.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guides/session.rst b/guides/session.rst index f9ee573..0cbb9fe 100644 --- a/guides/session.rst +++ b/guides/session.rst @@ -184,12 +184,12 @@ Resetting the Session The primary aim for Mink is to provide a single consistent web browsing API for acceptance tests. But a very important part in testing is isolation. -Mink tries to automatically "soft" isolate Scenarios from each other without +Mink tries to automatically "soft" isolate tests from each other without slowing-down test runs with a full driver restart, but in some cases this is not possible: - * Selenium will not allow cookies to be cleared from anything other than - the current domain - so a scenario that runs across different domains (for - example PayPal's sandbox) cannot be automatically isolated. +* Selenium will not allow cookies to be cleared from anything other than + the current domain - so a test that runs across different domains (for + example PayPal's sandbox) cannot be automatically isolated. So Mink provides two very useful methods to isolate tests, which can be used in your tests' ``teardown`` methods: From 3de795349d62b690cd0fe07fe075f47af4ba59a4 Mon Sep 17 00:00:00 2001 From: James Fellows Date: Tue, 3 Mar 2015 15:06:08 +0000 Subject: [PATCH 3/5] Update session.rst --- guides/session.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/guides/session.rst b/guides/session.rst index 0cbb9fe..21bef13 100644 --- a/guides/session.rst +++ b/guides/session.rst @@ -187,6 +187,7 @@ for acceptance tests. But a very important part in testing is isolation. Mink tries to automatically "soft" isolate tests from each other without slowing-down test runs with a full driver restart, but in some cases this is not possible: + * Selenium will not allow cookies to be cleared from anything other than the current domain - so a test that runs across different domains (for example PayPal's sandbox) cannot be automatically isolated. From a8d5e1279c9a13b9a3318ff0d9a735c63a9077f5 Mon Sep 17 00:00:00 2001 From: James Fellows Date: Tue, 3 Mar 2015 20:30:05 +0000 Subject: [PATCH 4/5] Clarify session::reset limitation --- guides/session.rst | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/guides/session.rst b/guides/session.rst index 21bef13..b79b501 100644 --- a/guides/session.rst +++ b/guides/session.rst @@ -184,13 +184,6 @@ Resetting the Session The primary aim for Mink is to provide a single consistent web browsing API for acceptance tests. But a very important part in testing is isolation. -Mink tries to automatically "soft" isolate tests from each other without -slowing-down test runs with a full driver restart, but in some cases this is not -possible: - -* Selenium will not allow cookies to be cleared from anything other than - the current domain - so a test that runs across different domains (for - example PayPal's sandbox) cannot be automatically isolated. So Mink provides two very useful methods to isolate tests, which can be used in your tests' ``teardown`` methods: @@ -211,10 +204,16 @@ need to start the session before any other action. The ``Session::restart`` shortcut allows you to do these 2 steps in a single call. The drawback of closing the browser and starting it again is that it takes -time. In many cases, a lower level of isolation is enough in favor of a faster -resetting. The ``Session::reset`` method covers this use case. It will try -to clear the cookies and reset the request headers and the browser history -to the limit of the driver possibilities. +time. In many cases, a shallower level of isolation is enough in favor of a +faster resetting. The ``Session::reset`` method covers this use case. It +will try to clear the cookies, reset the request headers and clear the +browser history - though there are some driver limitations that mean this +isn't always effective. For example: + + * Selenium will not allow cookies to be cleared from anything other than + the current domain. So a test that runs across different domains (for + example your site and PayPal's sandbox) cannot be properly isolated using + ``Session::reset()``. Taking all this into account, it is recommended to use ``Session::reset()`` by default and to call ``Session::stop()`` when you need really full isolation. From b590dd3cb9009d898d3923ff76a7847f777d1680 Mon Sep 17 00:00:00 2001 From: James Fellows Date: Tue, 3 Mar 2015 20:37:49 +0000 Subject: [PATCH 5/5] Update session.rst --- guides/session.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guides/session.rst b/guides/session.rst index b79b501..68a1d5d 100644 --- a/guides/session.rst +++ b/guides/session.rst @@ -210,7 +210,7 @@ will try to clear the cookies, reset the request headers and clear the browser history - though there are some driver limitations that mean this isn't always effective. For example: - * Selenium will not allow cookies to be cleared from anything other than +* Selenium will not allow cookies to be cleared from anything other than the current domain. So a test that runs across different domains (for example your site and PayPal's sandbox) cannot be properly isolated using ``Session::reset()``.