-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
beae23f
commit b0cfe31
Showing
2 changed files
with
53 additions
and
39 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,53 @@ | ||
#!/usr/bin/env kotlin | ||
|
||
@file:DependsOn("com.enniovisco:webmonitor:1.2.0") | ||
|
||
import com.enniovisco.dsl.* | ||
|
||
monitor { | ||
webSource { | ||
screenWidth = 393 // px | ||
screenHeight = 851 // px | ||
// To date Google Chrome is the browser with the most stable APIs | ||
browser = Browser.CHROME_HEADLESS // Alternatively Browser.FIREFOX, Browser.EDGE or Browser.CHROME | ||
wait = 0 | ||
maxSessionDuration = 5_000 // ms | ||
targetUrl = "https://enniovisco.github.io/webmonitor/sample.html" | ||
} | ||
|
||
spec { | ||
atoms( | ||
select { ".cookieInfo" } // [0] | ||
read "visibility" | ||
equalTo "visible", | ||
select { ".subtitle" }, // [1] | ||
select { "button#close" }, // [2] | ||
select { ".cookieInfo" } read "position" bind "pos", | ||
select { ".cookieInfo" } read "font-size" bind "fs", | ||
select { ".info" } read "position" bind "pos", | ||
select { ".subtitle" } read "font-size" bind "fs" | ||
applying { value, bound -> | ||
parsePixels(value) == parsePixels(bound) * 1.5 | ||
}, | ||
select { "h2.subtitle" }, | ||
select { "p" } | ||
) | ||
|
||
record( | ||
after { "click" }, | ||
after { "touch" } | ||
) | ||
|
||
|
||
// helper formulae | ||
val screen = Spec.screen | ||
val popupIsVisible = Spec.atoms[0] | ||
val subtitle = Spec.atoms[1] | ||
val closeButton = Spec.atoms[2] | ||
val er1 = closeButton implies screen | ||
val er2 = not(popupIsVisible and subtitle) | ||
|
||
// Final formula | ||
formula = atoms[6] and not(atoms[8]) // and everywhere(er1) | ||
} | ||
} |