1
1
/* global describe, it, beforeEach */
2
2
3
3
const Brave = require ( '../lib/brave' )
4
- const { cookieControl, allowAllCookiesOption, blockAllCookiesOption, urlInput, braveMenu, braveMenuDisabled, adsBlockedStat, adsBlockedControl, showAdsOption, blockAdsOption, braveryPanel, httpsEverywhereStat, noScriptStat, noScriptSwitch, fpSwitch, autoplaySwitch , fpStat, noScriptNavButton, customFiltersInput} = require ( '../lib/selectors' )
4
+ const { cookieControl, allowAllCookiesOption, blockAllCookiesOption, urlInput, braveMenu, braveMenuDisabled, adsBlockedStat, adsBlockedControl, showAdsOption, blockAdsOption, braveryPanel, httpsEverywhereStat, noScriptStat, noScriptSwitch, fpSwitch, noAutoplaySwitch , fpStat, noScriptNavButton, customFiltersInput, notificationBar , reloadButton } = require ( '../lib/selectors' )
5
5
const { getTargetAboutUrl} = require ( '../../js/lib/appUrlUtil' )
6
6
7
7
describe ( 'Bravery Panel' , function ( ) {
@@ -518,6 +518,11 @@ describe('Bravery Panel', function () {
518
518
return status === ''
519
519
} )
520
520
} )
521
+ . windowByUrl ( Brave . browserWindowUrl )
522
+ . waitForExist ( notificationBar )
523
+ . waitUntil ( function ( ) {
524
+ return this . getText ( notificationBar ) . then ( ( val ) => val . includes ( 'Media autoplay' ) )
525
+ } )
521
526
} )
522
527
523
528
it ( 'allow autoplay in regular tab' , function * ( ) {
@@ -531,8 +536,13 @@ describe('Bravery Panel', function () {
531
536
return status === ''
532
537
} )
533
538
} )
539
+ . windowByUrl ( Brave . browserWindowUrl )
540
+ . waitForExist ( notificationBar )
541
+ . waitUntil ( function ( ) {
542
+ return this . getText ( notificationBar ) . then ( ( val ) => val . includes ( 'Media autoplay' ) )
543
+ } )
534
544
. openBraveMenu ( braveMenu , braveryPanel )
535
- . click ( autoplaySwitch )
545
+ . click ( noAutoplaySwitch )
536
546
. keys ( Brave . keys . ESCAPE )
537
547
. tabByUrl ( url )
538
548
. waitUntil ( function ( ) {
@@ -554,8 +564,13 @@ describe('Bravery Panel', function () {
554
564
return status === ''
555
565
} )
556
566
} )
567
+ . windowByUrl ( Brave . browserWindowUrl )
568
+ . waitForExist ( notificationBar )
569
+ . waitUntil ( function ( ) {
570
+ return this . getText ( notificationBar ) . then ( ( val ) => val . includes ( 'Media autoplay' ) )
571
+ } )
557
572
. openBraveMenu ( braveMenu , braveryPanel )
558
- . click ( autoplaySwitch )
573
+ . click ( noAutoplaySwitch )
559
574
. keys ( Brave . keys . ESCAPE )
560
575
. tabByUrl ( url )
561
576
. waitUntil ( function ( ) {
@@ -565,5 +580,62 @@ describe('Bravery Panel', function () {
565
580
} )
566
581
} )
567
582
} )
583
+
584
+ it ( 'allow autoplay in notification bar' , function * ( ) {
585
+ const url = Brave . server . url ( 'autoplay.html' )
586
+ yield this . app . client
587
+ . tabByIndex ( 0 )
588
+ . loadUrl ( url )
589
+ . waitUntil ( function ( ) {
590
+ return this . getText ( 'div[id="status"]' )
591
+ . then ( ( status ) => {
592
+ return status === ''
593
+ } )
594
+ } )
595
+ . windowByUrl ( Brave . browserWindowUrl )
596
+ . waitForExist ( notificationBar )
597
+ . waitUntil ( function ( ) {
598
+ return this . getText ( notificationBar ) . then ( ( val ) => val . includes ( 'Media autoplay' ) )
599
+ } )
600
+ . click ( 'button=Yes' )
601
+ . tabByUrl ( url )
602
+ . waitUntil ( function ( ) {
603
+ return this . getText ( 'div[id="status"]' )
604
+ . then ( ( status ) => {
605
+ return status === 'Autoplay playing'
606
+ } )
607
+ } )
608
+ } )
609
+
610
+ it ( 'Remember block autoplay in notification bar' , function * ( ) {
611
+ const url = Brave . server . url ( 'autoplay.html' )
612
+ yield this . app . client
613
+ . tabByIndex ( 0 )
614
+ . loadUrl ( url )
615
+ . waitUntil ( function ( ) {
616
+ return this . getText ( 'div[id="status"]' )
617
+ . then ( ( status ) => {
618
+ return status === ''
619
+ } )
620
+ } )
621
+ . windowByUrl ( Brave . browserWindowUrl )
622
+ . waitForExist ( notificationBar )
623
+ . waitUntil ( function ( ) {
624
+ return this . getText ( notificationBar ) . then ( ( val ) => val . includes ( 'Media autoplay' ) )
625
+ } )
626
+ . click ( '[data-l10n-id=rememberDecision]' )
627
+ . click ( 'button=No' )
628
+ . windowByUrl ( Brave . browserWindowUrl )
629
+ . click ( reloadButton )
630
+ . tabByUrl ( url )
631
+ . waitUntil ( function ( ) {
632
+ return this . getText ( 'div[id="status"]' )
633
+ . then ( ( status ) => {
634
+ return status === ''
635
+ } )
636
+ } )
637
+ . windowByUrl ( Brave . browserWindowUrl )
638
+ . waitForElementCount ( '.notificationItem' , 0 )
639
+ } )
568
640
} )
569
641
} )
0 commit comments