config('service.site1_email')) ->type('password', config('service.site1_password')) ->press('Login'); // get text $text = $browser->text('#app > main > div > div > div > div > div.card-body'); \Log::info($text); $this->notify(‘Hello Web Artisan’, $text, 'icon.png'); }); }
✔ Type password secret!: ✔ Press Login: ✔ Text #app > main > div > div > div > div > div.card-body: ✔ [2019-02-16 03:30:24] development.INFO: You are logged in!
// get text $text = $browser->text('#app > main > div > div > div > div > div.card-body'); // slack post $guzzle = new \GuzzleHttp\Client(); $guzzle->post(config('service.slack.webhook_url'), [ 'body' => json_encode([ 'channel' => config('service.slack.channel'), 'text' => $text, 'username' => config('service.slack.username'), 'icon_emoji' => config('service.slack.icon'), ]), ]); });
$browser->visit('https://site1.test/login') ->type('email', config('service.site1_email')) ->type('password', config('service.site1_password')) ->press('Login'); // get text $this->site1['text'] = $browser->text('#app > main > div > div > div > div > div.card-body'); $browser->screenshot('login'); $this->site1['screenshots'] = storage_path('laravel-console-dusk/screenshots') . '/login.png'; }); });
✔ Type password password: ✔ Press Login: ✔ Text #app > main > div > div > div > div > div.card-body: ✔ Screenshot login: ✔ get site1: ✔ upload to s3: ✔ post slack: ✔