Skip to content

Commit

Permalink
chore: migrate cypress to ts
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <[email protected]>
  • Loading branch information
skjnldsv committed Sep 6, 2023
1 parent 4523801 commit 12c6052
Show file tree
Hide file tree
Showing 46 changed files with 130 additions and 1,029 deletions.
6 changes: 2 additions & 4 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import type { Configuration } from 'webpack'
import { configureNextcloud, startNextcloud, stopNextcloud, waitOnNextcloud } from './cypress/dockerNode'
import { defineConfig } from 'cypress'

import browserify from '@cypress/browserify-preprocessor'
import webpackPreprocessor from '@cypress/webpack-preprocessor'
import getCompareSnapshotsPlugin from 'cypress-visual-regression/dist/plugin'

export default defineConfig({
Expand Down Expand Up @@ -40,8 +40,6 @@ export default defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
async setupNodeEvents(on, config) {
// Fix browserslist extend https://github.com/cypress-io/cypress/issues/2983#issuecomment-570616682
on('file:preprocessor', browserify())
getCompareSnapshotsPlugin(on, config)

// Disable spell checking to prevent rendering differences
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import audioTest from '../mixins/audio.js'
import audioTest from '../mixins/audio'

describe('Open audio.mp3 in viewer', function() {
audioTest('audio.mp3', 'audio/mpeg')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import audioTest from '../mixins/audio.js'
import audioTest from '../mixins/audio'

describe('Open audio.ogg in viewer', function() {
audioTest('audio.ogg', 'audio/ogg')
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import imageTest from '../mixins/image.js'
import imageTest from '../mixins/image'

describe('Open image-apng.png in viewer', function() {
imageTest('image-apng.png', 'image/png')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import imageTest from '../mixins/image.js'
import imageTest from '../mixins/image'

describe('Open image-small.png in viewer', function() {
imageTest('image-small.png', 'image/png')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import imageTest from '../mixins/image.js'
import imageTest from '../mixins/image'

describe('Open image.gif in viewer', function() {
imageTest('image.gif', 'image/gif', '/remote.php/dav/files')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import imageTest from '../mixins/image.js'
import imageTest from '../mixins/image'

describe('Open image.ico in viewer', function() {
imageTest('image.ico', 'image/x-icon', '/remote.php/dav/files')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import imageTest from '../mixins/image.js'
import imageTest from '../mixins/image'

describe('Open image.png in viewer', function() {
imageTest('image.png', 'image/png')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import imageTest from '../mixins/image.js'
import imageTest from '../mixins/image'

describe('Open image.svg in viewer', function() {
imageTest('image.svg', 'image/svg+xml', 'data:image/svg+xml;base64')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import imageTest from '../mixins/image.js'
import imageTest from '../mixins/image'

describe('Open image.webp in viewer', function() {
imageTest('image.webp', 'image/webp')
Expand Down
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.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import runTest from '../mixins/oddname.js'
import runTest from '../mixins/oddname'

for (const [file, type] of [
['audio.mp3', 'audio/mpeg'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import runTest from '../mixins/oddname.js'
import runTest from '../mixins/oddname'

for (const [file, type] of [
['image1.jpg', 'image/jpeg'],
Expand Down
3 changes: 0 additions & 3 deletions cypress/e2e/oddname/oddname-sidebar.cy.js

This file was deleted.

3 changes: 3 additions & 0 deletions cypress/e2e/oddname/oddname-sidebar.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import runTest from '../mixins/oddname'

runTest('image.png', 'image/png', true)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import runTest from '../mixins/oddname.js'
import runTest from '../mixins/oddname'

for (const [file, type] of [
['video1.mp4', 'video/mp4'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe(`Download ${fileName} in viewer`, function() {

// Open the share menu
cy.get(`.sharing-link-list > .sharing-entry > .action-item[href*='/s/${token}'] + .sharing-entry__actions .action-item__menutoggle`).click()
cy.get('.action-button:contains(\'Customize link\')').click()
cy.get('label:contains(\'Hide download\')').as('hideDownloadBtn').click()
cy.get('@hideDownloadBtn').prev('input[type=checkbox]').should('be.checked')

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import videoTest from '../mixins/video.js'
import videoTest from '../mixins/video'

describe('Open video.mkv in viewer', function() {
videoTest('video.mkv', 'image/mkv')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import videoTest from '../mixins/video.js'
import videoTest from '../mixins/video'

describe('Open video1.mp4 in viewer', function() {
videoTest('video1.mp4', 'video/mp4')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import videoTest from '../mixins/video.js'
import videoTest from '../mixins/video'

describe('Open video.ogv in viewer', function() {
videoTest('video.ogv', 'video/ogv')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
*/

import videoTest from '../mixins/video.js'
import videoTest from '../mixins/video'

describe('Open video.webm in viewer', function() {
videoTest('video.webm', 'video/webm')
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion cypress/support/e2e.js → cypress/support/e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands.js'
import './commands'
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit 12c6052

Please sign in to comment.