|
| 1 | +/** |
| 2 | + * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors |
| 3 | + * SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | + */ |
| 5 | + |
| 6 | +import { navigateToTimeline } from './timelines.ts' |
| 7 | +import { setupPhotosTests } from './photosUtils.ts' |
| 8 | +import type { User } from '@nextcloud/cypress' |
| 9 | + |
| 10 | +const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/ |
| 11 | +Cypress.on('uncaught:exception', (err) => { |
| 12 | + /* returning false here prevents Cypress from failing the test */ |
| 13 | + if (resizeObserverLoopErrRe.test(err.message)) { |
| 14 | + return false |
| 15 | + } |
| 16 | +}) |
| 17 | + |
| 18 | +let alice: User |
| 19 | + |
| 20 | +describe('View list of photos in the main timeline', () => { |
| 21 | + before(() => { |
| 22 | + setupPhotosTests() |
| 23 | + .then((setupInfo) => { |
| 24 | + alice = setupInfo.alice |
| 25 | + }) |
| 26 | + }) |
| 27 | + |
| 28 | + beforeEach(() => { |
| 29 | + cy.login(alice) |
| 30 | + cy.visit('/apps/photos') |
| 31 | + }) |
| 32 | + |
| 33 | + it('Apply date range filter to timeline', () => { |
| 34 | + cy.get('[data-cy-timeline-action="toggle-filters"]').click() |
| 35 | + cy.get('[data-cy-timeline-filters="date-range"] input[name="date"]').type('2020-01-01 ~ 2020-12-31{enter}', { scrollBehavior: 'nearest' }) |
| 36 | + cy.get('[data-test="media"]').should('have.length', 2) |
| 37 | + cy.get('[data-cy-timeline-filters="date-range"] input[name="date"]').clear() |
| 38 | + cy.get('[data-cy-timeline-filters="date-range"] input[name="date"]').type('{enter}') |
| 39 | + cy.get('[data-test="media"]').should('have.length', 5) |
| 40 | + cy.get('[data-cy-timeline-action="toggle-filters"]').click() |
| 41 | + }) |
| 42 | + |
| 43 | + // TODO: Needs https://github.com/nextcloud/server/pull/52542 to work |
| 44 | + xit('Apply places filter to timeline', () => { |
| 45 | + cy.get('[data-cy-timeline-action="toggle-filters"]').click() |
| 46 | + cy.get('[data-cy-timeline-filters="places"] input[type="search"]').type('Lauris{enter}', { scrollBehavior: 'nearest' }) |
| 47 | + cy.get('[data-test="media"]').should('have.length', 1) |
| 48 | + cy.get('[data-cy-timeline-filters="places"] input[type="search"]').type('Annot{enter}', { scrollBehavior: 'nearest' }) |
| 49 | + cy.get('[data-test="media"]').should('have.length', 2) |
| 50 | + cy.get('[data-cy-timeline-filters="places"] input[type="search"]').clear() |
| 51 | + cy.get('[data-test="media"]').should('have.length', 5) |
| 52 | + cy.get('[data-cy-timeline-action="toggle-filters"]').click() |
| 53 | + }) |
| 54 | + |
| 55 | + it('Toggling filters resets filters', () => { |
| 56 | + cy.get('[data-cy-timeline-action="toggle-filters"]').click() |
| 57 | + cy.get('[data-cy-timeline-filters="date-range"]').click() |
| 58 | + cy.get('[data-cy-timeline-filters="date-range"] input[name="date"]').type('2020-01-01 ~ 2020-12-31{enter}', { scrollBehavior: 'nearest' }) |
| 59 | + cy.get('[data-cy-timeline-action="toggle-filters"]').click() |
| 60 | + cy.get('[data-test="media"]').should('have.length', 5) |
| 61 | + }) |
| 62 | + |
| 63 | + it('Changing view resets filters', () => { |
| 64 | + cy.get('[data-cy-timeline-action="toggle-filters"]').click() |
| 65 | + cy.get('[data-cy-timeline-filters="date-range"]').click() |
| 66 | + cy.get('[data-cy-timeline-filters="date-range"] input[name="date"]').type('2020-01-01 ~ 2020-12-31{enter}', { scrollBehavior: 'nearest' }) |
| 67 | + navigateToTimeline('photos') |
| 68 | + cy.get('[data-test="media"]').should('have.length', 5) |
| 69 | + }) |
| 70 | + |
| 71 | +}) |
0 commit comments