agilibox 1.5.0 → 1.5.1

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
  SHA256:
3
- metadata.gz: 78700a2b997a191955b808d5661084cc2b3f7f60099607bf687463a7586193b1
4
- data.tar.gz: 8f89357d1b2f33e0e0f5bc618657c828b8116f137ddb4ca4836f1b662bee8fa0
3
+ metadata.gz: 6816dbbaf43c1bd973d1509d85bb41b39e7180e419d38bf0e598b8dbc299693e
4
+ data.tar.gz: 591b5df80fd7381038bf77c4c2b98d78aee43fb630e82d0465cb0862dccbfc5e
5
5
  SHA512:
6
- metadata.gz: 1d79b5cbe922710c8ab5ce660dded77721635ae703e941029f8273a25a06ce52b257ff7c5070f8ee84eef99a53fae638b6dc016d024235e9f96617c682f19b36
7
- data.tar.gz: e584536c5140385a38521dd2e79ef89cdcd859d7704ee9e9ef8e5b313a00fb988edde5f27f99276751f09807312af6fd58f7e24c15a53168a9c4055212d9f01e
6
+ metadata.gz: 45ce47dab3e6a3fd8bb849b26606ac0bfaf32c3e577433b5934b8f487476774a3df8b21840db4066bd79c6b4c7bd00b1439aa0b9a9535757a39d29e241f9873a
7
+ data.tar.gz: 7ab726e1fffb09a10956bacdfabb28486ae2275cbd5730433d45d1e38d163a1cbd5a3b1204ce5e453ee48608ee6c4168950c6a26d12be51adbd944ae4b2f28b0
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Next version
4
4
 
5
+ ## 1.5.1
6
+ - Add CSS helpers
7
+ - Add Cucumber common steps
8
+ - Add Cucumber select2 helper
9
+
5
10
  ## 1.5.0
6
11
  - Add `GetHTTP`
7
12
  - Add BS4 search form
@@ -0,0 +1,2 @@
1
+ .actions.top
2
+ text-align: right
@@ -1,7 +1,10 @@
1
+ @import agilibox/actions
1
2
  @import agilibox/buttons
2
3
  @import agilibox/filters
3
4
  @import agilibox/flash
4
5
  @import agilibox/forms
6
+ @import agilibox/icons
5
7
  @import agilibox/modals
6
8
  @import agilibox/pagination
7
9
  @import agilibox/print
10
+ @import agilibox/tables
@@ -6,3 +6,6 @@
6
6
  // .btn-default has been removed in Bootstrap 4
7
7
  .btn-default
8
8
  @extend .btn-outline-primary !optional
9
+
10
+ .btn + .btn
11
+ margin-left: 0.5em
@@ -19,3 +19,13 @@
19
19
  height: 0
20
20
  width: 0
21
21
  visibility: hidden
22
+
23
+ form.search
24
+ max-width: 20em
25
+ margin-left: auto
26
+
27
+ .form-actions
28
+ text-align: center
29
+ margin-top: 45px
30
+ padding-top: 15px
31
+ border-top: 1px solid #ccc
@@ -0,0 +1,5 @@
1
+ .fa,
2
+ .fab,
3
+ .far,
4
+ .fas,
5
+ @extend .fa-fw
@@ -4,3 +4,10 @@
4
4
 
5
5
  li
6
6
  display: inline-block
7
+
8
+ .pagination
9
+ li
10
+ @extend .page-item !optional
11
+
12
+ a
13
+ @extend .page-link !optional
@@ -0,0 +1,26 @@
1
+ table.default
2
+ @extend .table
3
+ @extend .table-bordered
4
+ @extend .table-hover
5
+
6
+ th.actions,
7
+ td.actions,
8
+ width: 5em
9
+ white-space: nowrap
10
+ text-align: center
11
+
12
+ th
13
+ text-align: center
14
+ vertical-align: middle !important
15
+
16
+ td[class*="date"]
17
+ width: 8em
18
+ text-align: center
19
+
20
+ td[class*="count"],
21
+ width: 1em
22
+ text-align: center
23
+
24
+ td[class*="total"],
25
+ td[class*="amount"],
26
+ text-align: right
@@ -25,7 +25,7 @@ class << Agilibox::CucumberConfig = Class.new
25
25
 
26
26
  def require_all_helpers!
27
27
  files = Dir.glob Agilibox::Engine.root.join("lib", "agilibox", "cucumber_helpers", "*.rb")
28
- files.delete_if { |f| f.match?(/poltergeist|chrome/) }
28
+ files.delete_if { |f| f.match?(/poltergeist|chrome|_steps/) }
29
29
  files.each { |file| require file }
30
30
  end
31
31
 
@@ -36,4 +36,8 @@ class << Agilibox::CucumberConfig = Class.new
36
36
  def require_chrome_headless!
37
37
  require Agilibox::Engine.root.join("lib", "agilibox", "cucumber_helpers", "chrome_headless.rb")
38
38
  end
39
+
40
+ def require_common_steps!
41
+ require Agilibox::Engine.root.join("lib", "agilibox", "cucumber_helpers", "common_steps.rb")
42
+ end
39
43
  end
@@ -0,0 +1,135 @@
1
+ # Clicks
2
+
3
+ When("I click on {string}") do |text|
4
+ click_on text
5
+ end
6
+
7
+ When("I click on first {string}") do |text|
8
+ expect(page).to have_content(text)
9
+ all("a, button, label", text: text).first.click
10
+ end
11
+
12
+ When("I click on last {string}") do |text|
13
+ expect(page).to have_content(text)
14
+ all("a, button, label", text: text).last.click
15
+ end
16
+
17
+ When("I click on {string} element") do |selector|
18
+ find(selector).click
19
+ end
20
+
21
+ When("I click on first {string} element") do |selector|
22
+ expect(page).to have_selector(selector)
23
+ all(selector).first.click
24
+ end
25
+
26
+ When("I click on last {string} element") do |selector|
27
+ expect(page).to have_selector(selector)
28
+ all(selector).last.click
29
+ end
30
+
31
+ # Routes
32
+
33
+ When("I go on the {string} page") do |route_name|
34
+ path = main_app.public_send("#{route_name}_path")
35
+ visit path
36
+ end
37
+
38
+ Then("I am on the {string} page") do |route_name|
39
+ path = main_app.public_send("#{route_name}_path")
40
+ wait_for { current_path }.to eq path
41
+ end
42
+
43
+ # Contents
44
+
45
+ Then("I see {string}") do |text|
46
+ expect(page).to have_content(text)
47
+ end
48
+
49
+ Then("I do not see {string}") do |text|
50
+ expect(page).to have_no_content(text)
51
+ end
52
+
53
+ Then("I see {string} element") do |selector|
54
+ expect(page).to have_selector(selector)
55
+ end
56
+
57
+ Then("I do not see {string} element") do |selector|
58
+ expect(page).to have_no_selector(selector)
59
+ end
60
+
61
+ Then("I see {int} times {string} element") do |count, selector|
62
+ expect(page).to have_selector(selector, count: count)
63
+ end
64
+
65
+ Then("I see {string} in modal") do |text|
66
+ expect(find("#modal")).to have_content(text)
67
+ end
68
+
69
+ Then("I see {string} element in modal") do |selector|
70
+ expect(find("#modal")).to have_selector(selector)
71
+ end
72
+
73
+ Then("I see {string} out of modal") do |text|
74
+ expect(page).to have_no_selector("#modal")
75
+ expect(page).to have_content(text)
76
+ end
77
+
78
+ Then("I see {string} element out of modal") do |selector|
79
+ expect(page).to have_no_selector("#modal")
80
+ expect(page).to have_selector(selector)
81
+ end
82
+
83
+ # Forms
84
+
85
+ When("I fill in {string} with {string}") do |id, value|
86
+ fill_in id, with: value
87
+ end
88
+
89
+ When("I select {string}") do |value|
90
+ select value
91
+ end
92
+
93
+ When("I select {string} from {string}") do |value, from|
94
+ select value, from: from
95
+ end
96
+
97
+ When(/^I select2 "([^"]*)" from "([^"]*)"$/) do |value, selector|
98
+ select2(selector, value)
99
+ end
100
+
101
+ When("I fill in {string} with {string} file") do |id, file|
102
+ expect(page).to have_selector(".form-group.file", visible: :all)
103
+
104
+ evaluate_script %(
105
+ $(".form-group.file").css("display", "block")
106
+ )
107
+
108
+ attach_file id, Rails.root.join("spec", "fixtures", file)
109
+ end
110
+
111
+ When("I search {string}") do |q|
112
+ fill_in :q, with: q
113
+ find(".search-submit").click
114
+ end
115
+
116
+ # Emails
117
+
118
+ Given("I clean my mailbox") do
119
+ email_deliveries.clear
120
+ end
121
+
122
+ Then(/I have (\d+) emails?/) do |count|
123
+ expect(email_deliveries.count).to eq count
124
+ end
125
+
126
+ # Factories
127
+
128
+ Given("an existing {string}") do |factory|
129
+ instance_variable_set "@#{factory}", create(factory)
130
+ end
131
+
132
+ Given("I am a signed in {string}") do |factory|
133
+ @user = create(factory) # rubocop:disable Rails/SaveBang
134
+ sign_in @user
135
+ end
@@ -1,10 +1,23 @@
1
1
  module CapybaraSelect2
2
- def select2(selector, query, label = query)
3
- selector = "##{selector}" if selector.is_a?(Symbol)
4
- find("#{selector} + .select2-container").click
2
+ def select2_search(id, query)
3
+ find("##{id} + .select2-container").click
5
4
  find(".select2-search__field").set(query.to_s)
5
+ end
6
+
7
+ def select2(id, query, label = query)
8
+ select2_search(id, query)
6
9
  find(".select2-results li", text: label.to_s).click
7
10
  end
11
+
12
+ def select2_expect_have_result(id, query, label = query)
13
+ select2_search(id, query)
14
+ expect(page).to have_selector(".select2-results li", text: label.to_s)
15
+ end
16
+
17
+ def select2_expect_have_no_result(id, query, label = query)
18
+ select2_search(id, query)
19
+ expect(page).to have_no_selector(".select2-results li", text: label.to_s)
20
+ end
8
21
  end
9
22
 
10
23
  World(CapybaraSelect2)
@@ -1,3 +1,3 @@
1
1
  module Agilibox
2
- VERSION = "1.5.0"
2
+ VERSION = "1.5.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: agilibox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - agilidée
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-28 00:00:00.000000000 Z
11
+ date: 2018-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails-i18n
@@ -70,14 +70,17 @@ files:
70
70
  - app/assets/javascripts/agilibox/form_anchor_referer.coffee
71
71
  - app/assets/javascripts/agilibox/form_reset.coffee
72
72
  - app/assets/javascripts/agilibox/modals.coffee
73
+ - app/assets/stylesheets/agilibox/actions.sass
73
74
  - app/assets/stylesheets/agilibox/all.sass
74
75
  - app/assets/stylesheets/agilibox/buttons.sass
75
76
  - app/assets/stylesheets/agilibox/filters.sass
76
77
  - app/assets/stylesheets/agilibox/flash.sass
77
78
  - app/assets/stylesheets/agilibox/forms.sass
79
+ - app/assets/stylesheets/agilibox/icons.sass
78
80
  - app/assets/stylesheets/agilibox/modals.sass
79
81
  - app/assets/stylesheets/agilibox/pagination.sass
80
82
  - app/assets/stylesheets/agilibox/print.sass
83
+ - app/assets/stylesheets/agilibox/tables.sass
81
84
  - app/controllers/agilibox/application_controller.rb
82
85
  - app/controllers/agilibox/small_data/filters_controller.rb
83
86
  - app/controllers/concerns/agilibox/api_controller_concern.rb
@@ -167,6 +170,7 @@ files:
167
170
  - lib/agilibox/cucumber_helpers/ajax.rb
168
171
  - lib/agilibox/cucumber_helpers/capybara.rb
169
172
  - lib/agilibox/cucumber_helpers/chrome_headless.rb
173
+ - lib/agilibox/cucumber_helpers/common_steps.rb
170
174
  - lib/agilibox/cucumber_helpers/database_cleaner.rb
171
175
  - lib/agilibox/cucumber_helpers/factory_bot.rb
172
176
  - lib/agilibox/cucumber_helpers/fix_referrer.rb