Skip to content
This repository has been archived by the owner on Jan 17, 2020. It is now read-only.

Commit

Permalink
Update dependencies, use chromedriver, enable tests (#46)
Browse files Browse the repository at this point in the history
* Update dependencies, use chromedriver, enable tests

* Fix warnings

* Revise travis script for Chrome setup

* Raise lower bound on chromedriver version
  • Loading branch information
garyb authored Aug 1, 2016
1 parent be00df3 commit a56a8a7
Show file tree
Hide file tree
Showing 19 changed files with 231 additions and 195 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,3 @@
/bower_components/
/node_modules/
/output/
/example/node_modules/
phantomjsdriver.log
25 changes: 16 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
language: node_js
dist: trusty
sudo: required
node_js: 5
node_js: 6
before_install:
- export CHROME_BIN=/usr/bin/google-chrome
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
- sudo apt-get update
- sudo apt-get install -y libappindicator1 fonts-liberation
- wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
- sudo dpkg -i google-chrome*.deb
install:
- npm install
- npm install -g bower
- bower install
- npm install
script:
- npm run build
- bower install --production
- npm run -s build
- bower install
- npm -s test
after_success:
- >-
test $TRAVIS_TAG &&
node_modules/.bin/psc-publish > .pursuit.json &&
curl -X POST http://pursuit.purescript.org/packages \
-d @.pursuit.json \
-H 'Accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}"
echo $GITHUB_TOKEN | pulp login &&
echo y | pulp publish --no-push
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
],
"license": "Apache-2.0",
"dependencies": {
"purescript-aff": "^1.0.0",
"purescript-aff": "^1.1.0",
"purescript-aff-reattempt": "^1.0.0",
"purescript-base": "^1.0.0",
"purescript-dom": "^1.1.0"
"purescript-dom": "^2.0.0"
}
}
1 change: 0 additions & 1 deletion example/index.js

This file was deleted.

14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build",
"bower": "bower"
"build": "pulp build --censor-lib --strict",
"test": "pulp test"
},
"dependencies": {
"chromedriver": "^2.22.0",
"selenium-webdriver": "2.53.2"
},
"devDependencies": {
"pulp": "^9.0.1",
"purescript": "^0.9.1",
"rimraf": "^2.5.3",
"bower": "^1.7.1"
"purescript-psa": "^0.3.9",
"purescript": "^0.9.2",
"rimraf": "^2.5.4"
}
}
2 changes: 2 additions & 0 deletions src/Selenium.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// module Selenium

require("chromedriver");

var webdriver = require("selenium-webdriver"),
By = webdriver.By,
fs = require("fs"),
Expand Down
112 changes: 57 additions & 55 deletions src/Selenium.purs
Original file line number Diff line number Diff line change
@@ -1,67 +1,69 @@
module Selenium
( get
, wait
, quit
, byClassName
, byCss
, byId
, byName
, byXPath
, affLocator
, findElement
, loseElement
, findElements
, findChild
, findChildren
, findExact
, showLocator
, childExact
, navigateBack
, navigateForward
, refresh
, navigateTo
, getCurrentUrl
, executeStr
, sendKeysEl
, clickEl
, getCssValue
, getAttribute
, getText
, getTitle
, isDisplayed
, isEnabled
, getInnerHtml
, getSize
, getLocation
, clearEl
, setFileDetector
, takeScreenshot
, saveScreenshot
, setWindowSize
, getWindowSize
, maximizeWindow
, setWindowPosition
, getWindowPosition
, getWindow
, getWindowScroll
, getWindowHandle
, getAllWindowHandles
, switchTo
, close
) where
( get
, wait
, quit
, byClassName
, byCss
, byId
, byName
, byXPath
, affLocator
, findElement
, loseElement
, findElements
, findChild
, findChildren
, findExact
, showLocator
, childExact
, navigateBack
, navigateForward
, refresh
, navigateTo
, getCurrentUrl
, executeStr
, sendKeysEl
, clickEl
, getCssValue
, getAttribute
, getText
, getTitle
, isDisplayed
, isEnabled
, getInnerHtml
, getSize
, getLocation
, clearEl
, setFileDetector
, takeScreenshot
, saveScreenshot
, setWindowSize
, getWindowSize
, maximizeWindow
, setWindowPosition
, getWindowPosition
, getWindow
, getWindowScroll
, getWindowHandle
, getAllWindowHandles
, switchTo
, close
) where

import Prelude

import Control.Monad.Aff (Aff(), attempt)
import Control.Monad.Eff.Exception (error)
import Control.Monad.Error.Class (throwError)
import Data.Maybe (Maybe())

import Data.Array (uncons)
import Data.Either (either)
import Control.Monad.Aff (Aff(), attempt)
import Selenium.Types
import Data.Unfoldable (class Unfoldable, unfoldr)
import Data.Foreign (Foreign())
import Data.Maybe (Maybe(..))
import Data.Array (uncons)
import Data.Tuple (Tuple(..))
import Data.Unfoldable (class Unfoldable, unfoldr)

import Selenium.Types (SELENIUM, Driver, WindowHandle, Location, Window, Size, Element, FileDetector, Locator)

-- | Go to url
foreign import get :: forall e. Driver -> String -> Aff (selenium :: SELENIUM|e) Unit
Expand Down
47 changes: 25 additions & 22 deletions src/Selenium/ActionSequence.purs
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
-- | DSL for building action sequences
module Selenium.ActionSequence
( sequence
, keyUp
, keyDown
, mouseToLocation
, dndToElement
, dndToLocation
, sendKeys
, mouseUp
, mouseDown
, hover
, doubleClick
, leftClick
, click
, Sequence()
) where
( sequence
, keyUp
, keyDown
, mouseToLocation
, dndToElement
, dndToLocation
, sendKeys
, mouseUp
, mouseDown
, hover
, doubleClick
, leftClick
, click
, Sequence
) where

import Prelude
import Selenium.Types
import Selenium.MouseButton
import Data.List
import Data.Function.Uncurried
import Data.Foldable (foldl)
import Control.Monad.Writer (Writer(), execWriter)

import Control.Monad.Aff (Aff)
import Control.Monad.Writer (Writer, execWriter)
import Control.Monad.Writer.Class (tell)
import Control.Monad.Aff (Aff())

import Data.Foldable (foldl)
import Data.Function.Uncurried (Fn3, Fn2, runFn3, runFn2)
import Data.List (List, singleton)

import Selenium.MouseButton (leftButton)
import Selenium.Types (ActionSequence, Location, Element, ControlKey, MouseButton, SELENIUM, Driver)

data Command
= Click MouseButton Element
Expand Down
21 changes: 11 additions & 10 deletions src/Selenium/Browser.purs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
module Selenium.Browser
( Browser(..)
, browser2str
, str2browser
, browserCapabilities
, versionCapabilities
, platformCapabilities
) where
( Browser(..)
, browser2str
, str2browser
, browserCapabilities
, versionCapabilities
, platformCapabilities
) where

import Prelude
import Data.Maybe
import Selenium.Capabilities

import Data.Maybe (Maybe(..))

import Selenium.Capabilities (Capabilities)

data Browser
= PhantomJS
Expand All @@ -19,7 +21,6 @@ data Browser
| Opera
| Safari


browser2str :: Browser -> String
browser2str PhantomJS = "phantomjs"
browser2str Chrome = "chrome"
Expand Down
39 changes: 21 additions & 18 deletions src/Selenium/Builder.purs
Original file line number Diff line number Diff line change
@@ -1,25 +1,28 @@
module Selenium.Builder
( build
, browser
, version
, platform
, usingServer
, scrollBehaviour
, withCapabilities
, Build()
) where
( build
, browser
, version
, platform
, usingServer
, scrollBehaviour
, withCapabilities
, Build
) where

import Prelude
import Selenium.Types
import Selenium.Browser
import Data.Tuple
import Data.List
import Data.Function.Uncurried
import Data.Foldable (foldl)
import Control.Monad.Writer (Writer(), execWriter)

import Control.Monad.Aff (Aff)
import Control.Monad.Writer (Writer, execWriter)
import Control.Monad.Writer.Class (tell)
import Control.Monad.Aff (Aff())
import Selenium.Capabilities

import Data.Foldable (foldl)
import Data.Function.Uncurried (Fn2, runFn2)
import Data.List (List(..), singleton)
import Data.Tuple (Tuple(..))

import Selenium.Browser (Browser, browserCapabilities, platformCapabilities, versionCapabilities)
import Selenium.Capabilities (Capabilities, emptyCapabilities)
import Selenium.Types (Builder, ScrollBehaviour, Driver, SELENIUM, SafariOptions, ProxyConfig, OperaOptions, LoggingPrefs, IEOptions, FirefoxOptions, ControlFlow, ChromeOptions)

data Command
= SetChromeOptions ChromeOptions
Expand Down
3 changes: 2 additions & 1 deletion src/Selenium/Capabilities.purs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module Selenium.Capabilities where

import Prelude
import Data.Monoid

import Data.Monoid (class Monoid)

foreign import data Capabilities :: *
foreign import emptyCapabilities :: Capabilities
Expand Down
13 changes: 8 additions & 5 deletions src/Selenium/Combinators.purs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
module Selenium.Combinators where

import Prelude

import Control.Alt ((<|>))
import Control.Monad.Eff.Exception (error)
import Control.Monad.Error.Class (throwError)
import Control.Monad.Trans (lift)
import Data.Maybe (Maybe(), isJust, maybe)

import Data.Either (Either(..), either)
import Control.Monad.Error.Class (throwError)
import Control.Monad.Eff.Exception (error)
import Selenium.Monad
import Selenium.Types
import Data.Maybe (Maybe, isJust, maybe)

import Selenium.Monad (Selenium, getCurrentUrl, wait, attempt, findExact, tryRepeatedlyTo, tryRepeatedlyTo', findElement, byCss, later, byClassName, byName, byId, byXPath)
import Selenium.Types (Element, Locator)

-- | Retry computation until it successed but not more then `n` times
retry :: forall e o a. Int -> Selenium e o a -> Selenium e o a
Expand Down
Loading

0 comments on commit a56a8a7

Please sign in to comment.