misc updates with tests failing
This commit is contained in:
@@ -187,34 +187,14 @@ JS);
|
||||
return (bool) $browser->script(<<<'JS'
|
||||
const input = document.querySelector('#attachments');
|
||||
const button = document.querySelector('[dusk="ticket-create-submit"], [data-dusk="ticket-create-submit"]');
|
||||
|
||||
const isVisible = (element) => {
|
||||
if (! element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const style = window.getComputedStyle(element);
|
||||
|
||||
return style.display !== 'none'
|
||||
&& style.visibility !== 'hidden'
|
||||
&& style.opacity !== '0'
|
||||
&& element.getClientRects().length > 0;
|
||||
};
|
||||
|
||||
const visibleUploadText = Array.from(document.querySelectorAll('div, span'))
|
||||
.some((element) => {
|
||||
const text = (element.textContent || '').trim();
|
||||
|
||||
return (text.includes('Uploading attachments...') || text === 'Uploading...')
|
||||
&& isVisible(element);
|
||||
});
|
||||
const selected = document.querySelector('[dusk="ticket-create-selected-attachments"], [data-dusk="ticket-create-selected-attachments"]');
|
||||
|
||||
return Boolean(input)
|
||||
&& input.files.length > 0
|
||||
&& Boolean(selected)
|
||||
&& Boolean(button)
|
||||
&& button.disabled === false
|
||||
&& visibleUploadText === false;
|
||||
&& button.disabled === false;
|
||||
JS)[0];
|
||||
}, 'The attachment upload did not finish before submit.');
|
||||
}, 'The Livewire temporary attachment upload did not finish before submit.');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user