From b12ebfa0e5500e546d35820c6acc7abe541bf58f Mon Sep 17 00:00:00 2001
From: Julianna Tetreault <32834804+juliannatetreault@users.noreply.github.com>
Date: Thu, 10 Jun 2021 11:46:24 -0600
Subject: [PATCH] RFC #74, Pt. 2: Private Forem Landing Page (#13819)
* Adds landing_page checkbox for Landing Page
* Adds landing_page to page_params in Admin::Pages::Controller
* Adds landing_page to admin_manages_pages and admin_creates_pages specs
* Adjusts copy for Landing Page in pages/_form.html.erb
* Places #post_a_job before #privacy in Pages::Controller
- Ensures that all page-related methods are properly
alphabetized
* Alphabetizes remaining out-of-order page-related methods
- Ensures that all page-related methods within the
Pages::Controller are in alphabetical order, following
the order of the other methods
* Adds landing_page check to ApplicationController#verify_private_forem
* Adds a single_landing_page validation to the Page model
* Adds a lock.svg to /images and uses it in the pages index
* Adjusts buttons and checkboxes to use crayons class in pages partial
* Ensures that pages/_form.html.erb destroy button uses crayons
* Adds a landing_page validation-related test to page_spec.rb
* Updates #single_landing_page validation and error message
* WIP: Adds JS modal upon landing_page error in pages/_form.html.erb
* Adds a working modal upon error in pages/_form.html.erb
- Removes redundant #single_landing_page validation from Page
- Adds #has_a_landing_page? in place of #single_landing_page
- Conditionally renders the landing_page checkbox in _form.html.erb
- Adds styles to locked screen/landing page modal
- Adds copy to locked screen/landing page modal
- Beings adding buttons to overwrite current landing_page
* Updates the data-modal-selectors and ids in pages/_form.html.erb
* Uses #landing_page_path within pages/_form.html.erb modal
- Adds a link_to to link to the current landing page in the modal
- Adds styles to buttons and link_to in modal
* Adds back single_landing_page validation to Page.rb
* Reverts changes and updates methods within Page.rb
- Reverts changes to #single_landing_page
- Refactors #has_a_landing_page? and #landing_page_path
- Updates div id in pages/_form.html.erb
* Adjusts #single_landing_page error message slightly
* Adds a test for landing_pages in stories_index_spec.rb
* Adds an overwrite attribute to Pages for the modal in _form
- Fixes anonymous spelling
* Refactors pages/_form.html.erb and cleans up spelling
* Adds a safe operator to landing_page.path in Page
- Adjusts the placement of the hidden value in pages/_form.html.erb
* Updates styling for Current Locked Screen link
* Adds the ability to overwrite an active landing page on click
- Adds Admin::PagesController#update_and_overwrite and refactors
AdminPages::Controller#udpate to work with new method
- Adds a remote attribute, overwrite, to Admin::PagesController
via a hidden_field in pages/_form.html.erb and an attr_accessor in
the Page model
- Adds a toggleOverwrite() function to pages/_form.html.erb to
toggle the (soon to be hidden) overwrite checkbox in the form --
the checkbox is toggled on button click
* Adds a guard clause to #landing_page_path in Page.rb
* Adds a safe naviagtor to Admin::PagesController#update_and_overwrite_landing_page
* Adds a type and return to Overwrite button to prevent submit
* Adds a hidden class to the overwrite checkbox field in _form.html.erb
- Hides the overwrite checkbox since it is only used to overwrite
the landing_page boolean on click of the "Overwrite current locked
screen" button
* Adds Admin::PagesController#create_and_overwrite and removes hidden class
* Adds landing page-related tests to admin_manages_pages_spec.rb
* Remove messy commented out code and place it in GH comment instead
* PR Review Feedback: Renames remote attr, defines class methods, updates views
- Renames remote attribute to overwrite_landing_page
- Updates all necessary views, methods, etc. w/ new attr
- Defines two class methods to make code more extensible
- Updates all necessary views, methods, etc. w/ new methods
* Remove unnecessary comments and revert changes to ternary in _form.html.erb
* Adjustments for accessibility within _form and index
- Adds a descriptive id to
in _form.html.erb
- Adds an ariadescribedby field to _form.html.erb
- Adjusts title within index.html.erb
* Refactors landing_page-related code per PR review requests
- Adds a landing_page_modal_controller.js that handles
and further customizes the dismiss and overwrite button, and
handles opening the modal
- Adds a _landing_page_modal partial to extract modal-specific
html outside of the _form.html.erb partial
- Refactors _form.html.erb to account for the _landing_page_modal
partial and the landing_page_modal_controller.js
- Refactors the overwrite checkbox to be a hidden_field rather than
a hidden checkbox and removes existing hidden_field to accomodate it
- Loads the @landing_page within Admin::PagesController#edit for
use by the _landing_page_modal.html.erb partial
- Refactors Page#single_landing_page to be more readable
- Removes useless JS from _form.html.erb
* Removes #landing_page_exists? class method since it isnt used now
* Uses the #landing_page class method within ApplicationController
* Removes pending status from test in admin_manages_pages_spec.rb
* Adds an e2e test for landing pages and adds to seeds_e2e
- Adds a landingPage.spec.js to test landing pages
- Adds a Page to seeds_e2e.rb for landingPage.spec.js
* Removes references to articles from e2e test and adds clickable link
* Adds another Page to seeds_e2e.rb and updates link names in test
* Adds the Current Locked Screen title to modal and opens in new link
* Renames Dismiss to Cancel and updates all necessary code
* Adjusts landingPage.spec.js
* check for existing landing page before showing modal
* Update Cypress tests and fix bug in LandingPageModalController
* Apply suggestions from code review
Co-authored-by: Suzanne Aitchison
* Orders Pages by created_at desc in /admin/pages/index.html.erb for consistency
* Targets specific edit button in landingPage.spec.js
Co-authored-by: Suzanne Aitchison
Co-authored-by: rhymes
---
app/assets/images/lock.svg | 3 +
app/controllers/admin/pages_controller.rb | 39 ++++-
app/controllers/application_controller.rb | 4 +
app/controllers/pages_controller.rb | 26 ++--
.../landing_page_modal_controller.js | 26 ++++
app/models/page.rb | 18 +++
app/views/admin/pages/_form.html.erb | 37 ++++-
.../admin/pages/_landing_page_modal.html.erb | 18 +++
app/views/admin/pages/index.html.erb | 5 +-
.../adminFlows/pages/landingPage.spec.js | 139 ++++++++++++++++++
spec/models/page_spec.rb | 7 +
spec/requests/stories_index_spec.rb | 8 +
spec/support/seeds/seeds_e2e.rb | 15 ++
.../admin/admin_creates_new_page_spec.rb | 1 +
spec/system/admin/admin_manages_pages_spec.rb | 36 ++++-
15 files changed, 355 insertions(+), 27 deletions(-)
create mode 100644 app/assets/images/lock.svg
create mode 100644 app/javascript/admin/controllers/landing_page_modal_controller.js
create mode 100644 app/views/admin/pages/_landing_page_modal.html.erb
create mode 100644 cypress/integration/adminFlows/pages/landingPage.spec.js
diff --git a/app/assets/images/lock.svg b/app/assets/images/lock.svg
new file mode 100644
index 000000000..c614a38db
--- /dev/null
+++ b/app/assets/images/lock.svg
@@ -0,0 +1,3 @@
+
diff --git a/app/controllers/admin/pages_controller.rb b/app/controllers/admin/pages_controller.rb
index 5a52ce503..19c54438e 100644
--- a/app/controllers/admin/pages_controller.rb
+++ b/app/controllers/admin/pages_controller.rb
@@ -3,13 +3,14 @@ module Admin
layout "admin"
def index
- @pages = Page.all
+ @pages = Page.all.order(created_at: :desc)
@code_of_conduct = Page.find_by(slug: "code-of-conduct")
@privacy = Page.find_by(slug: "privacy")
@terms = Page.find_by(slug: "terms")
end
def new
+ @landing_page = Page.find_by(landing_page: true)
if (slug = params[:slug])
prepopulate_new_form(slug)
else
@@ -19,13 +20,12 @@ module Admin
def edit
@page = Page.find(params[:id])
+ @landing_page = Page.find_by(landing_page: true)
end
def update
@page = Page.find(params[:id])
- @page.assign_attributes(page_params)
- if @page.valid?
- @page.update!(page_params)
+ if update_and_overwrite_landing_page
flash[:success] = "Page has been successfully updated."
redirect_to admin_pages_path
else
@@ -36,8 +36,7 @@ module Admin
def create
@page = Page.new(page_params)
- if @page.valid?
- @page.save!
+ if create_and_overwrite_landing_page
flash[:success] = "Page has been successfully created."
redirect_to admin_pages_path
else
@@ -57,7 +56,7 @@ module Admin
def page_params
allowed_params = %i[title slug body_markdown body_html body_json description template is_top_level_path
- social_image]
+ social_image landing_page overwrite_landing_page]
params.require(:page).permit(allowed_params)
end
@@ -96,5 +95,31 @@ module Admin
Page.new
end
end
+
+ def update_and_overwrite_landing_page
+ if page_params["overwrite_landing_page"] == "true"
+ Page.transaction do
+ current_landing_page = Page.find_by(landing_page: true)
+ current_landing_page&.update(landing_page: false)
+
+ @page.update(page_params)
+ end
+ else
+ @page.update(page_params)
+ end
+ end
+
+ def create_and_overwrite_landing_page
+ if page_params["overwrite_landing_page"] == "true"
+ Page.transaction do
+ current_landing_page = Page.find_by(landing_page: true)
+ current_landing_page&.update(landing_page: false)
+
+ @page.save
+ end
+ else
+ @page.save
+ end
+ end
end
end
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 65b96c532..770c55134 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -54,8 +54,12 @@ class ApplicationController < ActionController::Base
return if self.class.module_parent.to_s == "Admin"
return if user_signed_in? || Settings::UserExperience.public
+ @page = Page.landing_page
+
if api_action?
authenticate!
+ elsif @page
+ render template: "pages/show"
else
@user ||= User.new
render template: "devise/registrations/new"
diff --git a/app/controllers/pages_controller.rb b/app/controllers/pages_controller.rb
index 53c2dac86..6f46d6cf2 100644
--- a/app/controllers/pages_controller.rb
+++ b/app/controllers/pages_controller.rb
@@ -22,6 +22,12 @@ class PagesController < ApplicationController
set_surrogate_key_header "about_listings_page"
end
+ def badge
+ @html_variant = HtmlVariant.find_for_test([], "badge_landing_page")
+ render layout: false
+ set_surrogate_key_header "badge_page"
+ end
+
def bounty
@page = Page.find_by(slug: "security")
render :show if @page
@@ -52,22 +58,16 @@ class PagesController < ApplicationController
set_surrogate_key_header "faq_page"
end
- def privacy
- @page = Page.find_by(slug: "privacy")
- render :show if @page
- set_surrogate_key_header "privacy_page"
- end
-
def post_a_job
@page = Page.find_by(slug: "post-a-job")
render :show if @page
set_surrogate_key_header "post_a_job_page"
end
- def terms
- @page = Page.find_by(slug: "terms")
+ def privacy
+ @page = Page.find_by(slug: "privacy")
render :show if @page
- set_surrogate_key_header "terms_page"
+ set_surrogate_key_header "privacy_page"
end
def tag_moderation
@@ -76,10 +76,10 @@ class PagesController < ApplicationController
set_surrogate_key_header "tag_moderation_page"
end
- def badge
- @html_variant = HtmlVariant.find_for_test([], "badge_landing_page")
- render layout: false
- set_surrogate_key_header "badge_page"
+ def terms
+ @page = Page.find_by(slug: "terms")
+ render :show if @page
+ set_surrogate_key_header "terms_page"
end
def report_abuse
diff --git a/app/javascript/admin/controllers/landing_page_modal_controller.js b/app/javascript/admin/controllers/landing_page_modal_controller.js
new file mode 100644
index 000000000..5480e7b66
--- /dev/null
+++ b/app/javascript/admin/controllers/landing_page_modal_controller.js
@@ -0,0 +1,26 @@
+import ModalController from './modal_controller';
+
+export default class LandingPageModalController extends ModalController {
+ static targets = ['overwrite', 'landingPageCheckbox'];
+
+ openModal() {
+ if (this.landingPageCheckboxTarget.checked) {
+ this.toggleModal();
+ }
+ }
+
+ confirm(event) {
+ event.preventDefault();
+
+ this.overwriteTarget.value = true;
+ this.closeModal();
+ }
+
+ cancel(event) {
+ event.preventDefault();
+
+ this.landingPageCheckboxTarget.checked = false;
+ this.overwriteTarget.value = false;
+ this.closeModal();
+ }
+}
diff --git a/app/models/page.rb b/app/models/page.rb
index 2dcaf5774..ac0eff45b 100644
--- a/app/models/page.rb
+++ b/app/models/page.rb
@@ -1,4 +1,6 @@
class Page < ApplicationRecord
+ attr_accessor :overwrite_landing_page
+
TEMPLATE_OPTIONS = %w[contained full_within_layout json].freeze
validates :title, presence: true
@@ -7,6 +9,7 @@ class Page < ApplicationRecord
validates :template, inclusion: { in: TEMPLATE_OPTIONS }
validate :body_present
validate :unique_slug_including_users_and_orgs, if: :slug_changed?
+ validate :single_landing_page, if: :will_save_change_to_landing_page?
before_validation :set_default_template
before_save :evaluate_markdown
@@ -23,6 +26,10 @@ class Page < ApplicationRecord
"page_#{slug}"
end
+ def self.landing_page
+ find_by(landing_page: true)
+ end
+
private
def evaluate_markdown
@@ -56,6 +63,17 @@ class Page < ApplicationRecord
errors.add(:slug, "is taken.")
end
+ def single_landing_page
+ # Only add errors if we are trying to modify a landing page
+ # while another landing page is already being used to ensure
+ # that only one can be set to "true" at a time.
+
+ landing_page = Page.where.not(id: id).find_by(landing_page: true)
+ return unless landing_page
+
+ errors.add(:base, "Only one page at a time can be used as a 'locked screen.'")
+ end
+
def bust_cache
Pages::BustCacheWorker.perform_async(slug)
end
diff --git a/app/views/admin/pages/_form.html.erb b/app/views/admin/pages/_form.html.erb
index 89ef86d99..9077fa04a 100644
--- a/app/views/admin/pages/_form.html.erb
+++ b/app/views/admin/pages/_form.html.erb
@@ -1,4 +1,9 @@
-
diff --git a/cypress/integration/adminFlows/pages/landingPage.spec.js b/cypress/integration/adminFlows/pages/landingPage.spec.js
new file mode 100644
index 000000000..c254e9508
--- /dev/null
+++ b/cypress/integration/adminFlows/pages/landingPage.spec.js
@@ -0,0 +1,139 @@
+describe('Set a landing page from the admin portal', () => {
+ beforeEach(() => {
+ cy.testSetup();
+ cy.fixture('users/adminUser.json').as('user');
+
+ cy.get('@user').then((user) => {
+ cy.loginUser(user).then(() => {
+ cy.visit('/admin/customization/pages');
+ });
+ });
+ });
+
+ it('should set a landing page when no other landing page exists', () => {
+ cy.findAllByRole('link', { name: 'Edit' }).first().click();
+ cy.findByRole('checkbox', { name: "Use as 'Locked Screen'" }).check();
+ cy.findByRole('button', { name: 'Update Page' }).click();
+
+ // Verify that the form has submitted and the page has changed to the confirmation page
+ cy.url().should('contain', '/admin/customization/pages');
+
+ cy.findByRole('img', { name: 'Current locked screen' }).should(
+ 'be.visible',
+ );
+ });
+
+ it('should overwrite the landing page when choosing to set a new landing page', () => {
+ cy.findAllByRole('link', { name: 'Edit' }).first().click();
+ cy.findByRole('checkbox', { name: "Use as 'Locked Screen'" });
+ // Set landing page
+ cy.findByRole('main').within(() => {
+ cy.findByRole('checkbox', { name: "Use as 'Locked Screen'" }).check();
+
+ cy.findByRole('button', { name: 'Update Page' }).click();
+ });
+ cy.url().should('contain', '/admin/customization/pages');
+ // Retrieve the title of the landing page
+ let landingPageTitle;
+ cy.findByRole('main').within(() => {
+ cy.findAllByTestId('page').should((elements) => {
+ for (let i = elements.length - 1; i >= 0; i--) {
+ const el = elements[i];
+ const isLandingPage =
+ el.getElementsByClassName('crayons-icon').length > 0;
+ if (isLandingPage) {
+ landingPageTitle = el.querySelector('a').innerHTML;
+ }
+ }
+ });
+
+ cy.findAllByRole('link', { name: 'Edit' }).eq(1).click();
+ });
+ cy.findByRole('checkbox', { name: "Use as 'Locked Screen'" });
+ // Change landing page
+ cy.findByRole('main').within(() => {
+ cy.findByRole('checkbox', { name: "Use as 'Locked Screen'" }).check();
+
+ cy.findAllByRole('button', {
+ name: 'Overwrite current locked screen',
+ }).click();
+
+ cy.findByRole('button', { name: 'Update Page' }).click();
+ });
+
+ // Check the title of the landing page has changed
+ cy.findByRole('main').within(() => {
+ let newLandingPageTitle;
+ cy.findAllByTestId('page').should((elements) => {
+ for (let i = elements.length - 1; i >= 0; i--) {
+ const el = elements[i];
+ const isLandingPage =
+ el.getElementsByClassName('crayons-icon').length > 0;
+ if (isLandingPage) {
+ newLandingPageTitle = el.querySelector('a').innerHTML;
+ }
+ }
+
+ assert.notEqual(landingPageTitle, newLandingPageTitle);
+ });
+ });
+ });
+
+ it('should not change the landing page when clicking cancel', () => {
+ cy.findAllByRole('link', { name: 'Edit' }).first().click();
+
+ // Set landing page
+ cy.findByRole('main').within(() => {
+ cy.findAllByRole('checkbox', { name: "Use as 'Locked Screen'" })
+ .first()
+ .check();
+
+ cy.findAllByRole('button', { name: 'Update Page' }).first().click();
+ });
+
+ // Retrieve the title of the landing page
+ let landingPageTitle;
+ cy.findByRole('main').within(() => {
+ cy.findAllByTestId('page').should((elements) => {
+ for (let i = elements.length - 1; i >= 0; i--) {
+ const el = elements[i];
+ const isLandingPage =
+ el.getElementsByClassName('crayons-icon').length > 0;
+ if (isLandingPage) {
+ landingPageTitle = el.querySelector('a').innerHTML;
+ }
+ }
+ });
+
+ cy.findAllByRole('link', { name: 'Edit' }).eq(1).click();
+ });
+
+ // Change landing page but then Cancel
+ cy.findByRole('main').within(() => {
+ cy.findAllByRole('checkbox', { name: "Use as 'Locked Screen'" })
+ .first()
+ .check();
+
+ cy.findAllByRole('button', { name: 'Cancel' }).first().click();
+
+ cy.findAllByRole('button', { name: 'Update Page' }).first().click();
+ });
+
+ // Check the title of the landing page has not changed
+ cy.findByRole('main').within(() => {
+ let newLandingPageTitle;
+ cy.findAllByTestId('page').should((elements) => {
+ for (let i = elements.length - 1; i >= 0; i--) {
+ const el = elements[i];
+ const isLandingPage =
+ el.getElementsByClassName('crayons-icon').length > 0;
+ if (isLandingPage) {
+ newLandingPageTitle = el.querySelector('a').innerHTML;
+ }
+ }
+
+ assert.equal(landingPageTitle, newLandingPageTitle);
+ });
+ });
+ });
+});
diff --git a/spec/models/page_spec.rb b/spec/models/page_spec.rb
index 828cdb3c4..b589cd72e 100644
--- a/spec/models/page_spec.rb
+++ b/spec/models/page_spec.rb
@@ -36,6 +36,13 @@ RSpec.describe Page, type: :model do
expect(page).not_to be_valid
expect(page.errors[:slug].to_s.include?("taken")).to be true
end
+
+ it "only allows a single landing_page to be set to true" do
+ create(:page, landing_page: true)
+ page = build(:page, landing_page: true)
+ expect(page).not_to be_valid
+ expect(page.errors[:base].to_s.include?("Only one page")).to be true
+ end
end
context "when callbacks are triggered before save" do
diff --git a/spec/requests/stories_index_spec.rb b/spec/requests/stories_index_spec.rb
index 240070ccb..44be8389a 100644
--- a/spec/requests/stories_index_spec.rb
+++ b/spec/requests/stories_index_spec.rb
@@ -49,6 +49,14 @@ RSpec.describe "StoriesIndex", type: :request do
expect(response.body).to include("Continue with")
end
+ it "renders a landing page if one is active and if the site config is set to private" do
+ allow(Settings::UserExperience).to receive(:public).and_return(false)
+ create(:page, title: "This is a landing page!", landing_page: true)
+
+ get root_path
+ expect(response.body).to include("This is a landing page!")
+ end
+
it "renders all display_ads when published and approved" do
org = create(:organization)
ad = create(:display_ad, published: true, approved: true, organization: org)
diff --git a/spec/support/seeds/seeds_e2e.rb b/spec/support/seeds/seeds_e2e.rb
index de52c53fa..0943f6d51 100644
--- a/spec/support/seeds/seeds_e2e.rb
+++ b/spec/support/seeds/seeds_e2e.rb
@@ -230,3 +230,18 @@ seeder.create_if_none(Badge) do
rewarding_context_message_markdown: Faker::Markdown.random,
)
end
+
+##############################################################################
+
+seeder.create_if_none(Page) do
+ 2.times do
+ Page.create!(
+ slug: Faker::Lorem.word,
+ body_html: "
#{Faker::Hipster.paragraph(sentence_count: 2)}
",
+ title: "#{Faker::Lorem.word} #{rand(100)}",
+ description: "A test page",
+ is_top_level_path: true,
+ landing_page: false,
+ )
+ end
+end
diff --git a/spec/system/admin/admin_creates_new_page_spec.rb b/spec/system/admin/admin_creates_new_page_spec.rb
index 63415c4c5..36892a2ab 100644
--- a/spec/system/admin/admin_creates_new_page_spec.rb
+++ b/spec/system/admin/admin_creates_new_page_spec.rb
@@ -13,6 +13,7 @@ RSpec.describe "Admin creates new page", type: :system do
expect(find_field("page[title]").value).to eq("Code of Conduct")
expect(find_field("page[slug]").value).to eq("code-of-conduct")
expect(find_field("page[is_top_level_path]").value).to eq("1")
+ expect(find_field("page[landing_page]").value).to eq("1")
text = "All participants of #{community_name} are expected to abide by our Code of Conduct"
expect(find_field("page[body_html]").value).to include(text)
diff --git a/spec/system/admin/admin_manages_pages_spec.rb b/spec/system/admin/admin_manages_pages_spec.rb
index 072dcface..636283dfc 100644
--- a/spec/system/admin/admin_manages_pages_spec.rb
+++ b/spec/system/admin/admin_manages_pages_spec.rb
@@ -9,7 +9,8 @@ RSpec.describe "Admin manages pages", type: :system do
body_html: "
hello there
",
title: "Test Page",
description: "A test page",
- is_top_level_path: true)
+ is_top_level_path: true,
+ landing_page: false)
sign_in admin
visit admin_pages_path
end
@@ -111,4 +112,37 @@ RSpec.describe "Admin manages pages", type: :system do
end
end
end
+
+ describe "when there is a landing page" do
+ let(:current_landing_page) { create(:page, landing_page: true) }
+ let(:new_landing_page) { create(:page, landing_page: true) }
+
+ it "allows a landing page to be updated", :aggregate_failures do
+ visit edit_admin_page_path(current_landing_page.id)
+ expect(page).to have_content("Use as 'Locked Screen")
+ uncheck "Use as 'Locked Screen'"
+ click_on("Update Page")
+ expect(page).to have_current_path(admin_pages_path)
+ end
+
+ it "allows an Admin to click through to the current landing page via the modal", :aggregate_failures do
+ visit edit_admin_page_path(new_landing_page.id)
+ expect(page).to have_content("Use as 'Locked Screen")
+ check "Use as 'Locked Screen'"
+ expect(page).to have_link("Current Locked Screen: #{new_landing_page.title}")
+ click_on("Current Locked Screen")
+ expect(page).to have_current_path(new_landing_page.path)
+ expect(page).to have_content(new_landing_page.title)
+ end
+
+ it "allows an Admin to overwrite the current landing page via the checkbox and modal", :aggregate_failures do
+ visit edit_admin_page_path(new_landing_page.id)
+ expect(page).to have_content("Use as 'Locked Screen")
+ check "Use as 'Locked Screen'"
+ expect(page).to have_link("Current Locked Screen: #{new_landing_page.title}")
+ click_on("Overwrite current locked screen")
+ click_on("Update Page")
+ expect(page).to have_current_path(admin_pages_path)
+ end
+ end
end