forked from JeremyHeleine/Photo-Sphere-Viewer
-
-
Notifications
You must be signed in to change notification settings - Fork 693
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
34 changed files
with
318 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import type { GalleryPlugin } from '@photo-sphere-viewer/gallery-plugin'; | ||
import { getPlugin, getViewer, waitViewerReady } from '../../utils'; | ||
import { BASE_URL } from '../../utils/constants'; | ||
|
||
describe('plugin: gallery', () => { | ||
let first = true; | ||
|
||
beforeEach(() => { | ||
cy.visit('e2e/gallery.html'); | ||
waitViewerReady(); | ||
if (first) { // wait for async thumbnails | ||
cy.wait(1000); | ||
first = false; | ||
} | ||
// createBaseSnapshot(); | ||
}); | ||
|
||
it('should have a gallery', () => { | ||
cy.get('.psv-gallery') | ||
.should('be.visible') | ||
.compareScreenshots('base'); | ||
}); | ||
|
||
it('should display in fullscreen', { | ||
viewportWidth: 400, | ||
viewportHeight: 800, | ||
}, () => { | ||
cy.get('.psv-gallery') | ||
.then(gallery => { | ||
const { x, y, width, height } = gallery[0].getBoundingClientRect(); | ||
return { x, y, width, height }; | ||
}) | ||
.should('deep.equal', { x: 0, y: 0, width: 400, height: 760 }); | ||
|
||
cy.get('.psv-gallery').compareScreenshots('mobile'); | ||
|
||
cy.get('.psv-gallery .psv-panel-close-button').click(); | ||
|
||
cy.get('.psv-gallery').should('not.be.visible'); | ||
}); | ||
|
||
it('should add a navbar button', () => { | ||
cy.get('.psv-gallery-button') | ||
.should('be.visible') | ||
.should('have.class', 'psv-button--active') | ||
.click() | ||
.should('not.have.class', 'psv-button--active'); | ||
|
||
cy.get('.psv-gallery').should('not.be.visible'); | ||
}); | ||
|
||
it('should highlight the current item', () => { | ||
cy.get('[data-psv-gallery-item=sphere]').should('have.class', 'psv-gallery-item--active'); | ||
|
||
getViewer('change panorama').then(viewer => viewer.setPanorama(BASE_URL + 'sphere-test.jpg')); | ||
waitViewerReady(); | ||
|
||
cy.get('[data-psv-gallery-item=sphere]').should('not.have.class', 'psv-gallery-item--active'); | ||
cy.get('[data-psv-gallery-item=test-sphere]').should('have.class', 'psv-gallery-item--active'); | ||
|
||
getViewer('change panorama').then(viewer => viewer.setPanorama(BASE_URL + 'sphere-cropped.jpg')); | ||
waitViewerReady(); | ||
|
||
cy.get('.psv-gallery-item--active').should('not.exist'); | ||
}); | ||
|
||
it('should change the panorama when clicked', () => { | ||
cy.get('[data-psv-gallery-item=test-sphere]').click(); | ||
waitViewerReady(); | ||
|
||
getViewer('check panorama').then(viewer =>expect(viewer.config.panorama as string).to.eq(BASE_URL + 'sphere-test.jpg')); | ||
cy.get('.psv-caption-content').should('have.text', 'Test sphere'); // use name as caption | ||
|
||
cy.get('[data-psv-gallery-item=1]').click(); | ||
waitViewerReady(); | ||
|
||
cy.get('.psv-caption-content').should('have.text', 'Cape Florida Light, Key Biscayne © Pixexid'); | ||
}); | ||
|
||
function getGallery(log: string) { | ||
return getPlugin<GalleryPlugin>('gallery', log); | ||
} | ||
|
||
}); |
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export const BASE_URL = 'https://photo-sphere-viewer-data.netlify.app/assets/'; | ||
export const NO_LOG = { log: false }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.