Skip to content

Commit 9588940

Browse files
committed
wip
1 parent 2f224d1 commit 9588940

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/Browser/PluginSettingsTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
use function Tests\{asAdmin, asAuthor, asEditor};
66

7-
const SA_ADMIN_NOTICE = '<!-- Simple Analytics: Not logging requests from admins -->';
87
const SA_DEFAULT_SCRIPT = 'src="https://scripts.simpleanalyticscdn.com/latest.js"></script>';
8+
const SA_INACTIVE_ADMIN_NOTICE = '<!-- Simple Analytics: Not logging requests from admins -->';
99
const SA_INACTIVE_ADMIN_SCRIPT = 'src="http://localhost:8100/wp-content/plugins/simpleanalytics/resources/js/inactive.js"';
1010

1111
it('can be activated', function () {
@@ -27,7 +27,7 @@
2727
$homePage = asAdmin()->navigate('http://localhost:8100');
2828

2929
expect($homePage->content())
30-
->toContain(SA_ADMIN_NOTICE)
30+
->toContain(SA_INACTIVE_ADMIN_NOTICE)
3131
->toContain(SA_INACTIVE_ADMIN_SCRIPT);
3232
});
3333

@@ -54,19 +54,23 @@
5454
});
5555

5656
it('adds inactive script for selected user roles', function () {
57-
asAdmin()
58-
->navigate('http://localhost:8100/wp-admin/options-general.php?page=simpleanalytics&tab=ignore-rules')
57+
$admin = asAdmin();
58+
59+
$admin->navigate('http://localhost:8100/wp-admin/options-general.php?page=simpleanalytics&tab=ignore-rules')
5960
->check('simpleanalytics_exclude_user_roles-editor')
6061
->check('simpleanalytics_exclude_user_roles-author')
6162
->click('Save Changes')
6263
->assertChecked('simpleanalytics_exclude_user_roles-editor')
6364
->assertChecked('simpleanalytics_exclude_user_roles-author');
6465

66+
expect($admin->navigate('http://localhost:8100')->content())
67+
->toContain(SA_DEFAULT_SCRIPT);
68+
6569
expect(asEditor()->navigate('http://localhost:8100')->content())
66-
->toContain(SA_ADMIN_NOTICE)
70+
->toContain(SA_INACTIVE_ADMIN_NOTICE)
6771
->toContain(SA_INACTIVE_ADMIN_SCRIPT);
6872

6973
expect(asAuthor()->navigate('http://localhost:8100')->content())
70-
->toContain(SA_ADMIN_NOTICE)
74+
->toContain(SA_INACTIVE_ADMIN_NOTICE)
7175
->toContain(SA_INACTIVE_ADMIN_SCRIPT);
7276
});

0 commit comments

Comments
 (0)