// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
{
  // Google One Storage Management, select all items, confirm delete and navigate back.
  actions: [
    {
      // Click the checkbox next to "Showing (32)" to select all 32.
      action: click
      position: {
        required: false
        selector: input[aria-label='Select all items'][aria-labelledby]:not([disabled])
        wait: true
      }
      source: $[CLICK_INPUT_SOURCE]
      verify: "[data-is-touch-wrapper='true'] button[aria-label='Delete']:not([disabled])"
      timeout: 5s
    }
    {
      // Click the Delete button.
      action: click
      position: {
        required: false
        selector: "[data-is-touch-wrapper='true'] button[aria-label='Delete']:not([disabled])"
        wait: true
      }
      source: $[CLICK_INPUT_SOURCE]
      verify: "[aria-modal='true'][aria-label='Confirmation dialog to delete selected items'] input[type='checkbox']"
    }
    {
      // Click the "I understand that deleted items can't be recovered" checkbox.
      action: click
      position: {
        required: false
        selector: "[aria-modal='true'][aria-label='Confirmation dialog to delete selected items'] input[type='checkbox']"
        wait: true
        scroll_into_view: true
      }
      source: $[CLICK_INPUT_SOURCE]
      verify: xpath///*[@aria-modal='true'][@aria-label='Confirmation dialog to delete selected items']//button[not(@disabled)]//span[text()='Permanently delete']
      timeout: 10s
    }
    {
      // Click the "Permanently delete" button.
      action: click
      position: {
        required: false
        selector: xpath///*[@aria-modal='true'][@aria-label='Confirmation dialog to delete selected items']//button[not(@disabled)]//span[text()='Permanently delete']
        wait: true
        scroll_into_view: true
      }
      source: $[CLICK_INPUT_SOURCE]
      timeout: 10s
    }
    {
      // Close the dialog.
      action: click
      position: {
        required: false
        selector: "[aria-modal='true'][aria-label='Confirmation dialog to delete selected items'] button[aria-label='Close dialog']"
        scroll_into_view: true
        wait: true
      }
      source: $[CLICK_INPUT_SOURCE]
    }
    {
      action: wait_for_element
      selector: body:not(:has([aria-modal='true']))
      timeout: 10s
    }
    {
      // Click the go back arrow at the top to return to the Google One Storage Manager page.
      action: click
      position: {
        required: false
        selector: xpath///header[.//span[contains(text(), 'Items from Google Drive')]]//*[contains(@aria-label, 'Go back')]
        wait: true
      }
      source: $[CLICK_INPUT_SOURCE]
      verify: xpath///header[.//span[contains(text(), 'Google One Storage Manager')]]//*[contains(@aria-label, 'Go back')]
    }
  ]
}
