This repository was archived by the owner on Jan 9, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace BeyondCode \DuskDashboard \Dusk ;
4
4
5
+ use Closure ;
5
6
use BeyondCode \DuskDashboard \BrowserActionCollector ;
6
7
7
8
class Browser extends \Laravel \Dusk \Browser
@@ -61,6 +62,30 @@ public function refresh()
61
62
return $ browser ;
62
63
}
63
64
65
+ /** {@inheritdoc} */
66
+ public function with ($ selector , Closure $ callback )
67
+ {
68
+ $ action_collector_callback = function ($ browser ) use ($ callback ) {
69
+ print 'Entering the wrapped callback... ' ;
70
+ $ browser ->setActionCollector ($ this ->getActionCollector ());
71
+
72
+ print 'Wrapped callback invoked & updated browser! ' ;
73
+ return $ callback ($ browser );
74
+ };
75
+
76
+ return parent ::with ($ selector , $ action_collector_callback );
77
+ }
78
+
79
+ /** {@inheritDoc} */
80
+ public function onComponent ($ component , $ parentResolver )
81
+ {
82
+ if ($ this ->getActionCollector () === null ) {
83
+ $ this ->setActionCollector (new BrowserActionCollector ('dog ' ));
84
+ }
85
+
86
+ parent ::onComponent ($ component , $ parentResolver );
87
+ }
88
+
64
89
public function getCurrentPageSource ()
65
90
{
66
91
$ this ->ensurejQueryIsAvailable ();
You can’t perform that action at this time.
0 commit comments