Added Scheduling
All checks were successful
Push image to registry / build-image (push) Successful in 4m20s

This commit is contained in:
2025-02-07 14:02:42 +01:00
parent 8d1e0474c4
commit 63490c136e
22 changed files with 126 additions and 437 deletions

View File

@ -15,6 +15,7 @@ use App\Notification\Notifications\Hellcase\HellcaseNotificationLogin;
use App\Notification\Providers\AllNotification;
use Dom\XPath;
use Facebook\WebDriver\WebDriverBy;
use Illuminate\Support\Facades\Schedule;
use Laravel\Dusk\Browser;
class HellcaseJob extends BrowserJob
@ -169,23 +170,24 @@ class HellcaseJob extends BrowserJob
}
// If we see "availible in 20 HR 49 MIN", parse the hours and minute and reschedule
$availibleInButton = $this->waitForElementContainingTextAndGetIt($browser, "available", 30);
if ($availibleInButton != null) {
$availibleInButton = $browser->driver->findElement(WebDriverBy::xpath('//button[contains(@class, "daily-free-banner__button")]'));
if ($availibleInButton->getAttribute("disabled") == "true") {
$hours = $availibleInButton->getText();
$hours = explode(" ", $hours);
$minutes = $hours[2];
$hours = $hours[0];
$minutes = $hours[4];
$hours = $hours[2];
// $this->reschedule($hours);
$this->jobRun->addArtifact(new JobArtifact([
"name" => "Cadeau gratuit pas encore disponible",
"content" => "Le cadeau gratuit journalier sera disponible dans $hours heures et $minutes minutes.\nDatboi se fera un plaisir d'aller le chercher pour vous."
"content" => "Le cadeau gratuit journalier sera disponible dans {$hours} heures et {$minutes} minutes.\nDatboi se fera un plaisir d'aller le chercher pour vous."
]));
return;
}
$this->waitForAndClickText($browser, "Get Free Bonus", 30, true);
// Click the dailyfree button
$availibleInButton->click();
$lootElement = $browser->driver->findElement(WebDriverBy::xpath('//div[contains(@class, "daily-free-win-bonus")]'));
$lootElement->takeElementScreenshot(HellcaseDailyFreeScreenshot::getImgFileAbsolutePath());
@ -193,8 +195,6 @@ class HellcaseJob extends BrowserJob
AllNotification::send(
new HellcaseNotificationDailyFree($this->jobId, new HellcaseNotificationDailyFreeBody())
);
sleep(5000);
}
/**