Skip to content

Commit a180626

Browse files
committed
fix(tests): Update row creation mock and adjust import order in component setup
Signed-off-by: Enjeck C. <[email protected]>
1 parent 4aa7528 commit a180626

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

cypress/component/ContentReferenceWidget.cy.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ describe('ContentReferenceWidget', () => {
4848
cy.fixture('widgets/createRow.json')
4949
.then((rowData) => {
5050
cy.reply('**/ocs/v2.php/apps/tables/api/2/tables/*/rows', rowData)
51+
52+
// Also mock the reload rows endpoint to return updated rows including the new one
53+
const updatedRows = [...richObject.rows, rowData]
54+
cy.reply('**/apps/tables/row/table/*', updatedRows)
5155
})
5256

5357
// Click the Create Row button
@@ -62,7 +66,6 @@ describe('ContentReferenceWidget', () => {
6266
cy.get('.modal__content').should('not.exist')
6367

6468
// Make sure the row was added and is visible
65-
cy.wait(1000) // Wait for the row to be added
6669
cy.get('@rows').last().children().as('createdRow')
6770
cy.get('@createdRow').first().contains('Hello')
6871
cy.get('@createdRow').next().contains('World')
@@ -100,7 +103,7 @@ describe('ContentReferenceWidget', () => {
100103
})
101104

102105
function mountContentWidget(richObject) {
103-
cy.reply('**/index.php/apps/tables/row/table/*', richObject.rows)
106+
cy.reply('**/apps/tables/row/table/*', richObject.rows)
104107

105108
cy.mount(ContentReferenceWidget, {
106109
propsData: {

cypress/support/component.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ import { mount } from 'cypress/vue2'
66
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
77
import { createPinia, PiniaVuePlugin } from 'pinia'
88
import Vue from 'vue'
9-
10-
import '../styleguide/global.requires.js'
11-
129
Vue.use(PiniaVuePlugin)
1310
const pinia = createPinia()
1411

12+
import '../styleguide/global.requires.js'
13+
1514
// Styles necessary for rendering the component
1615
import '../styleguide/assets/default.css'
1716
import '../styleguide/assets/additional.css'

0 commit comments

Comments
 (0)