Unfortunatly running the test with "--no-user-gesture-required" flag did not help.
My test to check if video started that works on firefox, but not on chrome:
import { Selector, ClientFunction } from 'testcafe';
fixture Test
const getYoutubeCurrentTime = ClientFunction (() => {
const ytCurrntTimeValue = document.querySelector('.ytp-time-current').innerText;
return ytCurrntTimeValue;
});
const videoDidNotStart = Error('Video did not start');
test.page(https://www.youtube.com/watch?v=RWQtB6Xv01Q
)('Test: Play Youtube video', async t => {
await t
.wait(13000);
console.log('Youtube video test-end time: ' + await getYoutubeCurrentTime());
if ((await getYoutubeCurrentTime()) != '0:00') {
console.log('Video Started');
}
else {
throw videoDidNotStart;
}
});