async function pasteItem (client, type) {
  const parentFolderSelector = `.session-current .file-list.${type} .parent-file-item`
  const realFileSelector = `.session-current .file-list.${type} .real-file-item`

  // Click elsewhere to ensure the previous context menu is closed
  await client.click('.session-current .sftp-title-wrap')
  await delay(1000) // Increased delay

  // Try to right click on the parent file item first (for empty folders)
  if (await client.locator(parentFolderSelector).count() > 0) {
    await client.rightClick(parentFolderSelector, 10, 10)
  } else {
    // Fall back to real file item if parent item doesn't exist
    await client.rightClick(realFileSelector, 10, 10)
  }
  await delay(1000)

  // Wait for paste menu to be visible and enabled
  const pasteMenuItem = await client.locator('.ant-dropdown:not(.ant-dropdown-hidden) .ant-dropdown-menu-item:has-text("Paste"):not(.ant-dropdown-menu-item-disabled)')
  await pasteMenuItem.waitFor({ state: 'visible', timeout: 5000 })
  await pasteMenuItem.click()
  await delay(4000) // Increased delay for paste operation
}
Pastes an item using the context menu

@param {Object} client - The Playwright client
@param {string} type - The type of file list ('local' or 'remote')