Skip to content

Commit

Permalink
Fix auto test
Browse files Browse the repository at this point in the history
  • Loading branch information
jorikfon committed Sep 21, 2024
1 parent 839edae commit 0bff49b
Showing 1 changed file with 1 addition and 23 deletions.
24 changes: 1 addition & 23 deletions tests/AdminCabinet/Lib/MikoPBXTestsBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,6 @@ protected function waitForAjax(): void
}
}

/**
* Wait until datatable draw
* @param $datatableId
* @param $timeoutInSeconds
* @return void
* @throws Exception
*/
protected function waitForDataTableDraw(string $datatableId, int $timeoutInSeconds = 10)
{
$endTime = time() + $timeoutInSeconds;
while (time() < $endTime) {
$isDrawComplete = self::$driver->executeScript("
var table = $('#$datatableId').DataTable();
return table && table.draw && table.draw(false) !== undefined;
");
if ($isDrawComplete) {
return;
}
usleep(500000);
}
throw new \Exception("Timeout waiting for DataTable draw to complete.");
}

/**
* Fails a test with the given message.
Expand Down Expand Up @@ -763,7 +741,7 @@ protected function fillDataTableSearchInput(string $datatableId, string $name, s
$this->waitForAjax();

// Wait for DataTableDraw
$this->waitForDataTableDraw($datatableId,10);
usleep(5000000);
}

/**
Expand Down

0 comments on commit 0bff49b

Please sign in to comment.