26
26
27
27
const baseUrl = Cypress . env ( 'baseUrl' )
28
28
const sourceUrl = new URL ( `${ baseUrl } /index.php/apps/collectives/Link%20Testing/Link%20Source` )
29
- let imageId , textId
29
+ let imageId , pdfId , textId
30
30
let anotherCollectiveFirstPageId , linkTargetPageId
31
31
32
- describe ( 'Page' , function ( ) {
32
+ describe ( 'Page Link Handling ' , function ( ) {
33
33
before ( function ( ) {
34
34
cy . login ( 'bob' , { route : '/apps/collectives' } )
35
35
cy . deleteAndSeedCollective ( 'Another Collective' )
@@ -48,12 +48,16 @@ describe('Page', function() {
48
48
cy . uploadFile ( 'test.png' , 'image/png' ) . then ( ( id ) => {
49
49
imageId = id
50
50
} )
51
+ cy . uploadFile ( 'test.pdf' , 'application/pdf' , 'Collectives/Link%20Testing/' ) . then ( ( id ) => {
52
+ pdfId = id
53
+ } )
51
54
} ) . then ( ( ) => {
52
55
cy . seedPageContent ( 'Link%20Testing/Link%20Source.md' , `
53
56
## Links supposed to open in viewer
54
57
55
58
* Absolute path to image in Nextcloud: [image](//test.png?fileId=${ imageId } )
56
59
* Absolute path to text file in Nextcloud: [test.md](//test.md?fileId=${ textId } )
60
+ * Relative path to pdf file in Nextcloud: [test.pdf](test.pdf?fileId=${ pdfId } )
57
61
58
62
## Links supposed to open in same window
59
63
@@ -176,6 +180,12 @@ describe('Page', function() {
176
180
edit : true ,
177
181
} )
178
182
} )
183
+ it ( 'Opens link with relative path to pdf in Nextcloud in viewer' , function ( ) {
184
+ let href = `/index.php/apps/files/?dir=/&openfile=${ pdfId } #relPath=test.pdf`
185
+ testLinkToViewer ( href , { fileName : 'test.pdf' , viewerFileElement : 'iframe' } )
186
+ href = `/index.php/apps/files/?dir=/Collectives/Link Testing&openfile=${ pdfId } #relPath=test.pdf`
187
+ testLinkToViewer ( href , { fileName : 'test.pdf' , viewerFileElement : 'iframe' , edit : true } )
188
+ } )
179
189
} )
180
190
181
191
describe ( 'Link handling to collectives' , function ( ) {
0 commit comments