From 14d61485a06060e3c617e052fb31955c2bc49a35 Mon Sep 17 00:00:00 2001 From: Artyom Date: Tue, 30 Aug 2016 18:06:06 +0300 Subject: [PATCH] [tests] Deleting a category --- tests/WebSpec.hs | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/tests/WebSpec.hs b/tests/WebSpec.hs index d4efd84..c1b76cd 100644 --- a/tests/WebSpec.hs +++ b/tests/WebSpec.hs @@ -222,9 +222,27 @@ categoryTests = session "categories" $ using Firefox $ do click =<< select (form :// ".save") waitUntil 2 $ expect =<< allM isDisplayed =<< selectAll ".item-ecosystem" - -- Save works - -- Cancel works - -- Deleting a category works + describe "deleting a category" $ do + wd "dismissing the alert doesn't do anything" $ do + click =<< select (".category h2" :// ByLinkText "delete") + dismissAlert + catURL <- getCurrentURL + openGuidePage "/" + e <- select (ByLinkText "Cat 2") + changesURL $ click e + do u <- getCurrentURL + u `shouldBe` catURL + wd "accepting the alert deletes the category" $ do + catURL <- getCurrentURL + changesURL $ do + click =<< select (".category h2" :// ByLinkText "delete") + acceptAlert + url <- getCurrentRelativeURL + uriPath url `shouldBe` "/haskell" + checkNotPresent (ByLinkText "Cat 2") + openPage catURL + body <- select "body" + body `shouldHaveText` "Something went wrong" -- Feed button works -- Description editing works