pagetience 0.3.0 → 0.3.1

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: 05f8f8ddbf769b62605052f8378282c011a3cb71
4
- data.tar.gz: 18c1edeecdc20fff221975e926019a21836fd454
3
+ metadata.gz: 1f92304035262970bf5df11b16f4276d85d8b377
4
+ data.tar.gz: 3f5b8ee98e6e519e82fd1485ea1fa57a3db8f74f
5
5
  SHA512:
6
- metadata.gz: 1c6933320f5286a4614ba5f54248495ed6f1135498b92f80bf5f633fa10b8c012a62096a634ce122c84d22805382d366dc61cc32167ce52c2110e1d13ae1babe
7
- data.tar.gz: 8ceafa985213dc9416312bdb1f1b1c7491754a6141ea98d4869c1471a0fcbdddb80d5c94d95e19724e1abbf26071424cf0aa265b8a7741956fc5e47b51ce574a
6
+ metadata.gz: 789d9f1814ab941cd39956ef814df497d79500df5061632d7648ee0037c2ed6f084429dd0714da312003bed1495679a25eb119fd33707b7aee9ca0c6c055e46d
7
+ data.tar.gz: 7fdcab2a4d00b13d2a55076dee3cd0ab90bc91db15a2c9325605c621b6fb07be609da0f34f02fdb1d68b739b111a2f9c15f86ecc3c9c4b0b053f08379ab9f994
data/README.md CHANGED
@@ -35,6 +35,47 @@ end
35
35
 
36
36
  When an instance of your page object is created then the required elements will be checked for.
37
37
 
38
+ #### Page transitions
39
+ Using the `transition_to` method within your page object, you can now wait for an expected page to transition to.
40
+
41
+ ```ruby
42
+ class FirstPage
43
+ include PageObject
44
+ include Pagetience
45
+
46
+ text_field :a, id: 'a'
47
+ button :b, id: 'b'
48
+ required :a, :b
49
+
50
+ def go_to_b
51
+ self.a = 'a'
52
+ self.b
53
+
54
+ wait_for_transition_to SecondPage
55
+ end
56
+ end
57
+
58
+ class SecondPage
59
+ include PageObject
60
+ include Pagetience
61
+
62
+ button :c, id: 'c'
63
+ required :c
64
+
65
+ def back_to_a
66
+ self.c
67
+
68
+ wait_for_transition_to FirstPage, 15, 5 # wait up to 15 seconds, polling every 5 seconds
69
+ end
70
+ end
71
+
72
+ # In a test
73
+
74
+ @current_page = FirstPage.new(@browser).go_to_b
75
+ expect(@current_page.loaded?).to eq true # true
76
+ expect(@current_page).to be_an_instance_of SecondPage # true
77
+ ```
78
+
38
79
  #### Adjusting the Timeout/Polling
39
80
  You can use the `waiting` method to specify how long you want to wait and, optionally, at what interval to poll the page for element visibility.
40
81
 
@@ -85,6 +85,7 @@ module Pagetience
85
85
  Pagetience::Meditate.for(timeout: timeout, polling: polling, msg: 'Timed out waiting for page transition.', expecting: true) { page.loaded? }
86
86
  page
87
87
  end
88
+ alias_method :wait_for_transition_to, :transition_to
88
89
 
89
90
  private
90
91
 
@@ -1,3 +1,3 @@
1
1
  module Pagetience
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pagetience
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Derek McNeil
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler