Skip to content

Commit

Permalink
using on page instead of route for blade test
Browse files Browse the repository at this point in the history
  • Loading branch information
2amjsouza committed Dec 8, 2023
1 parent 4c0bbcf commit 0864dd8
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions tests/laravel-functional/BladeComponentCest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,12 @@ public function testAssertContentIsRequiredOnEndpoint(FunctionalTester $I)
public function testQrCodeComponentSimpleText(FunctionalTester $I)
{
$I->wantTo('Blade Component: Assert simple text QR Code creation');
$I->amOnRoute('app.blade');
$I->amOnPage('/');
$source = $I->grabPageSource();

$qrCode = file_get_contents(codecept_data_dir('blade/qrcode-blade.png'));

$I->assertEquals(base64_encode($qrCode), $this->grabBase64($source));
}

protected function grabBase64(string $source)
{
var_dump($source);
die;
$data = explode('base64,', $source)[1];
$data = explode('=="', $data)[0];
$qrCode = file_get_contents(codecept_data_dir('blade/qrcode-blade.png'));

return $data . '==';
$I->seeInSource(base64_encode($qrCode));
}

public function testQrCodeComponentWithImage(FunctionalTester $I)
Expand Down Expand Up @@ -116,4 +106,4 @@ public function testQrCodeComponentWithColors(FunctionalTester $I)
$I->seeInSource(base64_encode($qrCodeBackground));
$I->seeInSource(base64_encode($qrCodeForeground));
}
}
}

0 comments on commit 0864dd8

Please sign in to comment.