Skip to content

Commit

Permalink
publish test results
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic100 committed Oct 17, 2024
1 parent aa5acba commit 01cbf46
Show file tree
Hide file tree
Showing 7 changed files with 134 additions and 22 deletions.
27 changes: 18 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
run: yarn ci:build

e2e:
if: ${{ !startsWith(github.ref_name, 'dependabot') }}

runs-on: ubuntu-latest
needs: build

Expand All @@ -39,15 +41,22 @@ jobs:
yarn ci:build
yarn ci:e2e
build-doc:
runs-on: ubuntu-latest
needs: build
- uses: dorny/test-reporter@v1
if: ${{ (success() || failure()) && github.repository == 'mistic100/Photo-Sphere-Viewer' }}
with:
name: test-results
path: cypress/reports/junit/*.xml
reporter: java-junit

steps:
- uses: actions/checkout@v4
# build-doc:
# runs-on: ubuntu-latest
# needs: build

- name: setup
uses: ./.github/workflows/shared/setup
# steps:
# - uses: actions/checkout@v4

- name: build
run: yarn ci:build-doc
# - name: setup
# uses: ./.github/workflows/shared/setup

# - name: build
# run: yarn ci:build-doc
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ docs/.vitepress/.temp
!docs/.typedoc
dist
/public
cypress/reports
cypress/screenshots
6 changes: 6 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,11 @@ export default defineConfig({
viewportWidth: 1280,
viewportHeight: 900,
baseUrl: 'http://127.0.0.1:8080',
scrollBehavior: false,
screenshotOnRunFailure: false,
},
reporter: 'mocha-junit-reporter',
reporterOptions: {
mochaFile: 'cypress/reports/junit/report.xml',
},
});
58 changes: 50 additions & 8 deletions cypress/e2e/navbar.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { callViewer, waitNoLoader } from '../utils';
describe('navbar', () => {
beforeEach(() => {
localStorage.photoSphereViewer_touchSupport = 'false';
cy.visit('e2e/basic.html');
cy.visit('e2e/navbar.html');
waitNoLoader();
});

it('should add custom navbar button', () => {
it('should add custom button', () => {
const alertStub = cy.stub();
cy.on('window:alert', alertStub);

Expand All @@ -17,7 +17,7 @@ describe('navbar', () => {
});
});

it('should update caption', () => {
it('should update the caption', () => {
cy.get('.psv-caption-content').should('have.text', 'Parc national du Mercantour © Damien Sorel');

callViewer(viewer => viewer.setOption('caption', '<strong>Name:</strong> Lorem Ipsum'));
Expand All @@ -36,11 +36,8 @@ describe('navbar', () => {
.should('include.text', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit');
});

it('should enter and exit fullscreen', () => {
cy.document().its('fullscreenElement').should('be.null');

it.skip('should enter and exit fullscreen', () => {
cy.get('.psv-fullscreen-button').realClick();

cy.wait(500);

cy.document().its('fullscreenElement').should('not.be.null');
Expand All @@ -50,7 +47,52 @@ describe('navbar', () => {
cy.document().its('fullscreenElement').should('be.null');
});

it('should translate navbar buttons', () => {
it('should display a menu on small screens', () => {
cy.viewport(400, 800);

[
'.psv-caption-content',
'.psv-zoom-range',
'.psv-download-button',
'.custom-button:eq(0)',
].forEach(invisible => {
cy.get(invisible).should('not.be.visible');
});

[
'.psv-zoom-button',
'.psv-move-button',
'.psv-description-button',
'.psv-fullscreen-button',
'.psv-menu-button',
'.custom-button:eq(1)',
].forEach(visible => {
cy.get(visible).should('be.visible');
});

cy.get('.psv-menu-button').click();

cy.get('.psv-panel')
.should('be.visible')
.within(() => {
cy.get('.psv-panel-menu-title').should('contain.text', 'Menu');

cy.contains('Download').should('be.visible');
cy.contains('Click me').should('be.visible');
});
});

it('should close the menu on button click', () => {
cy.viewport(400, 800);

cy.get('.psv-menu-button').click();

cy.get('.psv-panel').contains('Click me').click();

cy.get('.psv-panel').should('not.be.visible')
});

it('should translate buttons', () => {
function assertTitles(titles: any) {
cy.get('.psv-zoom-button:eq(0)').invoke('attr', 'title').should('eq', titles.zoomOut);
cy.get('.psv-zoom-button:eq(1)').invoke('attr', 'title').should('eq', titles.zoomIn);
Expand Down
13 changes: 10 additions & 3 deletions examples/e2e/basic.html → examples/e2e/navbar.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,6 @@
panorama: baseUrl + 'sphere-small.jpg',
caption: 'Parc national du Mercantour <b>&copy; Damien Sorel</b>',
description: document.querySelector('#description').innerHTML,
loadingImg: baseUrl + 'loader.gif',
keyboard: 'always',
lang: {
myButton: 'Click me',
},
Expand All @@ -64,11 +62,20 @@
{
title: 'myButton',
className: 'custom-button',
content: '🔄',
content: '😺',
onClick(viewer) {
alert('Custom button clicked');
}
},
{
title: 'Other button',
className: 'custom-button',
content: '🍉',
collapsable: false,
onClick(viewer) {
alert('Custom button 2 clicked');
}
},
'caption',
'fullscreen',
],
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"ci:e2e": "node build/start-and-test.mjs \"watch --no-open\" e2e:run",
"ci:version": "set-versions --workspaces",
"ci:publish": "turbo run publish-dist --concurrency=1",
"e2e:open": "cypress open --e2e",
"e2e:open": "cypress open --e2e --browser=chrome",
"e2e:run": "cypress run --e2e",
"build-doc": "node ./build/generate-typedoc-readme.mjs && typedoc --plugin typedoc-plugin-extras --out public/api",
"watch": "node build/liveserver.mjs"
Expand All @@ -41,6 +41,7 @@
"eslint": "^8.57.0",
"inquirer": "^12.0.0",
"mocha": "^10.7.0",
"mocha-junit-reporter": "^2.2.1",
"postcss": "^8.4.21",
"prettier": "^2.8.8",
"scss-bundle": "^3.1.2",
Expand Down
47 changes: 46 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1823,6 +1823,11 @@ chardet@^0.7.0:
resolved "https://registry.yarnpkg.com/chardet/-/chardet-0.7.0.tgz#90094849f0937f2eedc2425d0d28a9e5f0cbad9e"
integrity sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==

[email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667"
integrity sha512-yrLQ/yVUFXkzg7EDQsPieE/53+0RlaWTs+wBrvW36cyilJ2SaDWfl4Yj7MtLTXleV9uEKefbAGUPv2/iWSooRA==

check-more-types@^2.24.0:
version "2.24.0"
resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600"
Expand Down Expand Up @@ -2035,6 +2040,11 @@ cross-spawn@^7.0.0, cross-spawn@^7.0.2, cross-spawn@^7.0.3:
shebang-command "^2.0.0"
which "^2.0.1"

[email protected]:
version "0.0.2"
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b"
integrity sha512-mCxBlsHFYh9C+HVpiEacem8FEBnMXgU9gy4zmNC+SXAZNB/1idgp/aulFJ4FgCi7GPEVbfyng092GqL2k2rmow==

css-functions-list@^3.2.3:
version "3.2.3"
resolved "https://registry.yarnpkg.com/css-functions-list/-/css-functions-list-3.2.3.tgz#95652b0c24f0f59b291a9fc386041a19d4f40dbe"
Expand Down Expand Up @@ -2067,7 +2077,7 @@ currently-unhandled@^0.4.1:

cypress-real-events@^1.13.0:
version "1.13.0"
resolved "http://nexus.main.forge/repository/npm-group-all/cypress-real-events/-/cypress-real-events-1.13.0.tgz#6b7cd32dcac172db1493608f97a2576c7d0bd5af"
resolved "https://registry.yarnpkg.com/cypress-real-events/-/cypress-real-events-1.13.0.tgz#6b7cd32dcac172db1493608f97a2576c7d0bd5af"
integrity sha512-LoejtK+dyZ1jaT8wGT5oASTPfsNV8/ClRp99ruN60oPj8cBJYod80iJDyNwfPAu4GCxTXOhhAv9FO65Hpwt6Hg==

cypress@^13.15.0:
Expand Down Expand Up @@ -3317,6 +3327,11 @@ is-binary-path@~2.1.0:
dependencies:
binary-extensions "^2.0.0"

is-buffer@~1.1.6:
version "1.1.6"
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be"
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w==

is-ci@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-3.0.1.tgz#db6ecbed1bd659c43dac0f45661e7674103d1867"
Expand Down Expand Up @@ -3782,6 +3797,15 @@ mathml-tag-names@^2.1.3:
resolved "https://registry.yarnpkg.com/mathml-tag-names/-/mathml-tag-names-2.1.3.tgz#4ddadd67308e780cf16a47685878ee27b736a0a3"
integrity sha512-APMBEanjybaPzUrfqU0IMU5I0AswKMH7k8OTLs0vvV4KZpExkTkY87nR/zpbuTPj+gARop7aGUbl11pnDfW6xg==

md5@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f"
integrity sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g==
dependencies:
charenc "0.0.2"
crypt "0.0.2"
is-buffer "~1.1.6"

mdast-util-to-hast@^13.0.0:
version "13.2.0"
resolved "https://registry.yarnpkg.com/mdast-util-to-hast/-/mdast-util-to-hast-13.2.0.tgz#5ca58e5b921cc0a3ded1bc02eed79a4fe4fe41f4"
Expand Down Expand Up @@ -3953,6 +3977,22 @@ mitt@^3.0.1:
resolved "https://registry.yarnpkg.com/mitt/-/mitt-3.0.1.tgz#ea36cf0cc30403601ae074c8f77b7092cdab36d1"
integrity sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==

mkdirp@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/mkdirp/-/mkdirp-3.0.1.tgz#e44e4c5607fb279c168241713cc6e0fea9adcb50"
integrity sha512-+NsyUUAZDmo6YVHzL/stxSu3t9YS1iljliy3BSDrXJ/dkn1KYdmtZODGGjLcc9XLgVVpH4KshHB8XmZgMhaBXg==

mocha-junit-reporter@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/mocha-junit-reporter/-/mocha-junit-reporter-2.2.1.tgz#739f5595d0f051d07af9d74e32c416e13a41cde5"
integrity sha512-iDn2tlKHn8Vh8o4nCzcUVW4q7iXp7cC4EB78N0cDHIobLymyHNwe0XG8HEHHjc3hJlXm0Vy6zcrxaIhnI2fWmw==
dependencies:
debug "^4.3.4"
md5 "^2.3.0"
mkdirp "^3.0.0"
strip-ansi "^6.0.1"
xml "^1.0.1"

mocha@^10.7.0:
version "10.7.0"
resolved "https://registry.yarnpkg.com/mocha/-/mocha-10.7.0.tgz#9e5cbed8fa9b37537a25bd1f7fb4f6fc45458b9a"
Expand Down Expand Up @@ -5761,6 +5801,11 @@ write-file-atomic@^5.0.1:
imurmurhash "^0.1.4"
signal-exit "^4.0.1"

xml@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
integrity sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==

y18n@^5.0.5:
version "5.0.8"
resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55"
Expand Down

0 comments on commit 01cbf46

Please sign in to comment.