Skip to content

Commit c845e62

Browse files
author
Erin Peach
authored
Merge pull request code-dot-org#26913 from code-dot-org/age-restrict-applab
Age restrict Weblab
2 parents ecdbc30 + f40419c commit c845e62

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

dashboard/app/helpers/levels_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ def firebase_auth_token
769769
# @return [boolean] whether a (privacy) redirect happens.
770770
def redirect_under_13_without_tos_teacher(level)
771771
# Note that Game.applab includes both App Lab and Maker Toolkit.
772-
return false unless level.game == Game.applab || level.game == Game.gamelab
772+
return false unless level.game == Game.applab || level.game == Game.gamelab || level.game == Game.weblab
773773
return false if level.is_a? GamelabJr
774774

775775
if current_user && current_user.under_13? && current_user.terms_version.nil?

dashboard/test/ui/features/step_definitions/steps.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,8 @@ def generate_user(name)
999999
return email, password
10001000
end
10011001

1002-
def create_section_and_join_as_student(name, email, password)
1002+
def create_section_and_join_as_student(name, email, password, u13 = false)
1003+
age = u13 ? 10 : 16
10031004
individual_steps %Q{
10041005
Then I am on "http://studio.code.org/home"
10051006
And I dismiss the language selector
@@ -1016,13 +1017,13 @@ def create_section_and_join_as_student(name, email, password)
10161017
And I type "#{email}" into "#user_email"
10171018
And I type "#{password}" into "#user_password"
10181019
And I type "#{password}" into "#user_password_confirmation"
1019-
And I select the "16" option in dropdown "user_age"
1020+
And I select the "#{age}" option in dropdown "user_age"
10201021
And I click selector "input[type=submit]" once I see it
10211022
And I wait until I am on "http://studio.code.org/home"
10221023
}
10231024
end
10241025

1025-
def generate_teacher_student(name, teacher_authorized)
1026+
def generate_teacher_student(name, teacher_authorized, student_u13 = false)
10261027
email, password = generate_user(name)
10271028

10281029
steps %Q{
@@ -1032,7 +1033,7 @@ def generate_teacher_student(name, teacher_authorized)
10321033
# enroll in a plc course as a way of becoming an authorized teacher
10331034
enroll_in_plc_course(@users["Teacher_#{name}"][:email]) if teacher_authorized
10341035

1035-
create_section_and_join_as_student(name, email, password)
1036+
create_section_and_join_as_student(name, email, password, student_u13)
10361037
end
10371038

10381039
def generate_two_teachers_per_student(name, teacher_authorized)
@@ -1128,6 +1129,10 @@ def generate_two_teachers_per_student(name, teacher_authorized)
11281129
generate_teacher_student(name, false)
11291130
end
11301131

1132+
And(/^I create a teacher-associated under-13 student named "([^"]*)"$/) do |name|
1133+
generate_teacher_student(name, false, true)
1134+
end
1135+
11311136
And(/^I create two teachers associated with a student named "([^"]*)"$/) do |name|
11321137
generate_two_teachers_per_student(name, false)
11331138
end
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Feature: Weblab Too Young
2+
3+
@as_young_student
4+
Scenario: Weblab Redirected
5+
Given I am on "http://studio.code.org/projects/weblab/new"
6+
Then I wait until I am on "http://studio.code.org/home"
7+
And element ".alert-danger" contains text "This content has age restrictions in place"
8+
9+
Scenario: Weblab Allowed for Student in Teacher's Section
10+
Given I create a teacher-associated under-13 student named "Hermione"
11+
And I am on "http://studio.code.org/projects/weblab/new"
12+
And I wait until element "#workspace-header" is visible
13+
And I am on "http://studio.code.org/projects/weblab/new"

0 commit comments

Comments
 (0)