Skip to main content

Handling file uploads in TinyMCE

This document explains:

  • How TrueTest captures an upload action inside a TinyMCE editor
  • How to configure the generated test case to ensure the upload works correctly during automated execution.

How TrueTest captures TinyMCE Upload Actions​

When a user performs an upload inside a TinyMCE editor, TrueTest captures the upload action targeting TinyMCE’s file input element.

When generating the automated test case:

  1. The uploaded file is inserted using the WebUI.uploadFile keyword
  2. A Test Case variable (e.g., input_fileUpload) is created for the file path

Example script

"Step 1: Enter input value in div textEditor"
TrueTestScripts.setTinyMCEContent(findTestObject('AI-Generated/TI/Page_customer_support_request_form/tinyMCE'),
tinyMCEcontent
)

"Step 2: Enter input value in input fileUpload"
WebUI.uploadFile(findTestObject('AI-Generated/TI/Page_customer_support_request_form/input_fileUpload'),
input_fileUpload
)

Configure the absolute file path​

Because Katalon requires absolute paths for the uploadFile keyword, you need to manually set the value before running the test.

  1. Open the generated test case in Katalon Studio.

  2. Go to the Variables tab.

  3. Locate the input_fileUpload variable.

  4. In the Default value cell, enter the absolute path to the file on the execution machine.

    Input absolute path for file

    Alternatively, define the file path directly in script following this format.

    WebUI.uploadFile(findTestObject('AI-Generated/TI/Page_customer_support_request_form/input_fileUpload'), RunConfiguration.getProjectDir() + File.separator + 'attachment.pdf')
Was this page helpful?