blob: 4587feb8d1d26bef6f6b0d79300e716ffda14d6f [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: EducoexistenceInsession,
Desc: "Checks if in-session EDU Coexistence flow is working",
Contacts: []string{"", ""},
Attr: []string{"group:mainline", "informational"},
SoftwareDeps: []string{"chrome"},
Timeout: chrome.GAIALoginTimeout + 5*time.Minute,
VarDeps: []string{"unicorn.parentUser", "unicorn.parentPassword", "unicorn.parentFirstName", "unicorn.parentLastName", "edu.user", "edu.password"},
Fixture: "familyLinkUnicornLogin",
func EducoexistenceInsession(ctx context.Context, s *testing.State) {
tconn := s.FixtValue().(*familylink.FixtData).TestConn
cr := s.FixtValue().(*familylink.FixtData).Chrome
parentUser := s.RequiredVar("unicorn.parentUser")
parentPass := s.RequiredVar("unicorn.parentPassword")
parentFirstName := s.RequiredVar("unicorn.parentFirstName")
parentLastName := s.RequiredVar("unicorn.parentLastName")
eduUser := s.RequiredVar("edu.user")
eduPass := s.RequiredVar("edu.password")
defer faillog.DumpUITreeOnError(ctx, s.OutDir(), s.HasError, tconn)
ui := uiauto.New(tconn)
s.Log("Launching the in-session Edu Coexistence flow")
if err := familylink.AddEduSecondaryAccount(ctx, cr, tconn, parentFirstName, parentLastName, parentUser, parentPass, eduUser, eduPass); err != nil {
s.Fatal("Failed to go through the in-session Edu Coexistence flow: ", err)
s.Log("Clicking next on the final page to wrap up")
schoolAccountAddedHeader := nodewith.Name("School account added").Role(role.Heading)
if err := uiauto.Combine("Clicking next button and wrapping up",
ui.LeftClickUntil(nodewith.Name("Next").Role(role.Button), ui.Gone(schoolAccountAddedHeader)))(ctx); err != nil {
s.Fatal("Failed to click next button: ", err)
s.Log("Verifying the EDU secondary account added successfully")
// There should be a "more actions" button to remove the EDU secondary account.
moreActionsButton := nodewith.Name("More actions, " + eduUser).Role(role.Button)
if err := ui.WaitUntilExists(moreActionsButton)(ctx); err != nil {
s.Fatal("Failed to detect EDU secondary account: ", err)