ATF Validate Price and Recurring Price Failed

MalikB
Tera Contributor

Capture d’écran 2026-10-03 à 19.49.23.pngHi I'm doing Automated Test Framework (ATF) Essentials in one activity i had to create a test with test steps for a catalog service Apple Iphone 13 pro the last step is Validate Price and Recurring Price and its fail even if the prices are the same can someone tell me why?

1 REPLY 1

RaghavendraGund
Tera Guru

Hello,

This is an interesting scenario. I was able to replicate the issue in my PDI, find the cause, and fix it.

First, a little background: every character on a computer has its own Unicode value (think of it as a unique backend ID for each character). There are two kinds of "space" involved here:

  • Spacebar space (U+0020): what you get when you press the spacebar
  • No-Break Space, NBSP (U+00A0): what the portal uses between 1 and 158 in the price

Both look exactly the same to the human eye, and there's no way to tell just by looking whether a gap is a spacebar space or an NBSP. But ATF sees them as different characters.

Here's how I found it in the browser console:

1. Get the page ready

  1. Impersonate the user your test runs as (one with a French/EUR locale).
  2. Open the portal item Apple iPhone 13 pro (/sp and search it).
  3. Select the same variables as your test: No, 500MB, Silver, 512 GB.
  4. Check the price shows 1 158,1292 €.

2. Open the Console

  1. Press F12.
  2. Click the Console tab at the top of the DevTools panel.
  3. Click the 🚫 icon at the top left of the Console to clear old messages.

3. Run the check

  1. Click on the empty line at the bottom, next to the > symbol.
  2. Paste this (Ctrl+V):
 
javascript
var m = document.body.textContent.match(/Price:[\s\S]*?Monthly/);
console.log(m ? [...m[0]].map(c => { var n = c.charCodeAt(0); return (n < 33 || n > 126) ? '[U+' + n.toString(16).toUpperCase().padStart(4, '0') + ']' : c; }).join('') : 'Price text not found');
  1. If Chrome shows a paste warning, type allow pasting, press Enter, then paste again.
  2. Press Enter.
  3. Read the result (refer to Screenshot 1).

In the result, [U+00A0] between 1 and 158 is the NBSP the portal uses. The space before € is a normal spacebar space ([U+0020]). When you type 1 158,1292 € in the ATF step, you use the spacebar, so ATF compares the two, finds one different character, and fails, even though both look the same. This only affects prices of 1 000 or more, because smaller prices have no gap in the number.

How I fixed it

  1. I created an ATF test just like yours (refer to Screenshot 2).
  2. Open test step 4, Validate Price and Recurring Price (SP) (refer to Screenshot 3). Notice the gap between 1 and 158. It looks normal, but it's a spacebar space.
    • Note: retyping it or copy-pasting the price from the portal doesn't help. I tried both and the test still failed.
  3. Copy the step's sys_id (right-click the form header > Copy sys_id).
  4. Go to Scripts - Background, make sure the scope is Global, paste the script below, put your sys_id in the first line, and run it. It removes the spacebar space between 1 and 158 and puts an NBSP in its place.
 
javascript
var stepId = 'PASTE_YOUR_STEP_SYS_ID_HERE'; // sys_id of the "Validate Price and Recurring Price (SP)" step
var vv = new GlideRecord('sys_variable_value');
vv.addQuery('document_key', stepId);
vv.query();
gs.info('Rows found: ' + vv.getRowCount());
while (vv.next()) {
  var val = vv.getValue('value') || '';
  gs.info(vv.variable.getDisplayValue() + ' = ' + val);
  if (val.indexOf('158,1292') > -1) {
    vv.setValue('value', val.replace(/1[\s\u00A0\u202F]*158/, '1\u00A0158'));
    vv.update();
    var v = vv.getValue('value'), codes = '';
    for (var i = 0; i < v.length; i++) {
      var n = v.charCodeAt(i);
      codes += (n < 33 || n > 126) ? '[U+' + ('000' + n.toString(16).toUpperCase()).slice(-4) + ']' : v.charAt(i);
    }
    gs.info('  -> price now: ' + codes);
  }
}

If it worked, the output shows: price now: 1[U+00A0]158,1292[U+0020][U+20AC]

  1. Now run the test. It should pass now (refer to Screenshot 4 for the successful test in my PDI).
    • If you edit the Price on the step form again later, run the script again, because the form can put a normal space back.

One question: in my test the recurring price 40,0891 € passed, but in yours it failed too. How did you enter it, typed or pasted from somewhere?

If this helped, please mark it Helpful / Accept as Solution.

Regards,
Raghavendra G