1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-26 03:08:37 +03:00

Get rid of some custom dependencies

This commit is contained in:
Artyom 2016-11-19 19:43:24 +03:00
parent 72d0b5c81f
commit 8bd2720a8a
4 changed files with 7 additions and 74 deletions

View File

@ -157,7 +157,7 @@ test-suite tests
, tagsoup < 0.14
, text-all < 0.4
, transformers
, webdriver
, webdriver >= 0.8.4 && < 0.9
hs-source-dirs: tests
default-language: Haskell2010
ghc-options: -Wall -fno-warn-unused-do-bind

View File

@ -2,14 +2,6 @@ resolver: lts-6.14
packages:
- location: .
- location:
git: https://github.com/aelve/cmark-sections
commit: 559a992334adb7348072c7cf7d030787a41050ce
extra-dep: true
- location:
git: https://github.com/neongreen/hs-webdriver
commit: 5a6be4720bd7c64d24c2b9d8807cb1377115e6da
extra-dep: true
- location:
git: https://github.com/aelve/stache-plus
commit: a12f7edf9c034a01d5da466b212b3f9c0253b1f4
@ -17,6 +9,7 @@ packages:
extra-deps:
- cmark-highlight-0.2.0.0
- cmark-sections-0.1.0.2
- friendly-time-0.4
- ilist-0.2.0.0
- text-all-0.3.0.1
@ -24,6 +17,7 @@ extra-deps:
- megaparsec-5.0.1
- http-client-0.5.1
- generic-deriving-1.10.7
- webdriver-0.8.4
flags:
generic-deriving:

View File

@ -52,10 +52,6 @@ module Selenium
shouldBeSelected,
shouldBeDisplayed,
expectationFailure,
-- * Keys
_backspace, _enter, _esc,
_shift, _ctrl, _alt, _command,
)
where
@ -78,6 +74,7 @@ import Test.Hspec.WebDriver hiding
import qualified Test.Hspec.WebDriver as WD
import Test.WebDriver.Commands.Wait
import Test.WebDriver.Exceptions
import qualified Test.WebDriver.Common.Keys as Key
import qualified Test.Hspec.Expectations as Hspec
-- Exceptions
import Control.Monad.Catch
@ -124,7 +121,7 @@ enterInput :: CanSelect s => Text -> s -> WD ()
enterInput x s = do
input <- select s
clearInput input
sendKeys (x <> _enter) input
sendKeys (x <> Key.enter) input
checkNotPresent input
setInput :: CanSelect s => Text -> s -> WD ()
@ -452,64 +449,5 @@ shouldBeHidden s = do
x <- isDisplayed e
s `shouldSatisfy` ("be hidden", const (not x))
_backspace, _enter, _esc :: Text
(_backspace, _enter, _esc) = ("\xE003", "\xE007", "\xE00C")
_shift, _ctrl, _alt, _command :: Text
(_shift, _ctrl, _alt, _command) = ("\xE008", "\xE009", "\xE00A", "\xE03D")
wait_delay :: Double
wait_delay = 10
{-
NULL \uE000
CANCEL \uE001
HELP \uE002
TAB \uE004
CLEAR \uE005
RETURN \uE006
PAUSE \uE00B
SPACE \uE00D
PAGE_UP \uE00E
PAGE_DOWN \uE00F
END \uE010
HOME \uE011
ARROW_LEFT \uE012
ARROW_UP \uE013
ARROW_RIGHT \uE014
ARROW_DOWN \uE015
INSERT \uE016
DELETE \uE017
F1 \uE031
F2 \uE032
F3 \uE033
F4 \uE034
F5 \uE035
F6 \uE036
F7 \uE037
F8 \uE038
F9 \uE039
F10 \uE03A
F11 \uE03B
F12 \uE03C
META \uE03D
ZENKAKU_HANKAKU \uE040
SEMICOLON \uE018
EQUALS \uE019
NUMPAD0 \uE01A
NUMPAD1 \uE01B
NUMPAD2 \uE01C
NUMPAD3 \uE01D
NUMPAD4 \uE01E
NUMPAD5 \uE01F
NUMPAD6 \uE020
NUMPAD7 \uE021
NUMPAD8 \uE022
NUMPAD9 \uE023
MULTIPLY \uE024
ADD \uE025
SEPARATOR \uE026
SUBTRACT \uE027
DECIMAL \uE028
DIVIDE \uE029
-}

View File

@ -25,6 +25,7 @@ import Control.Monad.Catch
-- Testing
import Selenium
import qualified Test.WebDriver.Common.Keys as Key
-- Site
import qualified Guide
@ -498,7 +499,7 @@ createItem :: Text -> WD Element
createItem t = do
let selectItems = selectAll ".item"
items <- selectItems
sendKeys (t <> _enter) ".add-item"
sendKeys (t <> Key.enter) ".add-item"
waitUntil wait_delay (expect . (\xs -> length xs > length items) =<< selectItems)
items2 <- selectItems
case items2 \\ items of