Skip to content

Commit

Permalink
Tidy up
Browse files Browse the repository at this point in the history
  • Loading branch information
James Browning committed Oct 26, 2021
1 parent a80aecf commit f2916ce
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/plutus-playground-e2e-tests.yml
Expand Up @@ -56,7 +56,9 @@ jobs:

- name: Run Tests
working-directory: ./e2e-tests/
env:
FIREFOX_BINARY: "/opt/hostedtoolcache/firefox/latest/x64/firefox"
run: |
echo "Running tests"
cabal build plutus-playground-e2e-tests
cabal run plutus-playground-e2e-tests True
cabal run plutus-playground-e2e-tests $FIREFOX_BINARY
2 changes: 1 addition & 1 deletion e2e-tests/README.md
Expand Up @@ -3,7 +3,7 @@ This is an end-to-end test suite using [hs-webdriver](https://hackage.haskell.or

**RISK:** If this haskell webdriver library is not up to the task then we may want to either resurrect it, or use a python/java/javascript approach instead.

To run these tests locally you'll need Firefox and Java installed to start the Selenium webserver. See workflow for example commands. `xvfb` is used in CI to virtualise display, which is not necessary to run the Selenium webserver locally with this. That is, just run `java -jar selenium-server-4.0.0.jar standalone`.
To run these tests locally you'll need Firefox and Java installed to start the Selenium webserver. See workflow for example commands. `xvfb` is used in CI to virtualise display and is not necessary when running the Selenium webserver locally (just run `java -jar selenium-server-4.0.0.jar standalone`).

All tests are defined with a behavioural-driven design pattern for readability.

Expand Down
7 changes: 5 additions & 2 deletions e2e-tests/plutus-playground-e2e-tests/BrowserConfig.hs
Expand Up @@ -2,13 +2,16 @@

module BrowserConfig where

import Data.String
import System.Environment (getArgs)
import Test.WebDriver

-- May be useful in future if we want to configure display area:
--firefoxConfig = useBrowser firefox { ffBinary=Just firefoxBin, ffAcceptInsecureCerts=Just True } defaultConfig { wdCapabilities = defaultCaps { additionalCaps = [ ("moz:firefoxOptions", object [ ("args", Array (fromList [String "--headless", String "--window-size=1050,1080"])) ]) ] } }

firefoxConfig :: IO WDConfig
firefoxConfig = do
args <- getArgs
let nargs = length args
let ci = if nargs > 0 then read (args!!0) else False
let firefoxBin = if ci then "/opt/hostedtoolcache/firefox/latest/x64/firefox" else "/usr/bin/firefox"
let firefoxBin = if nargs > 0 then fromString (args!!0) else "/usr/bin/firefox"
return $ useBrowser firefox { ffBinary=Just firefoxBin, ffAcceptInsecureCerts=Just True } defaultConfig
3 changes: 0 additions & 3 deletions e2e-tests/plutus-playground-e2e-tests/Main.hs
Expand Up @@ -12,9 +12,6 @@ import Test.WebDriver
import Test.WebDriver.Class
import Utils

-- May be useful in future if we want to configure display area:
--firefoxConfig = useBrowser firefox { ffBinary=Just firefoxBin, ffAcceptInsecureCerts=Just True } defaultConfig { wdCapabilities = defaultCaps { additionalCaps = [ ("moz:firefoxOptions", object [ ("args", Array (fromList [String "--headless", String "--window-size=1050,1080"])) ]) ] } }

main :: IO ()
main = do
firefoxConfig <- BrowserConfig.firefoxConfig
Expand Down
Expand Up @@ -18,18 +18,7 @@ build-type: Simple
extra-source-files: CHANGELOG.md

library
import: base

-- if flag(unexpected_thunks)
-- cpp-options: -DUNEXPECTED_THUNKS

-- hs-source-dirs: src

-- exposed-modules: -- Behaviours.Common
-- , Behaviours.Editor
-- , Behaviours.Simulator
-- , Elements
-- , Utils
-- import: base >=4.14 && <4.15

build-depends: base >=4.14 && <4.15
, webdriver >= 0.9
Expand Down

0 comments on commit f2916ce

Please sign in to comment.