Add tests for mobile drawer
This commit is contained in:
parent
2782edc780
commit
427aa8794e
11 changed files with 54 additions and 27 deletions
|
|
@ -7,7 +7,7 @@
|
|||
= form_tag("/admins/stats", method: "get", class: "col-sm-12 form-inline segment-selection") do
|
||||
.col-sm-2.col-sm-push-8
|
||||
%select.form-control{name: "range"}
|
||||
- ["daily", "week", "2weeks", "month"].each do |range|
|
||||
- %w(daily week 2weeks month).each do |range|
|
||||
%option{value: range, selected: ("selected" if params[:range] == range)}
|
||||
= t(".#{range}")
|
||||
.col-sm-2.col-sm-push-8
|
||||
|
|
@ -15,15 +15,14 @@
|
|||
|
||||
.col-sm-8.col-sm-pull-4
|
||||
%h4
|
||||
!= t("admins.stats.display_results", segment: content_tag(:strong, @segment))
|
||||
!= t("admins.stats.display_results", segment: content_tag(:strong, segment))
|
||||
|
||||
.row
|
||||
- %i(posts comments aspect_memberships users).each do |name|
|
||||
- model = instance_variable_get("@#{name}")
|
||||
- if name == :aspect_memberships
|
||||
- name = t(".shares", count: model[:yesterday])
|
||||
- else
|
||||
- name = t(".#{name}", count: model[:yesterday])
|
||||
:ruby
|
||||
model = instance_variable_get("@#{name}")
|
||||
count = model[:yesterday]
|
||||
name = name == :aspect_memberships ? t(".shares", count: count) : t(".#{name}", count: count)
|
||||
|
||||
.col-md-3
|
||||
%h2{style: "font-weight:bold;"}
|
||||
|
|
@ -36,8 +35,8 @@
|
|||
.row
|
||||
%p.col-md-12.alert.alert-info.text-center{role: "alert"}
|
||||
!= t("admins.stats.current_segment",
|
||||
post_yest: content_tag(:strong, @posts[:yesterday] / @user_count.to_f),
|
||||
post_day: content_tag(:strong, @posts[:day_before] / @user_count.to_f))
|
||||
post_yest: content_tag(:strong, posts[:yesterday] / user_count),
|
||||
post_day: content_tag(:strong, posts[:day_before] / user_count))
|
||||
|
||||
.row
|
||||
.col-md-12
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@
|
|||
.row
|
||||
.col-md-12
|
||||
.alert.alert-info.text-center{role: "alert"}
|
||||
= t(".users", count: @users.count)
|
||||
= t(".users", count: nb_users)
|
||||
|
||||
.row
|
||||
.users.col-md-12
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@
|
|||
= form_tag("/admins/weekly_user_stats", method: "get", class: "form-inline week-selector row") do
|
||||
.col-xs-9.center
|
||||
= select_tag(:week,
|
||||
options_for_select(@created_users_by_week.keys.reverse, @selected_week),
|
||||
options_for_select(created_users_by_week, selected_week),
|
||||
class: "form-control")
|
||||
.col-xs-3.center
|
||||
= submit_tag t("admins.stats.go"), class: "btn btn-primary"
|
||||
|
||||
= t(".amount_of", count: @counter)
|
||||
= t(".amount_of", count: counter)
|
||||
%br
|
||||
- @created_users_by_week[@selected_week].each do |m|
|
||||
- @created_users_by_week[selected_week].each do |m|
|
||||
= link_to m, "/u/#{m}"
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@
|
|||
.col-md-3
|
||||
= render partial: "admins/admin_bar"
|
||||
.col-md-9
|
||||
= render partial: "admins/stats"
|
||||
= render partial: "admins/stats", locals: {segment: @segment, posts: @posts, user_count: @user_count.to_f}
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
= render partial: "admins/stats"
|
||||
= render partial: "admins/stats", locals: {segment: @segment, posts: @posts, user_count: @user_count.to_f}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@
|
|||
.col-md-3
|
||||
= render partial: "admins/admin_bar"
|
||||
.col-md-9
|
||||
= render partial: "admins/user_search"
|
||||
= render partial: "admins/user_search", locals: {nb_users: @users.count}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,4 @@
|
|||
.flash-message{class: "message alert alert-#{flash_class name}", role: "alert"}
|
||||
= msg
|
||||
|
||||
= render partial: "admins/user_search"
|
||||
= render partial: "admins/user_search", locals: {nb_users: @users.count}
|
||||
|
|
|
|||
|
|
@ -3,4 +3,6 @@
|
|||
.col-md-3
|
||||
= render partial: "admins/admin_bar"
|
||||
.col-md-9
|
||||
= render partial: "admins/weekly_user_stats"
|
||||
= render partial: "admins/weekly_user_stats",
|
||||
locals: {created_users_by_week: @created_users_by_week.keys.reverse,
|
||||
selected_week: @selected_week, counter: @counter}
|
||||
|
|
|
|||
|
|
@ -1 +1,2 @@
|
|||
= render partial: "admins/weekly_user_stats"
|
||||
= render partial: "admins/weekly_user_stats",
|
||||
locals: {created_users_by_week: @created_users_by_week.keys.reverse, selected_week: @selected_week, counter: @counter}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,7 @@ Feature: Navigate between pages using the header menu and the drawer
|
|||
I want to be able navigate between the pages of the mobile version
|
||||
|
||||
Background:
|
||||
Given following users exist:
|
||||
| username | email |
|
||||
| Bob Jones | bob@bob.bob |
|
||||
| Alice Smith | alice@alice.alice |
|
||||
|
||||
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||
Given a user with email "alice@alice.alice"
|
||||
And I sign in as "alice@alice.alice" on the mobile website
|
||||
|
||||
Scenario: navigate to the stream page
|
||||
|
|
@ -57,9 +52,9 @@ Feature: Navigate between pages using the header menu and the drawer
|
|||
Then I should be on the mentioned stream page
|
||||
|
||||
Scenario: navigate to aspects pages
|
||||
Given "bob@bob.bob" has a public post with text "bob's text"
|
||||
Given I have a limited post with text "Hi you!" in the aspect "Besties"
|
||||
When I open the drawer
|
||||
Then I should not see "All aspects" within "#drawer"
|
||||
And I click on "My aspects" in the drawer
|
||||
And I click on "All aspects" in the drawer
|
||||
Then I should be on the aspects page
|
||||
|
|
@ -73,6 +68,7 @@ Feature: Navigate between pages using the header menu and the drawer
|
|||
When I follow the "boss" tag
|
||||
And I go to the stream page
|
||||
And I open the drawer
|
||||
Then I should not see "All tags" within "#drawer"
|
||||
And I click on "#Followed tags" in the drawer
|
||||
And I click on "All tags" in the drawer
|
||||
Then I should be on the followed tags stream page
|
||||
|
|
@ -109,3 +105,29 @@ Feature: Navigate between pages using the header menu and the drawer
|
|||
When I open the drawer
|
||||
And I click on "Settings" in the drawer
|
||||
Then I should be on my account settings page
|
||||
|
||||
Scenario: navigate to the admin pages
|
||||
Given an admin with email "bob@bob.bob"
|
||||
And I sign in as "bob@bob.bob" on the mobile website
|
||||
When I open the drawer
|
||||
Then I should not see "Dashboard" within "#drawer"
|
||||
When I click on "Admin" in the drawer
|
||||
And I click on "Dashboard" in the drawer
|
||||
Then I should see "Pod status" within "#main h2"
|
||||
When I click on "Admin" in the drawer
|
||||
And I click on "User search" in the drawer
|
||||
Then I should see "User search" within "#main h3"
|
||||
When I click on "Admin" in the drawer
|
||||
And I click on "Weekly user stats" in the drawer
|
||||
Then I should see "Current server date is " within "#main h2"
|
||||
When I click on "Admin" in the drawer
|
||||
And I click on "Pod stats" in the drawer
|
||||
Then I should see "Usage statistics" within "#main h1"
|
||||
When I click on "Admin" in the drawer
|
||||
And I click on "Reports" in the drawer
|
||||
Then I should see "Reports overview" within "#main h1"
|
||||
When I click on "Admin" in the drawer
|
||||
And I click on "Pod network" in the drawer
|
||||
Then I should see "Pod network " within "#main h2"
|
||||
When I click on "Admin" in the drawer
|
||||
Then I should see "Sidekiq monitor" within "#drawer"
|
||||
|
|
|
|||
|
|
@ -25,6 +25,10 @@ Given /^a nsfw user with email "([^\"]*)"$/ do |email|
|
|||
user.profile.update_attributes(:nsfw => true)
|
||||
end
|
||||
|
||||
Given /^an admin with email "([^\"]*)"$/ do |email|
|
||||
user = create_user(email: email)
|
||||
Role.add_admin(user)
|
||||
end
|
||||
|
||||
Given /^(?:|[tT]hat )?following user[s]?(?: exist[s]?)?:$/ do |table|
|
||||
table.hashes.each do |hash|
|
||||
|
|
@ -38,7 +42,6 @@ Given /^(?:|[tT]hat )?following user[s]?(?: exist[s]?)?:$/ do |table|
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
Given /^I have been invited by an admin$/ do
|
||||
admin = FactoryGirl.create(:user)
|
||||
admin.invitation_code
|
||||
|
|
|
|||
Loading…
Reference in a new issue