mirror of
https://github.com/nextcloud/server.git
synced 2026-04-15 22:11:17 -04:00
fix(cypress): adjust selectors
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
9a5b26675c
commit
fdf07fc759
13 changed files with 55 additions and 24 deletions
|
|
@ -22,6 +22,9 @@
|
|||
|
||||
<template>
|
||||
<tr :class="{'files-list__row--visible': visible, 'files-list__row--active': isActive}"
|
||||
data-cy-files-list-row
|
||||
:data-cy-files-list-row-fileid="fileid"
|
||||
:data-cy-files-list-row-name="source.basename"
|
||||
class="list__row"
|
||||
@contextmenu="onRightClick">
|
||||
<!-- Failed indicator -->
|
||||
|
|
@ -38,7 +41,7 @@
|
|||
</td>
|
||||
|
||||
<!-- Link to file -->
|
||||
<td class="files-list__row-name">
|
||||
<td class="files-list__row-name" data-cy-files-list-row-name>
|
||||
<!-- Icon or preview -->
|
||||
<span class="files-list__row-icon" @click="execDefaultAction">
|
||||
<FolderIcon v-if="source.type === 'folder'" />
|
||||
|
|
@ -81,6 +84,7 @@
|
|||
ref="basename"
|
||||
:aria-hidden="isRenaming"
|
||||
class="files-list__row-name-link"
|
||||
data-cy-files-list-row-name-link
|
||||
v-bind="linkTo"
|
||||
@click="execDefaultAction">
|
||||
<!-- File name -->
|
||||
|
|
@ -93,7 +97,10 @@
|
|||
</td>
|
||||
|
||||
<!-- Actions -->
|
||||
<td v-show="!isRenamingSmallScreen" :class="`files-list__row-actions-${uniqueId}`" class="files-list__row-actions">
|
||||
<td v-show="!isRenamingSmallScreen"
|
||||
:class="`files-list__row-actions-${uniqueId}`"
|
||||
class="files-list__row-actions"
|
||||
data-cy-files-list-row-actions>
|
||||
<!-- Render actions -->
|
||||
<CustomElementRender v-for="action in enabledRenderActions"
|
||||
:key="action.id"
|
||||
|
|
@ -115,6 +122,7 @@
|
|||
:key="action.id"
|
||||
:class="'files-list__row-action-' + action.id"
|
||||
:close-after-click="true"
|
||||
:data-cy-files-list-row-action="action.id"
|
||||
@click="onActionClick(action)">
|
||||
<template #icon>
|
||||
<NcLoadingIcon v-if="loading === action.id" :size="18" />
|
||||
|
|
@ -129,6 +137,7 @@
|
|||
<td v-if="isSizeAvailable"
|
||||
:style="{ opacity: sizeOpacity }"
|
||||
class="files-list__row-size"
|
||||
data-cy-files-list-row-size
|
||||
@click="openDetailsIfAvailable">
|
||||
<span>{{ size }}</span>
|
||||
</td>
|
||||
|
|
@ -136,6 +145,7 @@
|
|||
<!-- Mtime -->
|
||||
<td v-if="isMtimeAvailable"
|
||||
class="files-list__row-mtime"
|
||||
data-cy-files-list-row-mtime
|
||||
@click="openDetailsIfAvailable">
|
||||
<span>{{ mtime }}</span>
|
||||
</td>
|
||||
|
|
@ -145,6 +155,7 @@
|
|||
:key="column.id"
|
||||
:class="`files-list__row-${currentView?.id}-${column.id}`"
|
||||
class="files-list__row-column-custom"
|
||||
:data-cy-files-list-row-column-custom="column.id"
|
||||
@click="openDetailsIfAvailable">
|
||||
<CustomElementRender v-if="visible"
|
||||
:current-view="currentView"
|
||||
|
|
|
|||
|
|
@ -1,17 +1,17 @@
|
|||
<template>
|
||||
<table class="files-list">
|
||||
<table class="files-list" data-cy-files-list>
|
||||
<!-- Header -->
|
||||
<div ref="before" class="files-list__before">
|
||||
<slot name="before" />
|
||||
</div>
|
||||
|
||||
<!-- Header -->
|
||||
<thead ref="thead" class="files-list__thead">
|
||||
<thead ref="thead" class="files-list__thead" data-cy-files-list-thead>
|
||||
<slot name="header" />
|
||||
</thead>
|
||||
|
||||
<!-- Body -->
|
||||
<tbody :style="tbodyStyle" class="files-list__tbody">
|
||||
<tbody :style="tbodyStyle" class="files-list__tbody" data-cy-files-list-tbody>
|
||||
<component :is="dataComponent"
|
||||
v-for="(item, i) in renderedItems"
|
||||
:key="i"
|
||||
|
|
@ -22,7 +22,10 @@
|
|||
</tbody>
|
||||
|
||||
<!-- Footer -->
|
||||
<tfoot v-show="isReady" ref="tfoot" class="files-list__tfoot">
|
||||
<tfoot v-show="isReady"
|
||||
ref="tfoot"
|
||||
class="files-list__tfoot"
|
||||
data-cy-files-list-tfoot>
|
||||
<slot name="footer" />
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -21,11 +21,19 @@
|
|||
*/
|
||||
import { generateUrl } from '@nextcloud/router'
|
||||
import queryString from 'query-string'
|
||||
import Router from 'vue-router'
|
||||
import Router, { RawLocation, Route } from 'vue-router'
|
||||
import Vue from 'vue'
|
||||
import { ErrorHandler } from 'vue-router/types/router'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
// Prevent router from throwing errors when we're already on the page we're trying to go to
|
||||
const originalPush = Router.prototype.push as (to, onComplete?, onAbort?) => Promise<Route>
|
||||
Router.prototype.push = function push(to: RawLocation, onComplete?: ((route: Route) => void) | undefined, onAbort?: ErrorHandler | undefined): Promise<Route> {
|
||||
if (onComplete || onAbort) return originalPush.call(this, to, onComplete, onAbort)
|
||||
return originalPush.call(this, to).catch(err => err)
|
||||
}
|
||||
|
||||
const router = new Router({
|
||||
mode: 'history',
|
||||
|
||||
|
|
|
|||
|
|
@ -374,7 +374,13 @@ export default {
|
|||
*/
|
||||
setActiveTab(id) {
|
||||
OCA.Files.Sidebar.setActiveTab(id)
|
||||
this.tabs.forEach(tab => tab.setIsActive(id === tab.id))
|
||||
this.tabs.forEach(tab => {
|
||||
try {
|
||||
tab.setIsActive(id === tab.id)
|
||||
} catch (error) {
|
||||
logger.error('Error while setting tab active state', { error, id: tab.id, tab })
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -60,6 +60,9 @@ window.addEventListener('DOMContentLoaded', function() {
|
|||
TabInstance.update(fileInfo)
|
||||
},
|
||||
setIsActive(isActive) {
|
||||
if (!TabInstance) {
|
||||
return
|
||||
}
|
||||
TabInstance.setIsActive(isActive)
|
||||
},
|
||||
destroy() {
|
||||
|
|
|
|||
|
|
@ -32,6 +32,6 @@ describe('Login with a new user and open the files app', function() {
|
|||
|
||||
it('See the default file welcome.txt in the files list', function() {
|
||||
cy.visit('/apps/files')
|
||||
cy.get('.files-fileList tr').should('contain', 'welcome.txt')
|
||||
cy.get('[data-cy-files-list] [data-cy-files-list-row-name="welcome.txt"]').should('be.visible')
|
||||
})
|
||||
})
|
||||
|
|
|
|||
|
|
@ -36,15 +36,15 @@ export function uploadThreeVersions(user: User, fileName: string) {
|
|||
}
|
||||
|
||||
export function openVersionsPanel(fileName: string) {
|
||||
cy.get(`[data-file="${fileName}"]`).within(() => {
|
||||
cy.get('[data-action="menu"]')
|
||||
.click()
|
||||
|
||||
cy.get('.fileActionsMenu')
|
||||
.get('.action-details')
|
||||
cy.get(`[data-cy-files-list] [data-cy-files-list-row-name="${fileName}"]`).within(() => {
|
||||
cy.get('[data-cy-files-list-row-actions] .action-item__menutoggle')
|
||||
.click()
|
||||
})
|
||||
|
||||
cy.get('.action-item__popper')
|
||||
.get('[data-cy-files-list-row-action="details"]')
|
||||
.click()
|
||||
|
||||
cy.get('#app-sidebar-vue')
|
||||
.get('[aria-controls="tab-version_vue"]')
|
||||
.click()
|
||||
|
|
|
|||
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files-sidebar.js
vendored
4
dist/files-sidebar.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-sidebar.js.map
vendored
2
dist/files-sidebar.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files_versions-files_versions.js
vendored
4
dist/files_versions-files_versions.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files_versions-files_versions.js.map
vendored
2
dist/files_versions-files_versions.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue