wagn 1.20.1 → 1.20.2

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
  SHA1:
3
- metadata.gz: 6dffc37a2889618b5d050be8245b96f04c2e3158
4
- data.tar.gz: 07cfa60ae76b35fd2f2198643bab61a10f6e5289
3
+ metadata.gz: aacbd8d9020a2bbde198f363933365b287b919e0
4
+ data.tar.gz: c99bec35184f50ca1e3bb10326b325693d909518
5
5
  SHA512:
6
- metadata.gz: 7256a1ebc8ae176adf2cde46a6c05b5997f919730f295e9cf628a1541d8355a44e762441bb31ac444428226eb66ed5de957596a6c6b99223658ca6e08c4080cd
7
- data.tar.gz: 8d522e43cf859b267263c9d7c2c88b24f7012760786ed6b41e55d972ee00e8e6679a34b7a0ebed495a615680cd9b68d3fdb7a5f8a71e2c9b40187a29a2b5d072
6
+ metadata.gz: 278a1e0e50eab3b2b77a89cd5f99455cc39e3cb3613a2ddc81f451237a4d334f54b93f0d75502a62af84e231fa7e0086c0192acad36d361a6368e5b067283c45
7
+ data.tar.gz: 1a5166f2a1afe02442e37e40bdb70cfec3895911521dd6389488fbac3561eeff1bf027e7f825138f7202e48b648250db9e9c0fc7dc52ba5257466a68f00cf636
@@ -12,7 +12,7 @@ Feature: Pointer Inputs
12
12
  Scenario: Creating a card with select input
13
13
  Given I create Phrase card "friends+*right+*input" with content "select"
14
14
  When I go to card "Joe User+friends"
15
- And I select "Joe Camel" from "pointer_select"
15
+ And I select "Joe Camel" from "Content"
16
16
  And I press "Submit"
17
17
  And I go to card "Joe User+friends"
18
18
  Then I should see "Joe Camel"
@@ -21,7 +21,7 @@ Feature: Pointer Inputs
21
21
  Given I create Phrase card "User+*type+*structure" with content "{{+friends}}"
22
22
  And I create Phrase card "friends+*right+*input" with content "select"
23
23
  When I edit "Joe User"
24
- And I select "Joe Admin" from "pointer_select"
24
+ And I select "Joe Admin" from "+friends"
25
25
  And I press "Submit"
26
26
  And I go to card "Joe User"
27
27
  Then I should see "Joe Admin"
@@ -29,7 +29,7 @@ Feature: Pointer Inputs
29
29
  Scenario: Creating a card with multiselect input
30
30
  Given I create Phrase card "friends+*right+*input" with content "multiselect"
31
31
  When I go to card "Joe User+friends"
32
- And I select "Joe Camel" from "pointer_multiselect"
32
+ And I select "Joe Camel" from "Content"
33
33
  And I press "Submit"
34
34
  And I go to card "Joe User+friends"
35
35
  Then I should see "Joe Camel"
@@ -38,7 +38,7 @@ Feature: Pointer Inputs
38
38
  Given I create Phrase card "User+*type+*structure" with content "{{+friends}}"
39
39
  And I create Phrase card "friends+*right+*input" with content "multiselect"
40
40
  When I edit "Joe User"
41
- And I select "Joe Admin" from "pointer_multiselect"
41
+ And I select "Joe Admin" from "friends"
42
42
  And I press "Submit"
43
43
  And I go to card "Joe User"
44
44
  And I should see "Joe Admin"
@@ -91,7 +91,7 @@ When /^(.*) edits? "([^\"]*)" with plusses:/ do |username, cardname, plusses|
91
91
  end
92
92
  end
93
93
 
94
- def set_content name, content, cardtype=nil
94
+ def set_content name, content, _cardtype=nil
95
95
  Capybara.ignore_hidden_elements = false
96
96
  ace_editors = all(".ace-editor-textarea[name='#{name}']")
97
97
  pm_editors = all(".prosemirror-editor > [name='#{name}']")
@@ -103,7 +103,7 @@ def set_content name, content, cardtype=nil
103
103
  editor_id = pm_editors.first.first(:xpath, ".//..")[:id]
104
104
  set_prosemirror_content editor_id, content
105
105
  else
106
- #rescue Selenium::WebDriver::Error::JavascriptError
106
+ # rescue Selenium::WebDriver::Error::JavascriptError
107
107
  fill_in(name, with: content)
108
108
  end
109
109
  Capybara.ignore_hidden_elements = true
@@ -188,8 +188,9 @@ end
188
188
  # end
189
189
  #
190
190
  Then /debug/ do
191
- require 'pry'
192
- binding.pry
191
+ require "pry"
192
+ binding.pry #
193
+ nil
193
194
  end
194
195
  # if RUBY_VERSION =~ /^2/
195
196
  # else
@@ -409,3 +410,50 @@ end
409
410
  When /^I fill in "([^\"]*)" with$/ do |field, value|
410
411
  fill_in(field, with: value)
411
412
  end
413
+
414
+ module Capybara
415
+ module Node
416
+ module Actions
417
+ alias_method :original_fill_in, :fill_in
418
+ alias_method :original_select, :select
419
+
420
+ def fill_in locator, options={}
421
+ wagn_fill_in(locator, options) || original_fill_in(locator, options)
422
+ end
423
+
424
+ def select value, options={}
425
+ wagn_select(value, options) || original_select(value, options)
426
+ end
427
+
428
+ def wagn_fill_in locator, options
429
+ el = labeled_field(:input, locator) || labeled_field(:textarea, locator)
430
+ return unless el
431
+ el.set options[:with]
432
+ true
433
+ end
434
+
435
+ def wagn_select value, options
436
+ el = labeled_field :select, options[:from], visible: false
437
+ return unless el
438
+ value = el.find("option", text: value, visible: false)["value"]
439
+ choose_value el, value
440
+ true
441
+ end
442
+
443
+ def choose_value el, value
444
+ id = el["id"]
445
+ session.execute_script("$('##{id}').val('#{value}')")
446
+ # session.execute_script("$('##{id}').trigger('chosen:updated')")
447
+ # session.execute_script("$('##{id}').change()")
448
+ end
449
+
450
+ def labeled_field type, label, options={}
451
+ label.gsub!(/^\+/, "") # because '+' is in an extra span,
452
+ # descendant-or-self::text doesn't find it
453
+ first :xpath,
454
+ "//label[descendant-or-self::text()='#{label}']/..//#{type}",
455
+ options.merge(wait: 5)
456
+ end
457
+ end
458
+ end
459
+ end
@@ -55,28 +55,6 @@ When /^(?:|I )submit form$/ do
55
55
  find(:css, "button[type='submit']").click
56
56
  end
57
57
 
58
- When /^(?:|I )single-select "([^"]*)" from "([^"]*)"$/ do |value, field|
59
- select =
60
- find("label", text: field).find(:xpath, "..//select", visible: false)
61
- value = select.find("option", text: value, visible: false)["value"]
62
- page.execute_script("$('##{select['id']}').val('#{value}')")
63
- page.execute_script("$('##{select['id']}').trigger('chosen:updated')")
64
- page.execute_script("$('##{select['id']}').change()")
65
-
66
- # code below doesn't work on wikirate because if you select an item in
67
- # a very long list the list gets pushed below the navigation bar
68
- # find("label", text: field).find(:xpath, "..//a[@class='chosen-single']")
69
- # .click
70
- # li = find("li", text: value, visible: false)
71
- # li.click
72
- # # If the list element is too far down the list then the first click
73
- # # scrolls it up but doesn't select it. It needs another click.
74
- # # A selected item is no longer visible (because the list disappears)
75
- # if li.visible?
76
- # li.click
77
- # end
78
- end
79
-
80
58
  # Use this step in conjunction with Rail's datetime_select helper. For example:
81
59
  # When I select "December 25, 2008 10:00" as the date and time
82
60
  When /^(?:|I )select "([^"]*)" as the date and time$/ do |time|
@@ -83,3 +83,48 @@ ActionController::Base.allow_rescue = false
83
83
  # The :transaction strategy is faster, but might give you threading problems.
84
84
  # See https://github.com/cucumber/cucumber-rails/blob/master/features/choose_javascript_database_strategy.feature
85
85
  Cucumber::Rails::Database.javascript_strategy = :truncation
86
+
87
+ # `LAUNCHY=1 cucumber` to open page on failure
88
+ After do |scenario|
89
+ save_and_open_page if scenario.failed? && ENV["LAUNCHY"]
90
+ end
91
+
92
+ # `FAST=1 cucumber` to stop on first failure
93
+ After do |scenario|
94
+ Cucumber.wants_to_quit = ENV["FAST"] && scenario.failed?
95
+ end
96
+
97
+ # `DEBUG=1 cucumber` to drop into debugger on failure
98
+ After do |scenario|
99
+ next unless ENV["DEBUG"] && scenario.failed?
100
+ puts "Debugging scenario: #{scenario.name}"
101
+ if respond_to? :debugger
102
+ debugger
103
+ elsif binding.respond_to? :pry
104
+ binding.pry #
105
+ else
106
+ puts "Can't find debugger or pry to debug"
107
+ end
108
+ end
109
+
110
+ # `STEP=1 cucumber` to pause after each step
111
+ AfterStep do |result, step|
112
+ next unless ENV["STEP"]
113
+ unless defined?(@counter)
114
+ #puts "Stepping through #{scenario.name}"
115
+ @counter = 0
116
+ end
117
+ @counter += 1
118
+ #print "At step ##{@counter} of #{scenario.steps.count}. Press Return to"\
119
+ # " execute..."
120
+ print "Press Return to execute next step...\n"\
121
+ "(d=debug, c=continue, s=step, a=abort)"
122
+ case STDIN.getch
123
+ when "d" then
124
+ binding.pry #
125
+ when "c" then
126
+ ENV.delete "STEP"
127
+ when "a" then
128
+ Cucumber.wants_to_quit = true
129
+ end
130
+ end
@@ -10,6 +10,17 @@ module Wagn
10
10
  command += " 2>&1"
11
11
  exit $CHILD_STATUS.exitstatus unless system command
12
12
  end
13
+
14
+ # split special wagn args and original command args separated by '--'
15
+ def split_args args
16
+ before_split = true
17
+ wagn_args, command_args =
18
+ args.partition do |a|
19
+ before_split = (a == "--" ? false : before_split)
20
+ end
21
+ command_args.shift
22
+ [wagn_args, command_args]
23
+ end
13
24
  end
14
25
  end
15
26
  end
@@ -6,7 +6,9 @@ module Wagn
6
6
  def initialize args
7
7
  require "wagn"
8
8
  require "./config/environment"
9
- @args = args
9
+ @wagn_args, @cucumber_args = split_args args
10
+ @opts = {}
11
+ Parser.new(@opts).parse!(@wagn_args)
10
12
  end
11
13
 
12
14
  def command
@@ -17,13 +19,18 @@ module Wagn
17
19
  private
18
20
 
19
21
  def env_args
20
- env_args = "RAILS_ROOT=."
21
- env_args << " COVERAGE=false" if @args.present?
22
+ env_args = @opts[:env].join " "
23
+ # turn coverage off if not all cukes run
24
+ env_args << " COVERAGE=false" if @cucumber_args.present?
22
25
  env_args
23
26
  end
24
27
 
25
28
  def feature_args
26
- @args.empty? ? feature_paths.join(" ") : @args.shelljoin
29
+ if @cucumber_args.empty?
30
+ feature_paths.join(" ")
31
+ else
32
+ @cucumber_args.shelljoin
33
+ end
27
34
  end
28
35
 
29
36
  def require_args
@@ -39,3 +46,5 @@ module Wagn
39
46
  end
40
47
  end
41
48
  end
49
+
50
+ require File.expand_path("../cucumber_command/parser", __FILE__)
@@ -0,0 +1,33 @@
1
+ # -*- encoding : utf-8 -*-
2
+ require "optparse"
3
+
4
+ module Wagn
5
+ module Commands
6
+ class CucumberCommand
7
+ class Parser < OptionParser
8
+ def initialize opts
9
+ super() do |parser|
10
+ parser.banner = "Usage: wagn cucumber [WAGN ARGS] -- [CUCUMBER ARGS]\n\n"
11
+ parser.separator <<-EOT.strip_heredoc
12
+
13
+ WAGN ARGS
14
+ EOT
15
+ opts[:env] = ["RAILS_ROOT=."]
16
+ parser.on("-d", "--debug", "Drop into debugger on failure") do |a|
17
+ opts[:env] << "DEBUG=1" if a
18
+ end
19
+ parser.on("-f", "--fast", "Stop on first failure") do |a|
20
+ opts[:env] << "FAST=1" if a
21
+ end
22
+ parser.on("-l", "--launchy", "Open page on failure") do |a|
23
+ opts[:env] << "LAUNCHY=1" if a
24
+ end
25
+ parser.on("-s", "--step", "Pause after each step") do |a|
26
+ opts[:env] << "STEP=1" if a
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -7,7 +7,7 @@ module Wagn
7
7
  require "rspec/core"
8
8
  require "wagn/application"
9
9
 
10
- @wagn_args, @rspec_args = split_wagn_and_rspec_args args
10
+ @wagn_args, @rspec_args = split_args args
11
11
  @opts = {}
12
12
  Parser.new(@opts).parse!(@wagn_args)
13
13
  end
@@ -31,20 +31,8 @@ module Wagn
31
31
  end
32
32
  @opts[:simplecov]
33
33
  end
34
-
35
- def split_wagn_and_rspec_args args
36
- before_split = true
37
- wagn, rspec =
38
- args.partition do |a|
39
- before_split = (a == "--" ? false : before_split)
40
- end
41
- rspec.shift
42
- [wagn, rspec]
43
- end
44
-
45
-
46
34
  end
47
35
  end
48
36
  end
49
37
 
50
- require File.expand_path("../rspec_command/parser", __FILE__)
38
+ require File.expand_path("../rspec_command/parser", __FILE__)
@@ -81,4 +81,4 @@ module Wagn
81
81
  end
82
82
  end
83
83
  end
84
- end
84
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wagn
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.20.1
4
+ version: 1.20.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-01-26 00:00:00.000000000 Z
14
+ date: 2017-03-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -33,14 +33,14 @@ dependencies:
33
33
  requirements:
34
34
  - - '='
35
35
  - !ruby/object:Gem::Version
36
- version: 1.20.1
36
+ version: 1.20.2
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - '='
42
42
  - !ruby/object:Gem::Version
43
- version: 1.20.1
43
+ version: 1.20.2
44
44
  description: a wiki approach to stuctured data, dynamic interaction, and web design
45
45
  email:
46
46
  - info@wagn.org
@@ -114,6 +114,7 @@ files:
114
114
  - lib/wagn/commands/application.rb
115
115
  - lib/wagn/commands/command.rb
116
116
  - lib/wagn/commands/cucumber_command.rb
117
+ - lib/wagn/commands/cucumber_command/parser.rb
117
118
  - lib/wagn/commands/rake_command.rb
118
119
  - lib/wagn/commands/rake_command/parser.rb
119
120
  - lib/wagn/commands/rspec_command.rb