Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions core/src/views/Setup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,20 +84,24 @@ describe('Default setup page', () => {
cy.mockInitialState('core', 'config', config)
cy.mount(SetupView)

// No DB radio selectors if only sqlite
cy.get('[data-cy-setup-form-field^="dbtype"]')
.should('not.exist')
.should('exist')
.should('not.be.visible')
.find('input')
.should('be.checked')

cy.get('[data-cy-setup-form-field="dbtype-sqlite"]').should('exist')

// Two warnings: sqlite and single db support
cy.get('[data-cy-setup-form-db-note="sqlite"]')
.should('be.visible')
cy.get('[data-cy-setup-form-db-note="single-db"]')
.should('be.visible')

// Admin login, password and data directory
// Admin login, password, data directory and db type
cy.get('[data-cy-setup-form-field]')
.should('be.visible')
.should('have.length', 3)
.should('have.length', 4)
})

it('Renders single DB mysql', () => {
Expand All @@ -110,9 +114,11 @@ describe('Default setup page', () => {
cy.mockInitialState('core', 'config', config)
cy.mount(SetupView)

// No DB radio selectors if only mysql
cy.get('[data-cy-setup-form-field^="dbtype"]')
.should('not.exist')
.should('exist')
.should('not.be.visible')
.find('input')
.should('be.checked')

// Single db support warning
cy.get('[data-cy-setup-form-db-note="single-db"]')
Expand All @@ -124,11 +130,11 @@ describe('Default setup page', () => {
cy.get('[data-cy-setup-form-db-note="sqlite"]')
.should('not.exist')

// Admin login, password, data directory, db user,
// Admin login, password, data directory, db type, db user,
// db password, db name and db host
cy.get('[data-cy-setup-form-field]')
.should('be.visible')
.should('have.length', 7)
.should('have.length', 8)
})

it('Changes fields from sqlite to mysql then oci', () => {
Expand Down
5 changes: 3 additions & 2 deletions core/src/views/Setup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@

<!-- Database type select -->
<fieldset class="setup-form__database-type">
<p v-if="!firstAndOnlyDatabase" :class="`setup-form__database-type-select--${DBTypeGroupDirection}`" class="setup-form__database-type-select">
<!-- Using v-show instead of v-if ensures that the input dbtype remains set even when only one database engine is available -->
<p v-show="!firstAndOnlyDatabase" :class="`setup-form__database-type-select--${DBTypeGroupDirection}`" class="setup-form__database-type-select">
<NcCheckboxRadioSwitch v-for="(name, db) in config.databases"
:key="db"
v-model="config.dbtype"
Expand All @@ -96,7 +97,7 @@
</NcCheckboxRadioSwitch>
</p>

<NcNoteCard v-else data-cy-setup-form-db-note="single-db" type="warning">
<NcNoteCard v-if="firstAndOnlyDatabase" data-cy-setup-form-db-note="single-db" type="warning">
{{ t('core', 'Only {firstAndOnlyDatabase} is available.', { firstAndOnlyDatabase }) }}<br>
{{ t('core', 'Install and activate additional PHP modules to choose other database types.') }}<br>
<a :href="links.adminSourceInstall" target="_blank" rel="noreferrer noopener">
Expand Down
Loading
Loading