Skip to content

Commit e531c0a

Browse files
authored
Merge pull request #2465 from nextcloud/backport/2463/stable30
2 parents f090612 + 61ebea8 commit e531c0a

23 files changed

Lines changed: 6078 additions & 174946 deletions

‎.eslintrc.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"globals": {
33
"appName": true,
44
"appVersion": true,
5-
"INJECT_CYPRESS_FONT": true,
65
"PLYR_ICONS": true,
76
"oc_defaults": true,
87
"__dirname": true

‎.github/workflows/cypress.yml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
- name: Install node dependencies & build app
6767
run: |
6868
npm ci
69-
TESTING=true npm run build --if-present
69+
npm run build --if-present
7070
7171
- name: Save context
7272
uses: buildjet/cache/save@e376f15c6ec6dc595375c78633174c7e5f92dc0e # v3
@@ -123,7 +123,6 @@ jobs:
123123
# https://github.com/cypress-io/github-action/issues/124
124124
COMMIT_INFO_MESSAGE: ${{ github.event.pull_request.title }}
125125
# Needed for some specific code workarounds
126-
TESTING: true
127126
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128127
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
129128
SPLIT: ${{ matrix.total-containers }}

‎css/index-vVhCG86e.chunk.css‎

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎css/main-DaDQ5vkn.chunk.css‎

Lines changed: 10 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎css/viewer-main.css‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
/* extracted by css-entry-points-plugin */
2-
@import './main-Baxqr7p5.chunk.css';
2+
@import './main-DaDQ5vkn.chunk.css';

‎cypress/e2e/visual-regression.cy.ts‎

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
*
2121
*/
2222

23-
describe('Visual regression tests ', function() {
23+
describe('Visual regression tests', function() {
2424
let randUser
2525

2626
before(function() {
@@ -36,18 +36,28 @@ describe('Visual regression tests ', function() {
3636
cy.login(user)
3737
cy.visit('/apps/files')
3838
})
39+
40+
cy.window().then((win) => {
41+
// Load roboto font for visual regression consistency
42+
win.loadRoboto = true
43+
win.document.body.style.fontFamily = 'Roboto'
44+
})
3945
})
4046

4147
it('See files in the list', function() {
42-
// TODO: Do we care about the file name being split by a ' ' in the text property?
4348
cy.getFile('test-card.mp4', { timeout: 10000 })
4449
.should('contain', 'test-card .mp4')
4550
cy.getFile('test-card.png', { timeout: 10000 })
4651
.should('contain', 'test-card .png')
4752
})
4853

4954
it('Open the viewer on file click', function() {
55+
cy.intercept('GET', '**/core/preview*').as('image1')
56+
cy.intercept('GET', '/remote.php/dav/files/*/test-card.mp4').as('video')
5057
cy.openFile('test-card.mp4')
58+
cy.wait('@video')
59+
// We preload images, so we can check its loading here and not when clicking next
60+
cy.wait('@image1')
5161
cy.get('body > .viewer').should('be.visible')
5262
})
5363

@@ -73,7 +83,7 @@ describe('Visual regression tests ', function() {
7383
.and('not.have.class', 'icon-loading')
7484
})
7585

76-
it('Take test-card.mp4 screenshot', function() {
86+
it('Take test-card.mp4 screenshot', { retries: 0 }, function() {
7787
cy.get('body > .viewer .modal-container .viewer__file.viewer__file--active video').then(video => {
7888
video.get(0).pause()
7989
video.get(0).currentTime = 1
@@ -99,14 +109,17 @@ describe('Visual regression tests ', function() {
99109
.and('not.have.class', 'icon-loading')
100110
})
101111

102-
it('Take test-card.png screenshot', function() {
112+
it('Take test-card.png screenshot', { retries: 0 }, function() {
103113
cy.compareSnapshot('image')
104114
})
105115

106116
it('Close and open image again', function() {
107117
cy.get('body > .viewer button.header-close').click()
108118
cy.get('body > .viewer').should('not.exist')
119+
120+
// No need to intercept the request again, it's cached
109121
cy.openFile('test-card.png')
122+
110123
cy.get('body > .viewer').should('be.visible')
111124
cy.get('body > .viewer .modal-header__name').should('contain', 'test-card.png')
112125
cy.get('body > .viewer .modal-container img').should('have.length', 1)
@@ -122,7 +135,7 @@ describe('Visual regression tests ', function() {
122135
.and('not.have.class', 'icon-loading')
123136
})
124137

125-
it('Take test-card.png screenshot 2', function() {
138+
it('Take test-card.png screenshot 2', { retries: 0 }, function() {
126139
cy.compareSnapshot('image2')
127140
})
128141

@@ -136,13 +149,14 @@ describe('Visual regression tests ', function() {
136149
hasPreview: false,
137150
fileid: 123,
138151
}
139-
152+
cy.intercept('GET', '/core/img/favicon.png').as('favicon')
140153
cy.window().then((win) => {
141154
win.OCA.Viewer.open({
142155
fileInfo,
143156
list: [fileInfo],
144157
})
145158
})
159+
cy.wait('@favicon')
146160

147161
cy.get('body > .viewer .modal-container img').should('have.length', 1)
148162
cy.get('body > .viewer .modal-container img').should('have.attr', 'src')
@@ -157,7 +171,7 @@ describe('Visual regression tests ', function() {
157171
.and('not.have.class', 'icon-loading')
158172
})
159173

160-
it('Take non-dav logo.png screenshot', function() {
174+
it('Take non-dav logo.png screenshot', { retries: 0 }, function() {
161175
cy.compareSnapshot('non-dav')
162176
})
163177
})
-930 Bytes
Loading
-1.88 KB
Loading
-3.66 KB
Loading
-664 Bytes
Loading

0 commit comments

Comments
 (0)