golden_silk 0.0.2.pumpkin → 0.0.3.cardboard

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 837c3ae481ed052bf24042cdcf26a3bdfd77663e
4
- data.tar.gz: b713946e8d511a9dd69c260d98f90b54e6f05515
3
+ metadata.gz: dae16601c21ac170ec594b547db698302e6d58f3
4
+ data.tar.gz: 5905ee2e8c0ad150ec94327571b701969bf1280e
5
5
  SHA512:
6
- metadata.gz: 208a5e692b053e186b3fbb2a6449a61d654cc2eb7c47a6152a39a1b7f9093ffa3d2e922caf5eec89c09bfbec6029e16c4728c058c5797ca29ebfae70a2d72786
7
- data.tar.gz: fdda1169f15bf9cdc75ae3daafc74274cc2fc5c4b0148de1aa7b702273e3f9953c757a65026d759148b0e5130b2bd16e83f8f78709ba8b3df3f23f281231d460
6
+ metadata.gz: 3088cfb1e1119af61efae609d9d70d8d9d3b9b2d4cf00de6d118f14876f53011658087c54e1ff9f75c990adc4ee6f7ae8644a1f67b66f623b5a13ea9a491a1b5
7
+ data.tar.gz: 93c1e903ca9010115a7e90277811db631f68b0199a85e849ec10ae0ac63eeee81b6f221a635518f76b44dde1ee0ebbdb4b7c757eca8f5786ad0e302e2e4b68ca
data/bin/golden_silk CHANGED
@@ -2,5 +2,6 @@
2
2
 
3
3
  require 'golden_silk'
4
4
 
5
+ # TODO: quiet mode (or quiet by default and verbose mode)
5
6
  # TODO: take URL as an argument
6
7
  GoldenSilk::Spinner.new('http://0.0.0.0:9001/avatar_builder').run
@@ -7,20 +7,18 @@ module GoldenSilk
7
7
  end
8
8
 
9
9
  def to_s
10
- s = "Steps:\n"
11
- s << @steps.join("\n") + "\n"
12
- s << "Diff:\n"
13
- in_diff = true
14
- @diff.split("\n").each do |line|
15
- if line.match(/^ /) && in_diff
16
- in_diff = false
17
- s << " ...\n"
18
- elsif !line.match(/^ /)
19
- in_diff = true
20
- s << " " + line + "\n"
21
- end
22
- end
23
- s
10
+ s = <<RSPEC
11
+ it 'has a particular effect' do
12
+ #{@steps[0...-1].join("\n sleep 2\n ")}
13
+ sleep 2
14
+ html_before = html
15
+ #{@steps.last}
16
+ sleep 2
17
+ html_after = html
18
+ diff = Diffy::Diff.new(html_before, html_after, context: 1).to_s
19
+ expect(diff).to eql('#{@diff.gsub("'", "\\\\'")}')
20
+ end
21
+ RSPEC
24
22
  end
25
23
  end
26
24
  end
@@ -6,9 +6,16 @@ module GoldenSilk
6
6
  end
7
7
 
8
8
  def to_s
9
- s = "Steps:\n"
10
- s << @steps.join("\n")
11
- s
9
+ s = <<RSPEC
10
+ it 'has no effect' do
11
+ #{@steps[0...-1].join("\n sleep 2\n ")}
12
+ sleep 2
13
+ html_before = html
14
+ #{@steps.last}
15
+ sleep 2
16
+ expect(html).to eql(html_before)
17
+ end
18
+ RSPEC
12
19
  end
13
20
  end
14
21
  end
@@ -38,10 +38,14 @@ module GoldenSilk
38
38
  }
39
39
  stuff(@queue, @results)
40
40
 
41
- @results.each do |result|
42
- # TODO: quiet mode (or quiet by default and verbose mode)
43
- puts "==============="
44
- puts result
41
+ # TODO: configurable output dir, test file(s), preamble
42
+ # TODO: stream results so that all is not lost if you have to kill the generation
43
+ FileUtils.mkdir_p("test/integration")
44
+ File.open('test/integration/golden_silk_spec.rb', 'w') do |f|
45
+ f.puts "require 'diffy'"
46
+ f.puts "describe 'Golden Master behavior' do"
47
+ f.puts @results.join("\n")
48
+ f.puts "end"
45
49
  end
46
50
  end
47
51
 
@@ -65,7 +69,7 @@ module GoldenSilk
65
69
  last_action.execute
66
70
  sleep 2
67
71
  after_snapshot = html
68
- diff = Diffy::Diff.new(before_snapshot, after_snapshot).to_s
72
+ diff = Diffy::Diff.new(before_snapshot, after_snapshot, context: 1).to_s
69
73
 
70
74
  if diff.empty?
71
75
  puts "No change, adding to results but not queue."
@@ -13,7 +13,8 @@ module GoldenSilk
13
13
  end
14
14
 
15
15
  def to_s
16
- "Click #{@text}"
16
+ # TODO: see if the element + text is unique enough to not have to use xpath
17
+ "find(:xpath, \"#{@xpath}\").click"
17
18
  end
18
19
  end
19
20
  end
@@ -1,3 +1,3 @@
1
1
  module GoldenSilk
2
- VERSION = "0.0.2.pumpkin"
2
+ VERSION = "0.0.3.cardboard"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: golden_silk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2.pumpkin
4
+ version: 0.0.3.cardboard
5
5
  platform: ruby
6
6
  authors:
7
7
  - Carol (Nichols || Goulding)