Test Management 2.0 - line breaks are not considered while writing tests

Daisy Huang
Tera Contributor

Hi Community, 
We are using PPM test management 2.0 to maintain our test cases. 

And we got compliances from quite some colleagues, as while they are writing a test for story, the line breaks are not considered, they need to type in a notebook and then copy/paste to a test, which is not conveniences for daily work. 

 

Can you let us know is there a customization we could do to make the test steps in a Test consider the line break. 

Thanks.
Daisy

DaisyHuang_0-1745223116836.png

 

1 ACCEPTED SOLUTION

Kieran Anson
Kilo Patron

Hi,

Yes this can be done. But does require a customisation which could break. So needs to be done with the risk accepted by the business.

 

Create a new UI script within the 'Test Management' scope called 'handle_enter_key' and the following script.

This script will look for the key-combo shift+enter and allow it to be used to create new lines

$j(document).ready(function() {

    document.body.addEventListener('keydown', (event) => {
        const target = event.target;

        if (
            target &&
            (target.matches('textarea.add_step_textbox') ||
                (
                    target.matches('textarea') &&
                    target.closest('.step_content')
                )) &&
            event.key === 'Enter' &&
            event.shiftKey
        ) {
            console.log("Shift+Enter intercepted")
            event.stopPropagation();
        }
    }, true)
});

 

Open the sys_ui_macro 'test_version_step_list' and add the following line

//<g2:requires name="scripts/angular_includes_1.5.11.js" includes="true" /> add the following, below this line
<g:requires name="sn_test_management.handle_enter_key.jsdbx" params="cache=$[jvar_stamp]" />

 

Hard reload the test step page and you can now use shift+enter to insert a new line. The enter key will continue to act as is OOB

 

View solution in original post

2 REPLIES 2

Kieran Anson
Kilo Patron

Hi,

Yes this can be done. But does require a customisation which could break. So needs to be done with the risk accepted by the business.

 

Create a new UI script within the 'Test Management' scope called 'handle_enter_key' and the following script.

This script will look for the key-combo shift+enter and allow it to be used to create new lines

$j(document).ready(function() {

    document.body.addEventListener('keydown', (event) => {
        const target = event.target;

        if (
            target &&
            (target.matches('textarea.add_step_textbox') ||
                (
                    target.matches('textarea') &&
                    target.closest('.step_content')
                )) &&
            event.key === 'Enter' &&
            event.shiftKey
        ) {
            console.log("Shift+Enter intercepted")
            event.stopPropagation();
        }
    }, true)
});

 

Open the sys_ui_macro 'test_version_step_list' and add the following line

//<g2:requires name="scripts/angular_includes_1.5.11.js" includes="true" /> add the following, below this line
<g:requires name="sn_test_management.handle_enter_key.jsdbx" params="cache=$[jvar_stamp]" />

 

Hard reload the test step page and you can now use shift+enter to insert a new line. The enter key will continue to act as is OOB

 

Daisy Huang
Tera Contributor

Hi @Kieran Anson  
Thank you so much for you quick and helpful response!
My colleague did the implementation in a copied instance and it's working!  😎 Cooool~~~

I will align internally about the real implementation.

 

Thanks,
Daisy