Fix daily free screenshot
All checks were successful
Push image to registry / build-image (push) Successful in 3m53s

This commit is contained in:
2025-02-19 18:50:34 +01:00
parent 7b51e29060
commit f1f32c44b5

View File

@ -208,6 +208,10 @@ class HellcaseJob extends BrowserJob
// Click the dailyfree button
$availibleInButton->click();
sleep(15);
$browser->waitForText("Your drop", 30, true);
$lootElement = $browser->driver->findElement(WebDriverBy::xpath('//div[contains(@class, "daily-free-win-bonus")]'));
$lootElement->takeElementScreenshot(HellcaseDailyFreeScreenshot::getImgFileAbsolutePath());
@ -222,11 +226,12 @@ class HellcaseJob extends BrowserJob
* @throws \Exception
* @return void
*/
private function fillDailyFreeConditions(Browser $browser) {
private function fillDailyFreeConditions(Browser $browser)
{
// 1. See what conditions we need to fullfill
$conditions = [];
$conditionsDivs = $browser->driver->findElements(WebDriverBy::xpath('//*[@class = "daily-free-requirement__heading-left"]'));
for($i = 0; $i < sizeof($conditionsDivs); $i++) {
for ($i = 0; $i < sizeof($conditionsDivs); $i++) {
$conditionDiv = $conditionsDivs[$i];
// See if the element has the completed class
$conditions[$i] = [
@ -253,13 +258,14 @@ class HellcaseJob extends BrowserJob
* @param \Laravel\Dusk\Browser $browser
* @return void
*/
private function changeSteamProfilePicture(Browser $browser) {
private function changeSteamProfilePicture(Browser $browser)
{
// Get all of the availible image link
$images = $browser->driver->findElements(WebDriverBy::xpath('//a[@class = "daily-free-user-requirement-avatar-item"]'));
// Download the image from the second link in a special folder
$imageLink = $images[1]->getAttribute("href");
// Download the image in app/Browser/downloads/
$imagePath = base_path("app/Browser/downloads/Hellcase/pp.jpg");
$imagePath = base_path("app/Browser/downloads/Hellcase/pp.png");
file_put_contents($imagePath, file_get_contents($imageLink));
$this->goToSteamProfileSettings($browser);
@ -292,7 +298,8 @@ class HellcaseJob extends BrowserJob
}
}
private function changeSteamProfileToPublic(Browser $browser) {
private function changeSteamProfileToPublic(Browser $browser)
{
$this->goToSteamProfileSettings($browser);
// Wait for and click "Privacy Settings"
@ -316,7 +323,8 @@ class HellcaseJob extends BrowserJob
* @param \Laravel\Dusk\Browser $browser
* @return void
*/
private function goToSteamProfileSettings(Browser $browser) {
private function goToSteamProfileSettings(Browser $browser)
{
// Get the link that has text "Steam profile"
$steamProfileLink = $browser->driver->findElement(WebDriverBy::xpath('//a[contains(text(), "Steam profile")]'));
$browser->visit($steamProfileLink->getAttribute("href"));