it('See the current default app is the dashboard', () => {
cy.visit('/')
cy.url().should('match', /apps\/dashboard/)
+
+ // Also check the top logo link
cy.get('#nextcloud').click()
cy.url().should('match', /apps\/dashboard/)
})
})
it('See the default app order selector', () => {
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
- else cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['dashboard', 'files'])
})
})
})
it('See the default app is changed', () => {
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
- else cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['files', 'dashboard'])
})
- cy.get('#nextcloud').click()
- cy.url().should('match', /apps\/files/)
+ // Check the redirect to the default app works
+ cy.request({ url: '/', followRedirect: false }).then((response) => {
+ expect(response.status).to.eq(302)
+ expect(response).to.have.property('headers')
+ expect(response.headers.location).to.contain('/apps/files')
+ })
})
it('Toggle the "use custom default app" switch back to reset the default apps', () => {
})
it('See the default app is changed back to default', () => {
- cy.reload()
- cy.get('#nextcloud').click()
- cy.url().should('match', /apps\/dashboard/)
+ // Check the redirect to the default app works
+ cy.request({ url: '/', followRedirect: false }).then((response) => {
+ expect(response.status).to.eq(302)
+ expect(response).to.have.property('headers')
+ expect(response.headers.location).to.contain('/apps/dashboard')
+ })
})
})
})
it('See that the dashboard app is the first one', () => {
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
- else cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
+ // Check the app order settings UI
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['dashboard', 'files'])
})
- cy.get('.app-menu-main .app-menu-entry').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-app-id', 'dashboard')
- else cy.wrap($el).should('have.attr', 'data-app-id', 'files')
+ // Check the top app menu order
+ cy.get('.app-menu-main .app-menu-entry').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-app-id')).get()
+ expect(appIDs).to.deep.eq(['dashboard', 'files'])
})
})
cy.get('[data-cy-app-order] [data-cy-app-order-element="files"] [data-cy-app-order-button="up"]').click()
cy.get('[data-cy-app-order] [data-cy-app-order-element="files"] [data-cy-app-order-button="up"]').should('not.be.visible')
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
- else cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['files', 'dashboard'])
})
})
it('See the app menu order is changed', () => {
cy.reload()
- cy.get('.app-menu-main .app-menu-entry').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-app-id', 'files')
- else cy.wrap($el).should('have.attr', 'data-app-id', 'dashboard')
+ cy.get('.app-menu-main .app-menu-entry').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-app-id')).get()
+ expect(appIDs).to.deep.eq(['files', 'dashboard'])
})
})
})
})
it('See files is the default app', () => {
- cy.visit('/')
- cy.url().should('match', /apps\/files/)
-
- cy.get('.app-menu-main .app-menu-entry').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-app-id', 'files')
+ // Check the redirect to the default app works
+ cy.request({ url: '/', followRedirect: false }).then((response) => {
+ expect(response.status).to.eq(302)
+ expect(response).to.have.property('headers')
+ expect(response.headers.location).to.contain('/apps/files')
})
})
it('See the app order settings: files is the first one', () => {
cy.visit('/settings/user/theming')
cy.get('[data-cy-app-order]').scrollIntoView()
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').should('have.length', 4).each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
- else if (idx === 1) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ expect(elements).to.have.length(4)
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['files', 'dashboard', 'testapp1', 'testapp'])
})
})
})
it('Change the order of the other apps', () => {
+ cy.intercept('POST', '**/apps/provisioning_api/api/v1/config/users/core/apporder').as('setAppOrder')
+
+ // Move the testapp up twice, it should be the first one after files
+ cy.get('[data-cy-app-order] [data-cy-app-order-element="testapp"] [data-cy-app-order-button="up"]').click()
+ cy.wait('@setAppOrder')
cy.get('[data-cy-app-order] [data-cy-app-order-element="testapp"] [data-cy-app-order-button="up"]').click()
+ cy.wait('@setAppOrder')
+
+ // Can't get up anymore, files is enforced as default app
cy.get('[data-cy-app-order] [data-cy-app-order-element="testapp"] [data-cy-app-order-button="up"]').should('not.be.visible')
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
- else if (idx === 1) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'testapp')
- else if (idx === 2) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
+ // Check the final list order
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ expect(elements).to.have.length(4)
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['files', 'testapp', 'dashboard', 'testapp1'])
})
})
it('See the app menu order is changed', () => {
cy.reload()
- cy.get('.app-menu-main .app-menu-entry').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-app-id', 'files')
- else if (idx === 1) cy.wrap($el).should('have.attr', 'data-app-id', 'testapp')
- else if (idx === 2) cy.wrap($el).should('have.attr', 'data-app-id', 'dashboard')
+ cy.get('.app-menu-main .app-menu-entry').then(elements => {
+ expect(elements).to.have.length(4)
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-app-id')).get()
+ expect(appIDs).to.deep.eq(['files', 'testapp', 'dashboard', 'testapp1'])
})
})
})
})
it('See that the dashboard app is the first one', () => {
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
- else cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
+ // Check the app order settings UI
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['dashboard', 'files'])
})
- cy.get('.app-menu-main .app-menu-entry').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-app-id', 'dashboard')
- else cy.wrap($el).should('have.attr', 'data-app-id', 'files')
+ // Check the top app menu order
+ cy.get('.app-menu-main .app-menu-entry').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-app-id')).get()
+ expect(appIDs).to.deep.eq(['dashboard', 'files'])
})
})
cy.get('[data-cy-app-order] [data-cy-app-order-element="files"] [data-cy-app-order-button="up"]').click()
cy.get('[data-cy-app-order] [data-cy-app-order-element="files"] [data-cy-app-order-button="up"]').should('not.be.visible')
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
- else cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
+ // Check the app order settings UI
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['files', 'dashboard'])
})
})
})
it('See the app order is restored', () => {
- cy.get('[data-cy-app-order] [data-cy-app-order-element]').each(($el, idx) => {
- if (idx === 0) cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'dashboard')
- else cy.wrap($el).should('have.attr', 'data-cy-app-order-element', 'files')
+ cy.get('[data-cy-app-order] [data-cy-app-order-element]').then(elements => {
+ const appIDs = elements.map((idx, el) => el.getAttribute('data-cy-app-order-element')).get()
+ expect(appIDs).to.deep.eq(['dashboard', 'files'])
})
})