Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Oct 14, 2023
1 parent aeee257 commit 20c3dab
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"require-dev": {
"mockery/mockery": "^1.4.2",
"orchestra/testbench": "^7.0|^8.0",
"orchestra/testbench": "^7.33|^8.13",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.5.10|^10.0.1",
"psy/psysh": "^0.11.12"
Expand Down
3 changes: 3 additions & 0 deletions testbench.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ migrations:

workbench:
start: '/'
welcome: false
discovers:
web: true
11 changes: 11 additions & 0 deletions tests/Browser/BrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@ public function test_it_can_browse_default_laravel_page()
->assertSee('Documentation');
});
}

public function test_it_handle_wait_for_text_in()
{
$this->browse(function (Browser $browser) {
$browser->visit('/tests/wait-for-text-in')
->assertSeeIn('@copy-button', 'Copy')
->press('@copy-button')
->assertSeeIn('@copy-button', 'Copied!')
->waitForTextIn('@copy-button', 'Copy', 3);
});
}
}
17 changes: 17 additions & 0 deletions workbench/resources/views/wait-for-text-in.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<script type="text/javascript">
function copy(e) {
e.innerHTML = 'Copied!'
setTimeout(() => {
e.innerHTML = 'Copy'
}, 3000);
}
</script>
</head>
<body>
<button dusk="copy-button" onclick="copy(this)">Copy</button>
</body>
</html>
17 changes: 17 additions & 0 deletions workbench/routes/web.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/

Route::view('/', 'welcome');
Route::view('tests/wait-for-text-in', 'workbench::wait-for-text-in');

0 comments on commit 20c3dab

Please sign in to comment.