@@ -11,38 +11,46 @@ const footerUrl = new URL('src/components/RegistryFooter.astro', root);
1111const headUrl = new URL ( 'src/components/RegistryHead.astro' , root ) ;
1212const privacyUrl = new URL ( 'src/content/docs/privacy.mdx' , root ) ;
1313
14- test ( 'shared tracking is enabled only for canonical released documentation pages' , ( ) => {
15- assert . equal (
16- docsSharedTrackingEnabled ( { isReleasedArchiveBuild : true , base : '/' , path : '/' } ) ,
17- true ,
18- ) ;
19- assert . equal (
20- docsSharedTrackingEnabled ( {
21- isReleasedArchiveBuild : true ,
22- base : '/' ,
23- path : '/products/base-registry/' ,
24- } ) ,
25- true ,
26- ) ;
27- assert . equal (
28- docsSharedTrackingEnabled ( { isReleasedArchiveBuild : false , base : '/dev/' , path : '/' } ) ,
29- false ,
30- ) ;
31- assert . equal (
32- docsSharedTrackingEnabled ( {
33- isReleasedArchiveBuild : true ,
34- base : '/v/0.43.0/' ,
35- path : '/' ,
14+ test ( 'shared tracking is enabled for released-root and current public development pages' , ( ) => {
15+ for ( const build of [
16+ { isReleasedArchiveBuild : true , base : '/' } ,
17+ { isCurrentDocsetBuild : true , base : '/dev/' } ,
18+ ] ) {
19+ for ( const path of [ '/' , '/products/base-registry/' ] ) {
20+ assert . equal ( docsSharedTrackingEnabled ( { ...build , path } ) , true ) ;
21+ }
22+ for ( const path of [ '/404' , '/404/' ] ) {
23+ assert . equal ( docsSharedTrackingEnabled ( { ...build , path } ) , false ) ;
24+ }
25+ }
26+ } ) ;
27+
28+ test ( 'local, historical and arbitrary-base builds do not offer shared tracking' , ( ) => {
29+ for ( const build of [
30+ { isCurrentDocsetBuild : true , base : '/' } ,
31+ { isReleasedArchiveBuild : false , base : '/dev/' } ,
32+ { isReleasedArchiveBuild : true , base : '/dev/' } ,
33+ { isCurrentDocsetBuild : true , base : '/preview/' } ,
34+ { isReleasedArchiveBuild : true , base : '/v/0.43.0/' } ,
35+ { isCurrentDocsetBuild : true , base : '/v/0.43.0/' } ,
36+ ] ) {
37+ assert . equal ( docsSharedTrackingEnabled ( { ...build , path : '/' } ) , false ) ;
38+ }
39+ } ) ;
40+
41+ test ( 'development page views retain the public development path without query or fragment data' , ( ) => {
42+ assert . deepEqual (
43+ buildMauticPageview ( {
44+ canonicalUrl : 'https://docs.registrystack.org/dev/start/concepts/?private=yes#record' ,
45+ currentUrl : 'https://docs.registrystack.org/dev/start/concepts/?email=person%40example.org#record' ,
46+ pageTitle : 'How the products fit together' ,
47+ referrer : 'https://registrystack.org/starters/?email=person%40example.org' ,
3648 } ) ,
37- false ,
38- ) ;
39- assert . equal (
40- docsSharedTrackingEnabled ( { isReleasedArchiveBuild : true , base : '/' , path : '/404/' } ) ,
41- false ,
42- ) ;
43- assert . equal (
44- docsSharedTrackingEnabled ( { isReleasedArchiveBuild : true , base : '/' , path : '/404' } ) ,
45- false ,
49+ {
50+ page_url : 'https://docs.registrystack.org/dev/start/concepts/' ,
51+ page_title : 'How the products fit together' ,
52+ page_referrer : 'https://registrystack.org' ,
53+ } ,
4654 ) ;
4755} ) ;
4856
@@ -98,6 +106,9 @@ test('tracking controls use the shared bridge and remain available after failure
98106 assert . match ( component , / n e w U R L \( w i n d o w \. l o c a t i o n \. p a t h n a m e , c a n o n i c a l O r i g i n \) / ) ;
99107 assert . match ( component , / A c c e p t o p t i o n a l c o o k i e s / ) ;
100108 assert . match ( component , / R e j e c t o p t i o n a l c o o k i e s / ) ;
109+ assert . match ( component , / h r e f = \{ p r i v a c y U r l \} / ) ;
110+ assert . doesNotMatch ( component , / h r e f = " \/ p r i v a c y \/ " / ) ;
111+ assert . doesNotMatch ( component , / c l i e n t \. a s s o c i a t e / ) ;
101112 assert . match ( component , / m a i n R e g i s t r y S t a c k w e b s i t e a n d t h i s \s + d o c u m e n t a t i o n / i) ;
102113 assert . match ( component , / d a t a - t r a c k i n g - e r r o r [ ^ > ] * r o l e = " a l e r t " / ) ;
103114 assert . match ( component , / c l i e n t \. p a g e v i e w \( p a g e v i e w \) / ) ;
@@ -114,8 +125,10 @@ test('tracking controls use the shared bridge and remain available after failure
114125
115126 assert . match ( footer , / < R e g i s t r y T r a c k i n g P r e f e r e n c e s / ) ;
116127 assert . match ( footer , / c a n o n i c a l O r i g i n = \{ c a n o n i c a l O r i g i n \} / ) ;
117- assert . match ( footer , / r o u t e \. e n t r y \. i d = = = ' 4 0 4 ' / ) ;
118- assert . match ( footer , / r o u t e \. e n t r y \. i d \. e n d s W i t h \( ' \/ 4 0 4 ' \) / ) ;
128+ assert . match ( footer , / p r i v a c y U r l = \{ ` \$ \{ b a s e \} p r i v a c y \/ ` \} / ) ;
129+ assert . match ( footer , / i s C u r r e n t D o c s e t B u i l d / ) ;
130+ assert . match ( footer , / r o u t e \. e n t r y \? \. i d = = = ' 4 0 4 ' / ) ;
131+ assert . match ( footer , / r o u t e \. e n t r y \? \. i d \. e n d s W i t h \( ' \/ 4 0 4 ' \) / ) ;
119132 assert . match ( footer , / p a t h : ' \/ ' / ) ;
120133 assert . match ( footer , / d a t a - t r a c k i n g - p r e f e r e n c e s - o p e n / ) ;
121134 assert . match ( footer , / d a t a - t r a c k i n g - p r e f e r e n c e s - o p e n h i d d e n / ) ;
@@ -133,5 +146,8 @@ test('tracking controls use the shared bridge and remain available after failure
133146 assert . match ( privacy , / t r a c k i n g b r i d g e / i) ;
134147 assert . match ( privacy , / s i x m o n t h s / i) ;
135148 assert . match ( privacy , / D o N o t T r a c k a n d G l o b a l P r i v a c y C o n t r o l / i) ;
136- assert . match ( privacy , / \/ d e v \/ [ \s \S ] * \/ v \/ < v e r s i o n > \/ [ \s \S ] * d o n o t l o a d / i) ;
149+ assert . match ( privacy , / \/ d e v \/ [ \s \S ] * \/ v \/ < v e r s i o n > \/ [ \s \S ] * d o n o t l o a d U m a m i / i) ;
150+ assert . match ( privacy , / o p t i o n a l t r a c k i n g i s a v a i l a b l e o n [ \s \S ] * \/ d e v \/ / i) ;
151+ assert . match ( privacy , / v e r s i o n e d a r c h i v e s a n d e r r o r p a g e s d o n o t o f f e r o p t i o n a l t r a c k i n g / i) ;
152+ assert . match ( privacy , / d o e s n o t s e n d [ \s \S ] * m a r k e t i n g e m a i l / i) ;
137153} ) ;
0 commit comments