code: def test_uploads_and_deletes_single_file_only(
      app: Page, assert_snapshot: ImageCompareFunction
  ):
      """Test that uploading a file for single file uploader works as expected."""
      file_name1 = "file1.txt"
      file_content1 = b"file1content"
  
      file_name2 = "file2.txt"
      file_content2 = b"file2content"
  
      uploader_index = 0
  
      with app.expect_file_chooser() as fc_info:
          app.get_by_test_id("stFileUploadDropzone").nth(
              uploader_index
          ).click()
  
      file_chooser = fc_info.value
      file_chooser.set_files(
          files=[
              {
                  "name": file_name1,
                  "mimeType": "text/plain",
                  "buffer": file_content1,
              }
          ]
      )
      wait_for_app_run(app)
      app.wait_for_timeout(1000)
  
      expect(app.locator(".uploadedFileName")).to_have_text(
          file_name1, use_inner_text=True
      )
  
      expect(
          app.get_by_test_id("stText").nth(uploader_index)
      ).to_have_text(str(file_content1), use_inner_text=True)
  
      file_uploader_uploaded_state = app.get_by_test_id(
          "stFileUploader"
      ).nth(uploader_index)
  
      assert_snapshot(
          file_uploader_uploaded_state,
          name="st_single_file_uploader-uploaded",
      )
  
      expect(
          app.get_by_test_id("stMarkdownContainer").nth(
              uploader_index + 1
          )
      ).to_have_text("True", use_inner_text=True)
  
      # Upload a second file. This one will replace the first.
      with app.expect_file_chooser() as fc_info:
          app.get_by_test_id("stFileUploadDropzone").nth(
              uploader_index
          ).click()
  
      file_chooser = fc_info.value
      file_chooser.set_files(
          files=[
              {
                  "name": file_name2,
                  "mimeType": "text/plain",
                  "buffer": file_content2,
              }
          ]
      )
  
      wait_for_app_run(app)
      app.wait_for_timeout(1000)
  
      expect(app.locator(".uploadedFileName")).to_have_text(
          file_name2, use_inner_text=True
      )
  
      expect(
          app.get_by_test_id("stText").nth(uploader_index)
      ).to_have_text(str(file_content2), use_inner_text=True)
  
      expect(
          app.get_by_test_id("stMarkdownContainer").nth(
              uploader_index + 1
          )
      ).to_have_text("True", use_inner_text=True)
  
      app.get_by_test_id("stHeader").press("r")
  
      wait_for_app_run(app)
      app.wait_for_timeout(1000)
  
      expect(
          app.get_by_test_id("stText").nth(uploader_index)
      ).to_have_text(str(file_content2), use_inner_text=True)
  
      app.get_by_test_id("fileDeleteBtn").nth(uploader_index).click()
  
      wait_for_app_run(app)
      app.wait_for_timeout(1000)
  
      expect(
          app.get_by_test_id("stText").nth(uploader_index)
      ).to_have_text("No upload", use_inner_text=True)
  
imports: from playwright.sync_api import Page, expect
  from e2e_playwright.conftest import ImageCompareFunction, wait_for_app_run
label_desc: Use image node_id 3 for calling a global function with example usage: test_uploads_and_deletes_single_file_only(app, assert_snapshot) without return types