-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Description
Hi,
I am trying to detect events / function calls (more specifically an alert) that is fired directly when the document loads (it is placed directly on the script tag, not binded by any event listener:
<script language="JavaScript">
alert("CODELEARN");
</script>
but it does not seem to work
I got this on the preload script
window.alert = function(message) {
send('page', 'alert', message)
}
and
beforeEach(() => {
nightmare.on('page', (type, message) => {
if (type == 'alert'){
alert_messages.push(message);
}
}
I then check in the test whether I got the expected alert_messages.
This works when the alert is triggered by a click or some other event but not with the example above.
Does anyone know a way to check this other than, for example, duplicating the script tag during the test?
Metadata
Metadata
Assignees
Labels
No labels