TestCafe await async メソッド
test('テスト名', async t => { const buttonName = await Selector('div').withText(/.*正規表現.*/).withAttribute('class', 'class-name');
こういうのは
こういうメソッド作って
const myMethod = async (regex) => { const buttonName = await Selector('div').withText(regex).withAttribute('class', 'class-name'); return buttonName; };
こう呼ぶ
const buttonName = await myMethod(/.*正規表現.*/);