wisp-schema 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0c8732f37998ef5c639aa803b1f5e186a67331c3ddaceb36a4796ef64b0664f
4
- data.tar.gz: 4aa969b7b910bf7c3d21dd9732e7f2b13a3b1f3184bc8e120d2aa5780f080476
3
+ metadata.gz: '0393e542d263fda472a83d68da7e3eb8d4fa88e35f64cd3b9d54ffcbc3148c14'
4
+ data.tar.gz: 6fa9e976819a9c3c32a5c30778a91a7469c588348e97a87379907bf9071acfc5
5
5
  SHA512:
6
- metadata.gz: e980638064848368e57a7a213c86c4eb3b2406af683e328e1a84fd2ecb03a26878cb169f91619a52534694d4e63ef0aa6c8e0861900359f07d873c21178def42
7
- data.tar.gz: 37ec22aaaf9c2babe247ed02ae5696e080ed641b9e4000a44fd0fe0baa949d19d8ef568a898e76bb2e80842ca795ef76978ffed8cc6c5500d3896c18b0852102
6
+ metadata.gz: ea5c4f4514e592bc001ab0794881a1a2e9d8e9fcb231b1f518b4ad422ce380f94bd956c3d3140efd1ef156397d8ba43a3a56129a22ce9299cf0f5e7ecec7b51c
7
+ data.tar.gz: 8c5d7d7091bdabc71ec16a57a0a5fdb3c9e208baa26377b108bdf9145eaad63671493950ff48888de8db48bc412ff5214ec6def17ad7b602a913be2af325d218
data/lib/version.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Wisp
4
- VERSION = '1.1.0'
5
- STABLE_VERSION = '1.1.0'
4
+ VERSION = '1.2.0'
5
+ STABLE_VERSION = '1.2.0'
6
6
  CANARY_VERSION = '2.0.0'
7
7
  end
data/lib/wisp-schema.rb CHANGED
@@ -4,12 +4,35 @@ require 'semantic'
4
4
  require_relative 'version'
5
5
 
6
6
  module Wisp
7
+ class NotSupportedAction < StandardError
8
+ end
9
+
7
10
  SCHEMA_PATH = File.expand_path('../wisp.json', __dir__)
8
11
  NOUNS_PATH = File.expand_path('../nouns.json', __dir__)
9
12
 
10
13
  CANARY_SCHEMA_PATH = File.expand_path('../canary-wisp.json', __dir__)
11
14
  CANARY_NOUNS_PATH = File.expand_path('../canary-nouns.json', __dir__)
12
15
 
16
+ ACTIONS = [
17
+ "click",
18
+ "close_tab",
19
+ "double_click",
20
+ "drag_and_drop",
21
+ "fill",
22
+ "hover",
23
+ "loaded",
24
+ "navigate",
25
+ "observe",
26
+ "refresh",
27
+ "scroll",
28
+ "select",
29
+ "send_key",
30
+ "tester_confirmation",
31
+ "tester_instruction",
32
+ "type",
33
+ "wait",
34
+ ].freeze
35
+
13
36
  SEMANTIC_STABLE_VERSION = Semantic::Version.new(STABLE_VERSION)
14
37
 
15
38
  def is_canary?(raw_version)
@@ -34,4 +57,15 @@ module Wisp
34
57
  end
35
58
  end
36
59
  module_function :nouns_schemer
60
+
61
+ def action_schemer(raw_version, action)
62
+ raise NotSupportedAction unless ACTIONS.include?(action)
63
+
64
+ if is_canary?(raw_version)
65
+ JSONSchemer.schema(Pathname.new(File.expand_path("../canary/actions/#{action}.json", __dir__)))
66
+ else
67
+ JSONSchemer.schema(Pathname.new(File.expand_path("../stable/actions/#{action}.json", __dir__)))
68
+ end
69
+ end
70
+ module_function :action_schemer
37
71
  end
@@ -0,0 +1,25 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Click",
6
+ "description": "Clicks on the UI element",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["click"]
10
+ },
11
+ "target": {
12
+ "title": "Target",
13
+ "$ref": "ui_element_reference.json"
14
+ },
15
+ "button": {"title": "Mouse Button", "type": "string", "enum": ["left", "middle", "right"]},
16
+ "hold": {"title": "And Hold", "type": "boolean"},
17
+ "hold_seconds": {"title": "Hold seconds", "type": "integer"},
18
+ "version": {
19
+ "type": "string",
20
+ "title": "Version"
21
+ }
22
+ },
23
+ "additionalProperties": false,
24
+ "required": ["action", "target", "button", "hold", "version"]
25
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Close Tab",
6
+ "description": "Closes current browser tab",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["close_tab"]
10
+ },
11
+ "version": {
12
+ "type": "string",
13
+ "title": "Version"
14
+ }
15
+ },
16
+ "additionalProperties": false,
17
+ "required": ["action", "version"]
18
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Double Click",
6
+ "description": "Double-clicks on the UI element",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["double_click"]
10
+ },
11
+ "target": {
12
+ "title": "Target",
13
+ "$ref": "ui_element_reference.json"
14
+ },
15
+ "version": {
16
+ "type": "string",
17
+ "title": "Version"
18
+ }
19
+ },
20
+ "additionalProperties": false,
21
+ "required": ["action", "target", "version"]
22
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Drag and drop",
6
+ "description": "Drag and drop",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["drag_and_drop"]
10
+ },
11
+ "object": {
12
+ "title": "Object",
13
+ "$ref": "ui_element_reference.json"
14
+ },
15
+ "target": {
16
+ "title": "Target",
17
+ "$ref": "ui_element_reference.json"
18
+ },
19
+ "version": {
20
+ "type": "string",
21
+ "title": "Version"
22
+ }
23
+ },
24
+ "additionalProperties": false,
25
+ "required": ["action", "target", "object", "version"]
26
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Fill",
6
+ "description": "Fills the text field with specified content",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["fill"]
10
+ },
11
+ "target": {
12
+ "title": "Target",
13
+ "$ref": "ui_element_reference.json"
14
+ },
15
+ "text": {"title": "Text", "type": "string"},
16
+ "version": {
17
+ "type": "string",
18
+ "title": "Version"
19
+ }
20
+ },
21
+ "additionalProperties": false,
22
+ "required": ["action", "target", "text", "version"]
23
+ }
@@ -0,0 +1,22 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Hover",
6
+ "description": "Hovers over specified element",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["hover"]
10
+ },
11
+ "target": {
12
+ "title": "Target",
13
+ "$ref": "ui_element_reference.json"
14
+ },
15
+ "version": {
16
+ "type": "string",
17
+ "title": "Version"
18
+ }
19
+ },
20
+ "additionalProperties": false,
21
+ "required": ["action", "target", "version"]
22
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "assertion",
5
+ "title": "Loaded",
6
+ "description": "Checks if specified page has loaded",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["loaded"]
10
+ },
11
+ "page": {"title": "Page", "type": "string"},
12
+ "version": {
13
+ "type": "string",
14
+ "title": "Version"
15
+ }
16
+ },
17
+ "additionalProperties": false,
18
+ "required": ["action", "page", "version"]
19
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Navigate",
6
+ "description": "Navigates to specified URL",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["navigate"]
10
+ },
11
+ "url": {"title": "URL", "type": "string"},
12
+ "tab": {"title": "Tab", "type": "string", "enum": ["current", "new", "incognito"]},
13
+ "version": {
14
+ "type": "string",
15
+ "title": "Version"
16
+ }
17
+ },
18
+ "additionalProperties": false,
19
+ "required": ["action", "url", "tab", "version"]
20
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "assertion",
5
+ "title": "Observe",
6
+ "description": "Checks if element of the UI is visible or not",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["observe"]
10
+ },
11
+ "object": {
12
+ "title": "Object",
13
+ "$ref": "ui_element_reference.json"
14
+ },
15
+ "visibility": {
16
+ "title": "Is the element visible?",
17
+ "type": "boolean",
18
+ "enum": [true, false]
19
+ },
20
+ "version": {
21
+ "type": "string",
22
+ "title": "Version"
23
+ }
24
+ },
25
+ "additionalProperties": false,
26
+ "required": ["action", "object", "visibility", "version"]
27
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "refresh",
6
+ "description": "refreshes the webpage",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["refresh"]
10
+ },
11
+ "version": {
12
+ "type": "string",
13
+ "title": "Version"
14
+ }
15
+ },
16
+ "additionalproperties": false,
17
+ "required": ["action", "version"]
18
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Scroll",
6
+ "description": "Scrolls the page into specified direction until target is reached",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["scroll"]
10
+ },
11
+ "direction": {"title": "Direction", "type": "string", "enum": ["up", "down", "left", "right"]},
12
+ "target": {
13
+ "title": "Target",
14
+ "$ref": "ui_element_reference.json"
15
+ },
16
+ "version": {
17
+ "type": "string",
18
+ "title": "Version"
19
+ }
20
+ },
21
+ "additionalProperties": false,
22
+ "required": ["action", "direction", "target", "version"]
23
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Select",
6
+ "description": "Selects specified item from the dropdown",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["select"]
10
+ },
11
+ "target": {
12
+ "title": "Target",
13
+ "$ref": "ui_element_reference.json"
14
+ },
15
+ "option": {
16
+ "title": "Option",
17
+ "$ref": "ui_element_reference.json"
18
+ },
19
+ "version": {
20
+ "type": "string",
21
+ "title": "Version"
22
+ }
23
+ },
24
+ "additionalProperties": false,
25
+ "required": ["action", "target", "option", "version"]
26
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Press Key",
6
+ "description": "Press specified key or key combination.",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["send_key"]
10
+ },
11
+ "key": {"title": "Key", "type": "string"},
12
+ "modifier": {"title": "Modifier", "type": "string"},
13
+ "version": {
14
+ "type": "string",
15
+ "title": "Version"
16
+ }
17
+ },
18
+ "additionalProperties": false,
19
+ "required": ["action", "key", "version"]
20
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "assertion",
5
+ "title": "Tester Confirmation",
6
+ "description": "Ask a question to confirm a behavior",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["tester_confirmation"]
10
+ },
11
+ "confirmation": {"title": "confirmation", "type": "string"},
12
+ "version": {
13
+ "type": "string",
14
+ "title": "Version"
15
+ }
16
+ },
17
+ "additionalProperties": false,
18
+ "required": ["action", "confirmation", "version"]
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Tester Instruction",
6
+ "description": "An action for a human to complete",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["tester_instruction"]
10
+ },
11
+ "instruction": {"title": "Instruction", "type": "string"},
12
+ "version": {
13
+ "type": "string",
14
+ "title": "Version"
15
+ }
16
+ },
17
+ "additionalProperties": false,
18
+ "required": ["action", "instruction", "version"]
19
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Type",
6
+ "description": "Types in specified text",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["type"]
10
+ },
11
+ "text": {"title": "Text", "type": "string"},
12
+ "version": {
13
+ "type": "string",
14
+ "title": "Version"
15
+ }
16
+ },
17
+ "additionalProperties": false,
18
+ "required": ["action", "text", "version"]
19
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "title": "UI Element Reference",
5
+ "description": "A UI Element stored in the database",
6
+ "properties": {
7
+ "type": {
8
+ "enum": ["ui_element_reference"]
9
+ },
10
+ "id": {"title": "UI Element ID", "type": "integer"}
11
+ },
12
+ "additionalProperties": false,
13
+ "required": ["type", "id"]
14
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "action_type": "action",
5
+ "title": "Wait",
6
+ "description": "Waits for a number of seconds",
7
+ "properties": {
8
+ "action": {
9
+ "enum": ["wait"]
10
+ },
11
+ "embedded_test_id": {"title": "Embedded Test ID", "type": "integer"},
12
+ "seconds": {"title": "seconds", "type": "integer"},
13
+ "version": {
14
+ "type": "string",
15
+ "title": "Version"
16
+ }
17
+ },
18
+ "additionalProperties": false,
19
+ "required": ["action", "seconds", "version"]
20
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wisp-schema
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jan Grodowski
@@ -51,6 +51,24 @@ files:
51
51
  - lib/version.rb
52
52
  - lib/wisp-schema.rb
53
53
  - nouns.json
54
+ - stable/actions/click.json
55
+ - stable/actions/close_tab.json
56
+ - stable/actions/double_click.json
57
+ - stable/actions/drag_and_drop.json
58
+ - stable/actions/fill.json
59
+ - stable/actions/hover.json
60
+ - stable/actions/loaded.json
61
+ - stable/actions/navigate.json
62
+ - stable/actions/observe.json
63
+ - stable/actions/refresh.json
64
+ - stable/actions/scroll.json
65
+ - stable/actions/select.json
66
+ - stable/actions/send_key.json
67
+ - stable/actions/tester_confirmation.json
68
+ - stable/actions/tester_instruction.json
69
+ - stable/actions/type.json
70
+ - stable/actions/ui_element_reference.json
71
+ - stable/actions/wait.json
54
72
  - wisp.json
55
73
  homepage: https://github.com/rainforestapp/wisp
56
74
  licenses: