From b956247c1827cbf73e2a9d1e66bfddd5973e01c9 Mon Sep 17 00:00:00 2001 From: Daniel Ziltener Date: Thu, 9 Nov 2023 01:21:51 +0100 Subject: [PATCH] formatting FossilOrigin-Name: 0b5f81d8cdae951e2e6d3102f008d4344dbbf6c5c355804098ddf2b1eaae2b1e --- Makefile | 14 ++++++------- tests/run.scm | 3 +++ webdriver-impl.scm | 52 ++++++++++++++++++++-------------------------- webdriver.egg | 3 +++ 4 files changed, 35 insertions(+), 37 deletions(-) diff --git a/Makefile b/Makefile index 52b415b..519da69 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Tangling and weaving -webdriver.scm webdriver-impl.scm webdriver.html webdriver.egg webdriver.release-info tests/run.scm: webdriver.org vendor/htmlize.el +webdriver.scm webdriver-impl.scm webdriver.md webdriver.egg webdriver.release-info tests/run.scm: webdriver.org vendor/htmlize.el emacs --batch \ --load "~/.config/emacs/early-init.el" \ --load "vendor/htmlize.el" \ @@ -12,12 +12,12 @@ webdriver.scm webdriver-impl.scm webdriver.html webdriver.egg webdriver.release- --eval "(require 'htmlize)" \ --file "${.ALLSRC:[1]}" \ -f org-babel-tangle \ - -f org-html-export-to-html - mv "${.ALLSRC:[1]:R}.html" "${.ALLSRC:[1]:R}.html.old" - echo "
//' | sed -e 's/<\/h1>//'`'>" > "${.ALLSRC:[1]:R}.html" - cat "${.ALLSRC:[1]:R}.html.old" | sed -e '1,11d' | head -n -2 >> "${.ALLSRC:[1]:R}.html" - echo "
" >> "${.ALLSRC:[1]:R}.html" - rm "${.ALLSRC:[1]:R}.html.old" + -f org-md-export-to-markdown + # mv "${.ALLSRC:[1]:R}.html" "${.ALLSRC:[1]:R}.html.old" + # echo "
//' | sed -e 's/<\/h1>//'`'>" > "${.ALLSRC:[1]:R}.html" + # cat "${.ALLSRC:[1]:R}.html.old" | sed -e '1,11d' | head -n -2 >> "${.ALLSRC:[1]:R}.html" + # echo "
" >> "${.ALLSRC:[1]:R}.html" + # rm "${.ALLSRC:[1]:R}.html.old" vendor/htmlize.el: mkdir -p vendor diff --git a/tests/run.scm b/tests/run.scm index 95dd296..2aee705 100644 --- a/tests/run.scm +++ b/tests/run.scm @@ -25,6 +25,7 @@ ;; #+name: wd-session-test ;; [[file:../webdriver.org::wd-session-test][wd-session-test]] +<> (test-group "session" (let ((browser (make-WebDriver ))) (test "Initial state" #f (slot-value browser 'session-id)) @@ -38,6 +39,8 @@ ;; #+name: wd-url-test ;; [[file:../webdriver.org::wd-url-test][wd-url-test]] +<> +<> (test-group "url" (let ((browser (make-WebDriver ))) (test "Initial state" #f (slot-value browser 'session-id)) diff --git a/webdriver-impl.scm b/webdriver-impl.scm index 66eec95..39bb4d6 100644 --- a/webdriver-impl.scm +++ b/webdriver-impl.scm @@ -16,9 +16,7 @@ ) ;; Dependencies:4 ends here - - -;; * Error Conditions +;; Error Conditions ;; #+name: wd-exception @@ -97,9 +95,7 @@ ) ;; conditions ends here - - -;; * WebDriver +;; WebDriver ;; The core element of the library is the ~~ class and its subclasses. The class has the following fields: @@ -156,9 +152,7 @@ instance)) ;; webdriver-init ends here - - -;; ** Geckodriver +;; Geckodriver ;; The Geckodriver is used to control Firefox. @@ -201,11 +195,7 @@ (alist-ref/default result 'value result)) ;; geckodriver-postprocess ends here - - -;; * WebDriver API - -;; ** Communication +;; Communication ;; Data is sent to the API via a central class method. For convenience, there is a ~send-with-session~ variant that automatically adds the session id. @@ -229,9 +219,7 @@ (send instance data (string-append "session/" (slot-value instance 'session-id) "/" uri) method)) ;; wd-send ends here - - -;; ** Session management +;; Session management ;; Session management is very simple. There is just one method to initialize a new session. Everything else is handled automatically. @@ -254,18 +242,7 @@ (set! (slot-value instance 'session-id) #f)) ;; wd-term-session ends here - - -;; #+RESULTS: wd-session-test -;; : -- testing session ----------------------------------------------------------- -;; : Initial state ........................................................ [ PASS] -;; : Session id check ..................................................... [ PASS] -;; : Session id after termination ......................................... [ PASS] -;; : 3 tests completed in 3.788 seconds. -;; : 3 out of 3 (100%) tests passed. -;; : -- done testing session ------------------------------------------------------ - -;; ** API Access Methods +;; API Access Methods ;; #+name: wd-url @@ -338,7 +315,7 @@ (send-with-session instance `((script . ,script) (args . ,args)) "execute/sync" 'POST)) ;; API Access Methods:12 ends here - +;; Timeouts ;; The following timeouts are defined: @@ -361,6 +338,9 @@ (implicit . ,(slot-value instance 'implicit)))) ;; Timeouts:2 ends here +;; Setting and getting timeouts + + ;; [[file:webdriver.org::*Setting and getting timeouts][Setting and getting timeouts:1]] (define-method (set-timeouts (instance ) (timeouts )) (send-with-session instance (extract timeouts) "timeouts" 'POST)) @@ -373,6 +353,9 @@ 'implicit (alist-ref result 'implicit)))) ;; Setting and getting timeouts:1 ends here +;; Element Class + + ;; [[file:webdriver.org::*Element Class][Element Class:1]] (define-class () ((driver #f) @@ -386,6 +369,9 @@ method)) ;; Element Class:2 ends here +;; Location Strategies + + ;; [[file:webdriver.org::*Location Strategies][Location Strategies:1]] (define css-selector "css selector") (define link-text "link text") @@ -394,6 +380,9 @@ (define xpath "xpath") ;; Location Strategies:1 ends here +;; Accessor Methods + + ;; [[file:webdriver.org::*Accessor Methods][Accessor Methods:1]] (define-method (find-element (instance ) strategy selector) (let ((result (send-with-session instance `((using . ,strategy) (value . ,selector)) "element" 'POST))) @@ -424,6 +413,9 @@ result))) ;; Accessor Methods:4 ends here +;; Working with Elements + + ;; [[file:webdriver.org::*Working with Elements][Working with Elements:1]] (define-method (attribute (instance ) attribute) (let ((result (send-with-session instance #f diff --git a/webdriver.egg b/webdriver.egg index d81e8bc..e091a9a 100644 --- a/webdriver.egg +++ b/webdriver.egg @@ -1,3 +1,6 @@ +;; About This Egg + + ;; [[file:webdriver.org::*About This Egg][About This Egg:1]] ;; -*- scheme -*- ((author "Daniel Ziltener")