How do i combine Selector with my Utility function?
Your provided code will not work since you are trying to concatenate a string to a generated function. This string should be an Object passed as the second argument to the click function.
If you always use the same selector, I can imagine you would want to create a utility like clickPoint(t, 100,200)
.
This can be achieved by the following utility function.
import * as s from './selectors.js';
export const clickPoint = (t, x, y) => {
return t.click(s.viewport, { offsetX : x, offsetY: y });
};
Your testfile would look like this:
import { clickPoint } from '../utilities/functions.js';
test('example utility function', async (t) => {
await clickPoint(t, 100, 200);
});