           (wd/current-url) => (contains "stonecutter-client.herokuapp.com/voting")
           (wd/page-source) => (contains "stonecutter-journey-test@tw.com"))
 
-    (fact "logging out in client app and logging in again will skip sign in page (repeats twice as there was a bug)"
-          (logout-of-client-and-go-through-auth-flow-again-without-having-to-sign-in-again)
+    (fact "logging out in client app and logging in again will skip sign in page
+          and authorise page (repeats twice as there was a bug)"
+          (logout-of-client-and-go-through-auth-flow-again-without-having-to-sign-in-or-authorise-app-again)
           (wd/current-url) => (contains "stonecutter-client.herokuapp.com/voting")
           (wd/page-source) => (contains "stonecutter-journey-test@tw.com")
 
-          (logout-of-client-and-go-through-auth-flow-again-without-having-to-sign-in-again)
+          (logout-of-client-and-go-through-auth-flow-again-without-having-to-sign-in-or-authorise-app-again)
+          (wd/current-url) => (contains "stonecutter-client.herokuapp.com/voting")
+          (wd/page-source) => (contains "stonecutter-journey-test@tw.com"))
+
+    (fact "can unshare profile card and then logging in to client app will require authorising the app again"
+          ;; unshare profile card
+          (wd/to "https://stonecutter.herokuapp.com/profile")
+          (wait-for-selector stonecutter-profile-page-body)
+          (screenshot "stonecutter_profile_with_client_app")
+          (wd/click stonecutter-profile-unshare-profile-card-link)
+          (wait-for-selector stonecutter-unshare-profile-card-page-body)
+          (screenshot "stonecutter_unshare_profile_card")
+          (wd/click stonecutter-unshare-profile-card-button)
+          (wait-for-selector stonecutter-profile-page-body)
+          (screenshot "stonecutter_profile_without_client_app")
+
+          ;; login to client app
+          (wd/to "https://stonecutter-client.herokuapp.com")
+          (logout-of-client-and-click-sign-in-to-vote)
+          (wait-for-selector stonecutter-authorise-page-body)
+          (screenshot "stonecutter_authorisation_form_again")
+          (wd/current-url) => (contains "stonecutter.herokuapp.com/authorisation")
+
+          ;; authorise client app
+          (wd/click stonecutter-authorise-share-profile-button)
+          (wait-for-selector client-poll-page-body)
+          (screenshot "client_voting_page_again")
           (wd/current-url) => (contains "stonecutter-client.herokuapp.com/voting")
           (wd/page-source) => (contains "stonecutter-journey-test@tw.com"))
 

    (go-to-delete-account)
    (confirm-delete-account)))

(defn logout-of-client-and-go-through-auth-flow-again-without-having-to-sign-in-again []
  (wd/click client-logout-link)
  (wait-for-selector client-home-page-body)
  (wd/click "button")
  (wait-for-selector stonecutter-authorise-page-body)
  (wd/click stonecutter-authorise-share-profile-button)
  (wait-for-selector client-poll-page-body))

(against-background


    (fact "can continue to authorise app even when registering a new account"
          (wd/to "https://stonecutter-client.herokuapp.com")
          (logout-of-client-and-click-sign-in-to-vote)
          (wait-for-selector stonecutter-sign-in-page-body)
          (wd/click stonecutter-sign-in-page-register-link)
          (wait-for-selector stonecutter-register-page-body)
