File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change 22
33namespace Tests \Browser ;
44
5+ use function Tests \asAdmin ;
6+
57const DEFAULT_SA_NOTICE = '<!-- Simple Analytics: Not logging requests from admins --> ' ;
68
7- test ('Sign in ' , function () {
8- $ page = visit ( ' http://127.0.0.1:8100/wp-admin ' );
9+ test ('Sign in as admin and activate the plugin ' , function () {
10+ $ page = asAdmin ( );
911
10- $ page ->fill ('user_login ' , 'admin ' );
11- $ page ->fill ('user_pass ' , 'admin ' );
12- $ page ->press ('wp-submit ' );
13- $ page ->assertSee ('Welcome to WordPress! ' );
12+ $ page ->navigate ('http://localhost:8100/wp-admin/plugins.php ' )->screenshot ();
13+ $ page ->assertSee ('Simple Analytics Official ' );
1414
15- $ page2 = visit ('http://127.0.0.1:8100 ' )->screenshot ();
15+ $ page2 = visit ('http://127.0.0.1:8100 ' ); // ->screenshot();
1616 expect ($ page2 ->content ())->not ->toContain (DEFAULT_SA_NOTICE );
1717});
Original file line number Diff line number Diff line change 4141|
4242*/
4343
44- function something ()
44+ function asAdmin ()
4545{
46- // ..
46+ $ page = visit ('http://127.0.0.1:8100/wp-admin ' );
47+
48+ $ page ->fill ('user_login ' , 'admin ' );
49+ $ page ->fill ('user_pass ' , 'admin ' );
50+ $ page ->press ('wp-submit ' );
51+ $ page ->assertSee ('Welcome to WordPress! ' );
52+
53+ return $ page ;
4754}
You can’t perform that action at this time.
0 commit comments