kobot 2.0.0 → 2.1.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 +4 -4
- data/CHANGELOG.md +30 -27
- data/lib/kobot/engine.rb +17 -11
- data/lib/kobot/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e51c45d51bed6c3e614f58f41e557a9da9ab4dd6d457419bf1f2d654bc0e8e6d
|
4
|
+
data.tar.gz: 6cf858d531f3ef1b990751a8c821fd13965f04b234191a324598c9eefc68ac6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f00479950ad49f878f85fc515e5cb337a0fe3b047fa49a8b94dd5bcf2b776008f24d168c122c6f651445a1a883084c56296d9a4b034e9693f66b6336422351a
|
7
|
+
data.tar.gz: c6dc7304b15f26a6ae39dcfd9e644c82081b22519d2b28469f6671e570c73c70baf91be0e30eb4950833330b1a39cf200d3c9722d819c57377ab678f9efa2e6c
|
data/CHANGELOG.md
CHANGED
@@ -1,39 +1,42 @@
|
|
1
|
-
###
|
2
|
-
-
|
1
|
+
### v2.1.0
|
2
|
+
- Changed i18n identification strategy due to that KOT displays in Japanese even though the login screen is in English
|
3
3
|
|
4
|
-
###
|
5
|
-
-
|
6
|
-
-
|
7
|
-
- Updated required_ruby_version to be >= 2.4.0 to align with the webdrivers dependency
|
4
|
+
### v2.0.0
|
5
|
+
- Added -a, --auto-skip flag to support the enabling and disabling of auto-skipping feature
|
6
|
+
- Renamed the schedule config option from -a, --auto-skip-without to -w, --auto-skip-without
|
8
7
|
|
9
|
-
### v1.
|
10
|
-
- Added
|
11
|
-
-
|
8
|
+
### v1.3.0
|
9
|
+
- Added config option (-a, --auto-skip-without) to enable automatic skipping based on schedule
|
10
|
+
- Replaced deprecated options with capabilities option in Selenium driver initialization
|
11
|
+
- Refactored scattered attr_accessors and reduced instance variables count reported by Rubocop
|
12
12
|
|
13
|
-
### v1.2.
|
14
|
-
-
|
15
|
-
- Switched to builtin Logger#deprecate from Logger#warn for deprecations
|
16
|
-
- Renamed internal method to skip? from holiday? as it was meant for skipping any specified date
|
13
|
+
### v1.2.5
|
14
|
+
- Added I18n support for both English and Japanese KOT UI
|
17
15
|
|
18
|
-
### v1.2.
|
19
|
-
-
|
20
|
-
- Applied fix for offenses about empty lines and long lines reported by Rubocop
|
16
|
+
### v1.2.4
|
17
|
+
- Changed to use boolean values for validation instead of raising exceptions
|
21
18
|
|
22
19
|
### v1.2.3
|
23
20
|
- Improved validation logic to skip running due to weekend or intentional skips
|
24
21
|
- Refactored engine by reducing methods length based on reports by Rubocop
|
25
22
|
|
26
|
-
### v1.2.
|
27
|
-
-
|
23
|
+
### v1.2.2
|
24
|
+
- Improved login screen wait and logging
|
25
|
+
- Applied fix for offenses about empty lines and long lines reported by Rubocop
|
28
26
|
|
29
|
-
### v1.2.
|
30
|
-
-
|
27
|
+
### v1.2.1
|
28
|
+
- Improved logging for better readability in logs
|
29
|
+
- Switched to builtin Logger#deprecate from Logger#warn for deprecations
|
30
|
+
- Renamed internal method to skip? from holiday? as it was meant for skipping any specified date
|
31
31
|
|
32
|
-
### v1.
|
33
|
-
- Added
|
34
|
-
-
|
35
|
-
- Refactored scattered attr_accessors and reduced instance variables count reported by Rubocop
|
32
|
+
### v1.2.0
|
33
|
+
- Added an option to allow forcibly running regardless of weekends or public holidays
|
34
|
+
- Added an ENV flag to allow requiring lib in local workspace for development purpose
|
36
35
|
|
37
|
-
###
|
38
|
-
-
|
39
|
-
-
|
36
|
+
### v1.1.0
|
37
|
+
- Deprecated lower-case environment variables for credentials configuration
|
38
|
+
- Updated option help doc to indicate weekends and public holidays are skipped by default
|
39
|
+
- Updated required_ruby_version to be >= 2.4.0 to align with the webdrivers dependency
|
40
|
+
|
41
|
+
### v1.0.0
|
42
|
+
- Initial release
|
data/lib/kobot/engine.rb
CHANGED
@@ -100,13 +100,7 @@ module Kobot
|
|
100
100
|
Kobot.logger.info("Navigate to: #{@top_url}")
|
101
101
|
@browser.get @top_url
|
102
102
|
@wait.until { @browser.find_element(id: 'modal_window') }
|
103
|
-
|
104
|
-
@selector = if modal_title_element.text.downcase.include? 'password'
|
105
|
-
Selector.en
|
106
|
-
else
|
107
|
-
Selector.ja
|
108
|
-
end
|
109
|
-
Kobot.logger.info "Page title: #{@browser.title}"
|
103
|
+
Kobot.logger.info "Page title (before login): #{@browser.title}"
|
110
104
|
Kobot.logger.debug do
|
111
105
|
"Login with id=#{Credential.kot_id} and password=#{Credential.kot_password}"
|
112
106
|
end
|
@@ -115,8 +109,20 @@ module Kobot
|
|
115
109
|
@browser.find_element(css: 'div.btn-control-message').click
|
116
110
|
|
117
111
|
Kobot.logger.info 'Login successful'
|
118
|
-
@wait.until
|
119
|
-
|
112
|
+
clock_in_button = @wait.until { @browser.find_element(css: '.record-clock-in') }
|
113
|
+
@selector = if clock_in_button.text.include? '出勤'
|
114
|
+
Kobot.logger.info('Identify UI in Japanese')
|
115
|
+
Selector.ja
|
116
|
+
else
|
117
|
+
Kobot.logger.info('Identify UI in English')
|
118
|
+
Selector.en
|
119
|
+
end
|
120
|
+
begin
|
121
|
+
@wait.until do
|
122
|
+
@browser.find_element(id: 'notification_content').text.include?(@selector.login_success_notification_text)
|
123
|
+
end
|
124
|
+
rescue StandardError => e
|
125
|
+
Kobot.logger.warn "Failed to validate login success notification text: #{e.message}"
|
120
126
|
end
|
121
127
|
if Config.browser_geolocation
|
122
128
|
begin
|
@@ -127,7 +133,7 @@ module Kobot
|
|
127
133
|
Kobot.logger.warn "Get geolocation failed: #{e.message}"
|
128
134
|
end
|
129
135
|
end
|
130
|
-
Kobot.logger.info "Page title: #{@browser.title}"
|
136
|
+
Kobot.logger.info "Page title (after login): #{@browser.title}"
|
131
137
|
end
|
132
138
|
|
133
139
|
def logout
|
@@ -153,7 +159,7 @@ module Kobot
|
|
153
159
|
date_cell = tr.find_element(css: 'td.htBlock-scrollTable_day')
|
154
160
|
next unless date_cell.text.include? @today
|
155
161
|
|
156
|
-
Kobot.logger.info('
|
162
|
+
Kobot.logger.info('Read today record')
|
157
163
|
@kot_data = {}
|
158
164
|
@kot_data[:today] = date_cell.text
|
159
165
|
@kot_data[:today_css_class] = date_cell.attribute('class')
|
data/lib/kobot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kobot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jiang
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: webdrivers
|
@@ -93,7 +93,7 @@ metadata:
|
|
93
93
|
homepage_uri: https://github.com/yuan-jiang/kobot
|
94
94
|
source_code_uri: https://github.com/yuan-jiang/kobot
|
95
95
|
changelog_uri: https://github.com/yuan-jiang/kobot/blob/master/CHANGELOG.md
|
96
|
-
post_install_message:
|
96
|
+
post_install_message:
|
97
97
|
rdoc_options: []
|
98
98
|
require_paths:
|
99
99
|
- lib
|
@@ -108,8 +108,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
108
|
- !ruby/object:Gem::Version
|
109
109
|
version: '0'
|
110
110
|
requirements: []
|
111
|
-
rubygems_version: 3.
|
112
|
-
signing_key:
|
111
|
+
rubygems_version: 3.2.32
|
112
|
+
signing_key:
|
113
113
|
specification_version: 4
|
114
114
|
summary: Kobot automates the clock in/out of KING OF TIME.
|
115
115
|
test_files: []
|