boq_com_au 0.0.1 → 0.0.3
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 +4 -4
- data/CHANGELOG +12 -0
- data/boq_com_au.gemspec +1 -1
- data/lib/BoqComAu/Account.rb +0 -21
- data/lib/BoqComAu/VERSION.rb +1 -1
- data/test/BoqComAu/Account_test.rb +1 -25
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1878f447c68ac5fc43e6982352185cfba05604eae3aaa849542e64e489e012fa
|
|
4
|
+
data.tar.gz: 9e1127f5f592781198af0bd5a986dbcbd07ffd409c183d6a879a9dc3ec47f126
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f4d30ffaaf0d48874655dfb1cf23a5d11748374be4ad2c9bb8a39073db5fa6e5e750e26945514b2c0b6fca71a3a460a534866dc9bc5e99535620d34c7e0a7b51
|
|
7
|
+
data.tar.gz: c4fe46849427efb5c5d8d7d4aeeda21cb9b01ff69b974182f15dbd8d8083302fc6ef333aa37be6e316db4883040afdd51454f49580e63069670aba8621feef11
|
data/CHANGELOG
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
## 20261103
|
|
4
4
|
|
|
5
|
+
0.0.3: BoqComAu::Account#login is WebAccount's, which waits for the log off link.
|
|
6
|
+
|
|
7
|
+
1. - BoqComAu::Account#login, #logon
|
|
8
|
+
2. ~ BoqComAu::VERSION: /0.0.2/0.0.3/
|
|
9
|
+
|
|
10
|
+
0.0.2: BoqComAu::Account#shutdown is WebAccount 0.6.1's, which quits the browser even where logging out fails.
|
|
11
|
+
|
|
12
|
+
1. - BoqComAu::Account#shutdown
|
|
13
|
+
2. ~ boq_com_au.gemspec: webaccount >= 0.6.1
|
|
14
|
+
3. - test/BoqComAu/Account_test.rb: shutdown.
|
|
15
|
+
4. ~ BoqComAu::VERSION: /0.0.1/0.0.2/
|
|
16
|
+
|
|
5
17
|
0.0.1: ~ BoqComAu::Account#logout returns once logged off, rather than after a 30 second timeout.
|
|
6
18
|
|
|
7
19
|
1. ~ BoqComAu::Account::PAGE_SELECTORS[:logged_out_xpath]: + the Log On Again link. The page shown after logging off has no sign-in button, so logged_out? waited for one until it timed out.
|
data/boq_com_au.gemspec
CHANGED
data/lib/BoqComAu/Account.rb
CHANGED
|
@@ -28,27 +28,6 @@ module BoqComAu
|
|
|
28
28
|
@password || raise("No password: it's given as password:.")
|
|
29
29
|
end
|
|
30
30
|
|
|
31
|
-
def login(username: nil, password: nil)
|
|
32
|
-
@logged_in = false
|
|
33
|
-
username ||= self.username
|
|
34
|
-
password ||= self.password
|
|
35
|
-
driver.attempt do
|
|
36
|
-
get_login_page
|
|
37
|
-
enter_username(username)
|
|
38
|
-
enter_password(password)
|
|
39
|
-
login_page_submit_button.click
|
|
40
|
-
end
|
|
41
|
-
@logged_in = driver_wait.until{!driver.element_present?(:id, 'btnSignIn')}
|
|
42
|
-
end
|
|
43
|
-
alias_method :logon, :login
|
|
44
|
-
|
|
45
|
-
# Chrome is quit whether or not logging out succeeds, so as a failed logout doesn't leave a logged-in browser behind.
|
|
46
|
-
def shutdown
|
|
47
|
-
logout if logged_in?
|
|
48
|
-
ensure
|
|
49
|
-
driver.quit
|
|
50
|
-
end
|
|
51
|
-
|
|
52
31
|
private
|
|
53
32
|
|
|
54
33
|
def initialize(username: nil, password: nil, chrome_profile_directory: nil, browser: nil, driver_options: nil)
|
data/lib/BoqComAu/VERSION.rb
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# test/BoqComAu/Account_test.rb
|
|
2
2
|
|
|
3
3
|
# Notes:
|
|
4
|
-
# 1. No browser and no BOQ: only what doesn't depend on the site is tested.
|
|
4
|
+
# 1. No browser and no BOQ: only what doesn't depend on the site is tested.
|
|
5
5
|
|
|
6
6
|
require_relative '../../lib/boq_com_au'
|
|
7
7
|
|
|
@@ -9,20 +9,6 @@ require 'minitest/autorun'
|
|
|
9
9
|
require 'minitest-spec-context'
|
|
10
10
|
|
|
11
11
|
describe BoqComAu::Account do
|
|
12
|
-
def stand_in_driver
|
|
13
|
-
driver = Object.new
|
|
14
|
-
driver.define_singleton_method(:quit){@quit = true}
|
|
15
|
-
driver.define_singleton_method(:quit?){!!@quit}
|
|
16
|
-
driver
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
def account_with_driver(driver, logged_in: true)
|
|
20
|
-
account = BoqComAu::Account.new
|
|
21
|
-
account.instance_variable_set(:@driver, driver)
|
|
22
|
-
account.instance_variable_set(:@logged_in, logged_in)
|
|
23
|
-
account
|
|
24
|
-
end
|
|
25
|
-
|
|
26
12
|
describe "#username and #password" do
|
|
27
13
|
it "are those given" do
|
|
28
14
|
account = BoqComAu::Account.new(username: 'customer', password: 'secret')
|
|
@@ -48,16 +34,6 @@ describe BoqComAu::Account do
|
|
|
48
34
|
end
|
|
49
35
|
end
|
|
50
36
|
|
|
51
|
-
describe "#shutdown" do
|
|
52
|
-
it "quits the browser even where logging out fails" do
|
|
53
|
-
driver = stand_in_driver
|
|
54
|
-
account = account_with_driver(driver)
|
|
55
|
-
account.define_singleton_method(:logout){raise Selenium::WebDriver::Error::TimeoutError}
|
|
56
|
-
_{account.shutdown}.must_raise(Selenium::WebDriver::Error::TimeoutError)
|
|
57
|
-
_(driver.quit?).must_equal(true)
|
|
58
|
-
end
|
|
59
|
-
end
|
|
60
|
-
|
|
61
37
|
describe "#default_driver_options" do
|
|
62
38
|
it "masks Chrome's automation flags, leaving the profile to Chrome where none is given" do
|
|
63
39
|
options = BoqComAu::Account.new.send(:default_driver_options)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: boq_com_au
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- thoran
|
|
@@ -29,14 +29,14 @@ dependencies:
|
|
|
29
29
|
requirements:
|
|
30
30
|
- - ">="
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 0.6.
|
|
32
|
+
version: 0.6.1
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - ">="
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 0.6.
|
|
39
|
+
version: 0.6.1
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: minitest
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|