Test your websites with this simple GUI based scripted webtester. Generate simple testscripts directly from surfng on the webpage, enhance them with your commands, with variables, loops, checks, … and finally run automated web tests.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.6 KiB

;; Define an Emacs Mode for Webtester
;;
;; Features:
;; - indentation support
;; - syntax highlighting
;;
;; Documentations:
;; - mode tutorial:
;; https://www.emacswiki.org/emacs/ModeTutorial
;; - faces for font lock:
;; https://www.gnu.org/software/emacs/manual/html_node/elisp/Faces-for-Font-Lock.html
(defvar wt-mode-hook nil)
(defvar wt-mode-map
(let ((map (make-sparse-keymap)))
(define-key map "\C-j" 'newline-and-indent)
map)
"Newline and indent")
(add-to-list 'auto-mode-alist '("\\.wt\\'" . wt-mode))
;; get all keywords:
;; echo $(webrunner -h | sed -n 's, COMMAND: ,,p') | sed 's, ,\\\\|,g'
(defconst wt-font-lock-keywords
(list
'("^ *\\(auth\\|ca-certificate\\|call\\|case\\|default\\|check\\|clear-cookies\\|click\\|clicktype\\|client-certificate\\|do\\|download\\|echo\\|execute\\|exists\\|exit\\|expect\\|fail\\|for\\|function\\|if\\|else\\|while\\|ignore\\|unignore\\|ignoreto\\|include\\|label\\|load\\|not\\|offline-storage-path\\|open\\|screenshot\\|set\\|setvalue\\|sleep\\|testcase\\|testsuite\\|timeout\\|timeout-false\\|unset\\|upload\\)\\b" . font-lock-builtin-face)
'("^ *#.*$" . font-lock-comment-face))
"Highlighting expressions for Webtester")
(defvar wt-mode-syntax-table
(let ((st (make-syntax-table)))
st)
"Syntax table for wt-mode")
(defun wt-mode ()
"Major mode for editing Webtester test scripts"
(interactive)
(kill-all-local-variables)
(set-syntax-table wt-mode-syntax-table)
(use-local-map wt-mode-map)
(set (make-local-variable 'font-lock-defaults) '(wt-font-lock-keywords))
(setq major-mode 'wt-mode)
(setq mode-name "Webtester")
(run-hooks 'wpdl-mode-hook))
(provide 'wt-mode)