blob: f20b6c5c938a14a1242c2a16954a7970ae8a0753 [file] [log] [blame]
// Copyright 2020 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 filemanager
import (
func init() {
Func: Smoke,
Desc: "Basic smoke test for the Files app",
Contacts: []string{
Attr: []string{"group:mainline", "informational"},
SoftwareDeps: []string{"chrome"},
Pre: chrome.LoggedIn(),
func Smoke(ctx context.Context, s *testing.State) {
cr := s.PreValue().(*chrome.Chrome)
// Setup the test file.
const textFile = "test.txt"
testFileLocation := filepath.Join(filesapp.DownloadPath, textFile)
if err := ioutil.WriteFile(testFileLocation, []byte("blahblah"), 0644); err != nil {
s.Fatalf("Creating file %s failed: %s", testFileLocation, err)
defer os.Remove(testFileLocation)
// Open the test API.
tconn, err := cr.TestAPIConn(ctx)
if err != nil {
s.Fatal("Creating test API connection failed: ", err)
defer faillog.DumpUITreeOnError(ctx, s.OutDir(), s.HasError, tconn)
// Open the Files App.
files, err := filesapp.Launch(ctx, tconn)
if err != nil {
s.Fatal("Launching the Files App failed: ", err)
if err := uiauto.Combine("open downloads and check items",
// Open the Downloads folder and check for the test file.
// Open the more menu and check for the new folder button.
files.WaitUntilExists(nodewith.Name("New folder").Role(role.MenuItem)),
)(ctx); err != nil {
s.Fatal("Failed to smoke test the Files App: ", err)