Skip to content

Commit 99c066e

Browse files
authored
Merge pull request code-dot-org#24846 from code-dot-org/launch-content-mod
Image Moderation: test view more link visibility for both DCDO limited_gallery settings
2 parents 216def9 + f0ec92b commit 99c066e

File tree

3 files changed

+29
-7
lines changed

3 files changed

+29
-7
lines changed

dashboard/test/ui/features/projects/public_project_gallery_project_validator.feature

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,5 +72,6 @@ Scenario: Can See App Lab/Game Lab View More Links
7272
Then I wait until element "#public-gallery" is visible
7373
Then I wait until element ".ui-project-app-type-area" is in the DOM
7474
And the project gallery contains 7 project types
75+
And the project gallery contains 7 view more links
7576
And element ".ui-project-app-type-area:eq(4)" contains text "View more App Lab projects"
7677
And element ".ui-project-app-type-area:eq(5)" contains text "View more Game Lab projects"

dashboard/test/ui/features/projects/public_project_gallery_signed_out.feature

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ Scenario: Public Gallery Shows Expected Project Types
1919
And element ".ui-project-app-type-area:eq(5)" contains text "Game Lab"
2020
And element ".ui-project-app-type-area:eq(6)" contains text "Pre-reader"
2121

22-
Scenario: View More Links Do NOT Show for App Lab and Game Lab
22+
Scenario: View More Links for App Lab and Game Lab Based on DCDO
2323
Then I wait until element ".ui-project-app-type-area" is in the DOM
2424
And the project gallery contains 7 project types
25-
And the project gallery contains 5 view more links
26-
And element ".ui-project-app-type-area:eq(0)" contains text "View more Play Lab projects"
27-
And element ".ui-project-app-type-area:eq(4)" contains text "App Lab"
28-
And element ".ui-project-app-type-area:eq(4)" does not contain text "View more"
29-
And element ".ui-project-app-type-area:eq(5)" contains text "Game Lab"
30-
And element ".ui-project-app-type-area:eq(5)" does not contain text "View more"
25+
And I confirm correct visibility of view more links

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,29 @@
1+
require 'dynamic_config/dcdo'
2+
3+
# The "view more" links in the public project gallery for App Lab and Game Lab
4+
# are controlled by DCDO so we can quickly hide them if there are
5+
# inappropriate projects. This lets us test "view more" link
6+
# visibility without updating the tests every time we toggle the flag.
7+
And(/^I confirm correct visibility of view more links$/) do
8+
dcdo_flag = DCDO.get('image_moderation', {})['limited_project_gallery']
9+
hidden_view_more_links = dcdo_flag.nil? ? true : dcdo_flag
10+
if hidden_view_more_links
11+
steps %Q{
12+
And the project gallery contains 5 view more links
13+
And element ".ui-project-app-type-area:eq(4)" contains text "App Lab"
14+
And element ".ui-project-app-type-area:eq(4)" does not contain text "View more"
15+
And element ".ui-project-app-type-area:eq(5)" contains text "Game Lab"
16+
And element ".ui-project-app-type-area:eq(5)" does not contain text "View more"
17+
}
18+
else
19+
steps %Q{
20+
And the project gallery contains 7 view more links
21+
And element ".ui-project-app-type-area:eq(4)" contains text "View more App Lab projects"
22+
And element ".ui-project-app-type-area:eq(5)" contains text "View more Game Lab projects"
23+
}
24+
end
25+
end
26+
127
And(/^I give user "([^"]*)" project validator permission$/) do |name|
228
require_rails_env
329
user = User.find_by_email_or_hashed_email(@users[name][:email])

0 commit comments

Comments
 (0)