From b5f36fb8f2f700ed7995d8936463a3ab0b97d182 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Fri, 6 Oct 2023 01:04:25 +0200 Subject: [PATCH] Fix autoplay bug also add E2E test for checking it #725 --- .../controls.lightbox.gallery.component.ts | 2 +- test/cypress/e2e/gallery.cy.ts | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts b/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts index 34792f6a..b5a70a1f 100644 --- a/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts +++ b/src/frontend/app/ui/gallery/lightbox/controls/controls.lightbox.gallery.component.ts @@ -282,7 +282,7 @@ export class ControlsLightboxComponent implements OnDestroy, OnInit, OnChanges { ) { return; } - // this.nextPhoto.emit(); + this.nextPhoto.emit(); }; private drawSliderProgress(t: number) { diff --git a/test/cypress/e2e/gallery.cy.ts b/test/cypress/e2e/gallery.cy.ts index 06ac8b60..335cdd5e 100644 --- a/test/cypress/e2e/gallery.cy.ts +++ b/test/cypress/e2e/gallery.cy.ts @@ -71,6 +71,29 @@ describe('Gallery', () => { cy.get('app-lightbox-controls .faces-container > .face > .face-name').contains('Alvin the Squirrel'); }); + + + + it('Gallery should auto play in lightbox', () => { + cy.wait('@getContent'); + // contains a folder + cy.get('app-gallery-directories.directories > app-gallery-directory > .button > .photo-container'); + + + for (let i = 0; i < 5; ++i) { + cy.window().scrollTo(0, 9000, {ensureScrollable: false, duration: 100, easing: 'linear'}).wait(500); + } + + cy.visit('/gallery/?p=IMG_5910.jpg'); + + cy.get('app-gallery-lightbox-media img[alt="IMG_5910.jpg"]'); + cy.get('.controls-background ng-icon[name="ionPlayOutline"]').click({scrollBehavior: false}); + + cy.wait(5000); // autoplay default delay is 5s + cy.get('app-gallery-lightbox-media img[alt="IMG_6220.jpg"]', {timeout: 2000}); + + }); + it('Gallery should auto open lightbox for IMG_5910.jpg', () => { // ignore noisy tests cy.on('fail', (err, runnable) => {