t4t5 / sweetalert

A beautiful replacement for JavaScript's "alert"
https://sweetalert.js.org
MIT License
22.4k stars 2.84k forks source link

sweetalert not working with testcafe automation framework #922

Open RemigiusL opened 4 years ago

RemigiusL commented 4 years ago

sweetalert not working with testcafe automation framework (nodejs) . Why it happened, could you please help me out? 😊

You can find my testcafe automation code below,

/***

import { Selector, ClientFunction } from 'testcafe'; import swal from 'sweetalert';

fixture testcafe with sweetalert .page https://devexpress.github.io/testcafe/;

test('Test with message box', async t => { swal("Hello world!"); const showMessageBox = ClientFunction(message => { return new Promise(resolve => { var msgBox = document.createElement('div'); msgBox.textContent = message; msgBox.style['right'] = '500px'; msgBox.style['top'] = '500px'; msgBox.style['position'] = 'center'; msgBox.style['font-size'] = '22px'; msgBox.style['padding'] = '20px'; msgBox.style['background-color'] = '#2196F3'; msgBox.style['color'] = 'white'; msgBox.style['margin-left'] = '15px'; msgBox.style['float'] = 'right'; msgBox.style['font-weight'] = 'bold'; msgBox.style['cursor'] = 'pointer'; msgBox.style['line-height'] = '20px'; msgBox.style['transition'] = ' 0.3s'; document.body.appendChild(msgBox); setTimeout(() => { document.body.removeChild(msgBox); resolve(); }, 4000);
}); }); await t .click(Selector('span').withText('Docs')); await showMessageBox('Docs link was clicked!'); await t .click(Selector('a').withText('Using TestCafe')); });

***/