Skip to content

Commit 2e3f7a1

Browse files
committed
wip
1 parent 75ca7d5 commit 2e3f7a1

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

tests/Browser/PluginSettingsTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22

33
namespace Tests\Browser;
44

5+
use function Tests\asAdmin;
6+
57
const 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
});

tests/Pest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@
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
}

0 commit comments

Comments
 (0)