blob: 9f58a49f986de21549b7d4a52aed03e261131f48 [file] [log] [blame]
// Copyright 2021 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Package familylink is used for writing Family Link tests.
package familylink
import (
func init() {
Func: IncognitoModeDisabled,
Desc: "Tests that incognito mode is disabled for Unicorn users",
Contacts: []string{
"", ""},
Attr: []string{"group:mainline", "informational"},
SoftwareDeps: []string{"chrome"},
Timeout: time.Minute,
Fixture: "familyLinkUnicornLogin",
func IncognitoModeDisabled(ctx context.Context, s *testing.State) {
tconn := s.FixtValue().(*familylink.FixtData).TestConn
defer faillog.DumpUITreeOnError(ctx, s.OutDir(), s.HasError, tconn)
ui := uiauto.New(tconn)
// Get the expected browser.
chromeApp, err := apps.ChromeOrChromium(ctx, tconn)
if err != nil {
s.Fatal("Could not find the Chrome app: ", err)
// Chrome app name doesn't exactly match the chrome shelf name so modify it here for simpler code later.
if chromeApp.Name == apps.Chrome.Name {
chromeApp.Name = "Google Chrome"
s.Logf("Right clicking the %s shelf app button", chromeApp.Name)
if err := uiauto.Combine(fmt.Sprintf("Right clicking the %s shelf app button", chromeApp.Name),
ui.WaitUntilExists(nodewith.Role(role.MenuItem).First()))(ctx); err != nil {
s.Fatal(fmt.Sprintf("Failed to right click the %s shelf app button: ", chromeApp.Name), err)
s.Log("Verifying the New Incognito window menu item does not exist")
if err := ui.Exists(nodewith.Name("New Incognito window").Role(role.MenuItem))(ctx); err == nil {
s.Fatal("Incognito mode detected and enabled: ", err)