Skip to content

Commit

Permalink
fix: update TransferContext modal
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck <32180937+enjeck@users.noreply.github.com>
  • Loading branch information
enjeck committed Jun 28, 2024
2 parents 16c9830 + 588a259 commit e6b51bf
Show file tree
Hide file tree
Showing 373 changed files with 6,190 additions and 900 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress-custom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
matrix:
node-version: [ 16 ]
databases: [ 'mysql' ]
server-versions: [ 'stable26', 'stable27', 'master' ]
server-versions: [ 'stable26', 'stable27', 'stable28', 'stable29', 'master' ]
include:
- php-versions: 8.1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
strategy:
fail-fast: false
matrix:
server-versions: ['stable26', 'stable27', 'master']
server-versions: ['stable26', 'stable27', 'stable28', 'stable29', 'master']
php-versions: ['8.1']
databases: ['mysql']
include:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/npm-audit-fix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
strategy:
fail-fast: false
matrix:
branches: ['main', 'master', 'stable28', 'stable27', 'stable26']
branches: ['main', 'master', 'stable29', 'stable28', 'stable27', 'stable26']

name: npm-audit-fix-${{ matrix.branches }}

Expand Down
3 changes: 3 additions & 0 deletions appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,12 +131,15 @@

['name' => 'ApiFavorite#create', 'url' => '/api/2/favorites/{nodeType}/{nodeId}', 'verb' => 'POST', 'requirements' => ['nodeType' => '(\d+)', 'nodeId' => '(\d+)']],
['name' => 'ApiFavorite#destroy', 'url' => '/api/2/favorites/{nodeType}/{nodeId}', 'verb' => 'DELETE', 'requirements' => ['nodeType' => '(\d+)', 'nodeId' => '(\d+)']],

['name' => 'Context#index', 'url' => '/api/2/contexts', 'verb' => 'GET'],
['name' => 'Context#show', 'url' => '/api/2/contexts/{contextId}', 'verb' => 'GET'],
['name' => 'Context#create', 'url' => '/api/2/contexts', 'verb' => 'POST'],
['name' => 'Context#update', 'url' => '/api/2/contexts/{contextId}', 'verb' => 'PUT'],
['name' => 'Context#destroy', 'url' => '/api/2/contexts/{contextId}', 'verb' => 'DELETE'],
['name' => 'Context#transfer', 'url' => '/api/2/contexts/{contextId}/transfer', 'verb' => 'PUT'],
['name' => 'Context#updateContentOrder', 'url' => '/api/2/contexts/{contextId}/pages/{pageId}', 'verb' => 'PUT'],

['name' => 'RowOCS#createRow', 'url' => '/api/2/{nodeCollection}/{nodeId}/rows', 'verb' => 'POST', 'requirements' => ['nodeCollection' => '(tables|views)', 'nodeId' => '(\d+)']],
]
];
12 changes: 11 additions & 1 deletion cypress.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,21 @@ const { defineConfig } = require('cypress')

module.exports = defineConfig({
projectId: 'ixbf9n',

e2e: {
baseUrl: 'http://nextcloud.local/index.php/',
setupNodeEvents(on, config) {
// implement node event listeners here
},
pageLoadTimeout: 120000,
pageLoadTimeout: 120000,
},

component: {
devServer: {
framework: 'vue',
bundler: 'webpack',
},
viewportWidth: 800,
viewportHeight: 600,
},
})
110 changes: 110 additions & 0 deletions cypress/component/ContentReferenceWidget.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
import ContentReferenceWidget from '../../src/views/ContentReferenceWidget.vue'

describe('ContentReferenceWidget', () => {
let richObject = {}

before(() => {
// Load the richObject from a fixture
cy.fixture('widgets/richObject.json')
.then(richObjectFixture => {
richObject = richObjectFixture
})
})

it('mounts', () => {
mountContentWidget(richObject)

const title = `${richObject.emoji} ${richObject.title}`

// Verify the table loaded the richObject
// by checking the title
cy.get('.tables-content-widget h2').as('heading')
cy.get('@heading').contains(title)
})

it('can search rows', () => {
mountContentWidget(richObject)

const searchTerm = 'cat'

// Search for the row including the above search term
cy.get('@options').find('input').type(searchTerm)

// Ensure there is only one resultant row and
// verify the row correctly includes the search term
cy.get('@rows').its('length').should('equal', 1)
cy.get('@rows').first().as('firstRow')
cy.get('@firstRow').children().first().contains(searchTerm, { matchCase: false })
})

it('can create a row', () => {
mountContentWidget(richObject);

// Load a fixture used to reply to the create row request
cy.fixture('widgets/createRow.json')
.then((rowData) => {
cy.reply('**/index.php/apps/tables/row', rowData)
})

// Click the Create Row button
cy.get('@options').find('button').click()

// Input row data
cy.get('[data-cy="Name"] input').type('Hello')
cy.get('[data-cy="Account manager"] input').type('World')

// Create the row and make sure the modal disappears
cy.get('[data-cy="createRowSaveButton"]').click()
cy.get('.modal__content').should('not.exist')

// Make sure the row was added and is visible
cy.get('@rows').last().children().as('createdRow')
cy.get('@createdRow').first().contains('Hello')
cy.get('@createdRow').next().contains('World')
})

it('can edit a row', () => {
mountContentWidget(richObject)

// Load a fixture which is used to reply to the edit row request
cy.fixture('widgets/editRow.json')
.then((rowData) => {
cy.reply('**/index.php/apps/tables/row/*', rowData)
})

// Click the edit button on the first row
cy.get('@rows').first().find('td.sticky button').click({ force: true })

// Get the first field of the Edit Row modal
cy.get('.modal__content').as('editRowModal')
cy.get('@editRowModal').find('.row.space-T').as('fields')
cy.get('@fields').first().find('input').as('editNameField')

// Clear the current input and enter a new value
cy.get('@editNameField').clear()
cy.get('@editNameField').type('Giraffe')

// Edit the row and make sure the modal disappears
cy.get('[data-cy="editRowSaveButton"]').click()
cy.get('@editRowModal').should('not.exist')

// Check the edited row for the new value
cy.get('@rows').first().children().as('editedRow')
cy.get('@editedRow').first().contains('Giraffe')
})
})

function mountContentWidget(richObject) {
cy.reply('**/index.php/apps/tables/row/table/*', richObject.rows)

cy.mount(ContentReferenceWidget, {
propsData: {
richObject,
},
})

// Get some often used elements
cy.get('.tables-content-widget > .options').as('options')
cy.get('.tables-content-widget .NcTable table').as('table')
cy.get('@table').find('tbody tr[data-cy="customTableRow"]').as('rows')
}
2 changes: 1 addition & 1 deletion cypress/e2e/column-selection.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('Test column ' + columnTitle, () => {
cy.get('.modal__content h2').contains('Create row').should('be.visible')
cy.get('.modal__content .title').contains(columnTitle).should('be.visible')
cy.get('.modal__content .title').click()
cy.get('.modal__content .select span[title="second option"]').should('be.visible')
cy.get('.vs__dropdown-toggle .vs__selected span[title="second option"]').should('exist')
cy.get('button').contains('Save').click()
cy.get('.custom-table table tr td div').contains('second option').should('be.visible')

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/tables-table.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ describe('Manage a table', () => {
cy.get('[data-cy="editTableModal"]').should('not.exist')
cy.get('[data-cy="transferTableModal"]').should('be.visible')
cy.get('[data-cy="transferTableModal"] input[type="search"]').clear().type(targetUserTransfer.userId)
cy.get(`.vs__dropdown-menu [user="${targetUserTransfer.userId}"]`).click()
cy.get(`.vs__dropdown-menu [id="${targetUserTransfer.userId}"]`).click()
cy.get('[data-cy="transferTableButton"]').should('be.enabled').click()
cy.get('.toastify.toast-success').should('be.visible')
cy.get('.app-navigation__list').contains('test table').should('not.exist')
Expand Down
42 changes: 42 additions & 0 deletions cypress/fixtures/widgets/createRow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"id": 229,
"tableId": 49,
"createdBy": null,
"createdAt": null,
"lastEditBy": null,
"lastEditAt": null,
"data": [
{
"columnId": 159,
"value": "Hello"
},
{
"columnId": 160,
"value": "World"
},
{
"columnId": 161,
"value": ""
},
{
"columnId": 162,
"value": "2024-05-30"
},
{
"columnId": 164,
"value": ""
},
{
"columnId": 165,
"value": ""
},
{
"columnId": 166,
"value": 30
},
{
"columnId": 167,
"value": ""
}
]
}
46 changes: 46 additions & 0 deletions cypress/fixtures/widgets/editRow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"id": 226,
"tableId": 49,
"createdBy": null,
"createdAt": null,
"lastEditBy": null,
"lastEditAt": null,
"data": [
{
"columnId": 159,
"value": "Giraffe"
},
{
"columnId": 160,
"value": "Mr. Smith"
},
{
"columnId": 161,
"value": "Dog food every week"
},
{
"columnId": 162,
"value": "2023-01-01"
},
{
"columnId": 163,
"value": "2023-12-31"
},
{
"columnId": 164,
"value": "The dog is our best friend."
},
{
"columnId": 165,
"value": "Standard, SLA Level 2"
},
{
"columnId": 166,
"value": 80
},
{
"columnId": 167,
"value": "Likes treats"
}
]
}
Loading

0 comments on commit e6b51bf

Please sign in to comment.