-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sandwich-webdriver: more on haddocks and demos
- Loading branch information
Showing
15 changed files
with
185 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions
8
demos/demo-webdriver/demo-webdriver.cabal → ...mo-webdriver-nix/demo-webdriver-nix.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
Copyright Tom McLaughlin (c) 2024 | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above | ||
copyright notice, this list of conditions and the following | ||
disclaimer in the documentation and/or other materials provided | ||
with the distribution. | ||
|
||
* Neither the name of Tom McLaughlin nor the names of other | ||
contributors may be used to endorse or promote products derived | ||
from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{-# LANGUAGE AllowAmbiguousTypes #-} | ||
{-# LANGUAGE DataKinds #-} | ||
{-# LANGUAGE NumericUnderscores #-} | ||
{-# LANGUAGE OverloadedStrings #-} | ||
{-# LANGUAGE QuasiQuotes #-} | ||
{-# LANGUAGE TypeApplications #-} | ||
{-# LANGUAGE TypeOperators #-} | ||
|
||
module Main where | ||
|
||
import Control.Concurrent | ||
import Control.Monad.IO.Class | ||
import qualified Data.ByteString.Lazy as BL | ||
import Data.String.Interpolate | ||
import System.FilePath | ||
import Test.Sandwich | ||
import Test.Sandwich.Contexts.Nix | ||
import Test.Sandwich.WebDriver | ||
import Test.WebDriver.Commands | ||
|
||
|
||
simple :: TopSpecWithOptions | ||
simple = introduceWebDriver defaultWebDriverDependencies defaultWdOptions $ do | ||
it "opens Google and searches" $ withSession1 $ do | ||
openPage [i|https://www.google.com|] | ||
search <- findElem (ByCSS [i|*[title="Search"]|]) | ||
click search | ||
sendKeys "Haskell Sandwich" search | ||
findElem (ByCSS [i|input[type="submit"]|]) >>= click | ||
|
||
Just dir <- getCurrentFolder | ||
screenshot >>= liftIO . BL.writeFile (dir </> "screenshot.png") | ||
|
||
liftIO $ threadDelay 3_000_000 | ||
|
||
testOptions = defaultOptions { | ||
optionsTestArtifactsDirectory = defaultTestArtifactsDirectory | ||
} | ||
|
||
main :: IO () | ||
main = runSandwichWithCommandLineArgs testOptions simple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
cabal-version: 1.12 | ||
|
||
-- This file has been generated from package.yaml by hpack version 0.37.0. | ||
-- | ||
-- see: https://github.com/sol/hpack | ||
|
||
name: demo-webdriver-normal | ||
version: 0.1.0.0 | ||
license: BSD3 | ||
license-file: LICENSE | ||
build-type: Simple | ||
|
||
executable demo-webdriver-normal | ||
main-is: Main.hs | ||
other-modules: | ||
Paths_demo_webdriver_normal | ||
hs-source-dirs: | ||
app | ||
default-extensions: | ||
OverloadedStrings | ||
QuasiQuotes | ||
NamedFieldPuns | ||
RecordWildCards | ||
ScopedTypeVariables | ||
FlexibleContexts | ||
FlexibleInstances | ||
LambdaCase | ||
ghc-options: -threaded -rtsopts -with-rtsopts=-N | ||
build-depends: | ||
base | ||
, bytestring | ||
, filepath | ||
, sandwich | ||
, sandwich-contexts | ||
, sandwich-webdriver | ||
, string-interpolate | ||
, webdriver | ||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: demo-webdriver-normal | ||
version: 0.1.0.0 | ||
license: BSD3 | ||
|
||
dependencies: | ||
- base | ||
- bytestring | ||
- filepath | ||
- sandwich | ||
- sandwich-contexts | ||
- sandwich-webdriver | ||
- string-interpolate | ||
- webdriver | ||
|
||
default-extensions: | ||
- OverloadedStrings | ||
- QuasiQuotes | ||
- NamedFieldPuns | ||
- RecordWildCards | ||
- ScopedTypeVariables | ||
- FlexibleContexts | ||
- FlexibleInstances | ||
- LambdaCase | ||
|
||
ghc-options: | ||
- -threaded | ||
- -rtsopts | ||
- -with-rtsopts=-N | ||
|
||
executables: | ||
demo-webdriver-normal: | ||
main: Main.hs | ||
source-dirs: app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters