score:4

Accepted answer

you should await the call inside the console.log:

test('', async (t) => {
   console.log(await s.polyline.getattribute('points'));
}

or

test('', async (t) => {
   console.log(await s.polyline.getattribute('points'));
}

score:1

i've managed to get it working with a utility function for the ones who are interested.

export function getpoints(object: selector) : promise<string> {
  return object.getattribute('points');
}

this makes it easier and cleaner to work with the data.

import * as u from '../utilities/functions';
import * as s from '../utilities/selectors';
console.log(await u.getpoints( s.polyline ));

thanks for the help guys!

score:4

your getpointattribute function returns the polylinedata object that is an instance if the clientfunction type (which is, in turn, based on promises). that's why when you log u.getpointattribute(), you get these messages. all you need to do is to use the await keyword before calling the clientfunction. please see the following code:    

const polylinedata = clientfunction(() => polyline().attributes, {
    dependencies: { polyline }
});
await polylinedata();

refer to the following article to get more information https://devexpress.github.io/testcafe/documentation/test-api/obtaining-data-from-the-client/

i would also like to mention that you do not need to use asyncin your getpointattribute function.


Related Query

More Query from same tag