diff --git a/e2e/cypress/e2e/events/edit_event.cy.ts b/e2e/cypress/e2e/events/edit_event.cy.ts index cf3072ed9..0c78b9631 100644 --- a/e2e/cypress/e2e/events/edit_event.cy.ts +++ b/e2e/cypress/e2e/events/edit_event.cy.ts @@ -1,10 +1,14 @@ -import {setup, login, waitForPageLoad, SubNavBar, Workqueue, Modal} from '../../support/common'; +import {cloneDeep} from 'lodash'; + +import {setup, login, waitForPageLoad, SubNavBar, Workqueue, Modal, addItems} from '../../support/common'; import {EventEditor, PlanningList} from '../../support/planning'; +import {TEST_EVENTS} from '../../fixtures/events'; + +const list = new PlanningList(); +const editor = new EventEditor(); describe('Planning.Events: edit metadata', () => { - const editor = new EventEditor(); const subnav = new SubNavBar(); - const list = new PlanningList(); const workqueue = new Workqueue(); const modal = new Modal(); let event; @@ -173,3 +177,60 @@ describe('Planning.Events: edit metadata', () => { .should('be.enabled'); }); }); + +describe('Planing.Events: edit existing events', () => { + beforeEach(() => { + setup({fixture_profile: 'planning_prepopulate_data'}, '/#/planning'); + addItems('events', [{ + ...cloneDeep(TEST_EVENTS.date_01_02_2045), + dates: { + start: TEST_EVENTS.date_01_02_2045.dates.start, + end: TEST_EVENTS.date_01_02_2045.dates.end, + }, + }, { + ...cloneDeep(TEST_EVENTS.date_02_02_2045), + dates: { + start: TEST_EVENTS.date_02_02_2045.dates.start, + end: TEST_EVENTS.date_02_02_2045.dates.end, + tz: null, + }, + }]); + login(); + + waitForPageLoad.planning(); + }); + + it('SDESK-6972: Edit events with no timezone', () => { + // Test if we can edit an Event without a timezone value + list.item(0) + .dblclick(); + editor.waitTillOpen(); + editor.waitLoadingComplete(); + + editor.type({definition_short: 'Modifying 1st event'}); + editor.waitForAutosave(); + editor.saveButton + .should('exist') + .click(); + editor.closeButton + .should('exist') + .click(); + editor.waitTillClosed(); + + // test if we can edit an Event with a timezone value of `null` + list.item(1) + .dblclick(); + editor.waitTillOpen(); + editor.waitLoadingComplete(); + + editor.type({definition_short: 'Modifying 2nd event'}); + editor.waitForAutosave(); + editor.saveButton + .should('exist') + .click(); + editor.closeButton + .should('exist') + .click(); + editor.waitTillClosed(); + }); +}); diff --git a/server/features/events.feature b/server/features/events.feature index f7bd48396..30505f33d 100644 --- a/server/features/events.feature +++ b/server/features/events.feature @@ -1376,4 +1376,32 @@ Feature: Events { "assignment_id": null } - """ \ No newline at end of file + """ + + @auth + Scenario: Create events without a timezone + When we post to "/events" + """ + [{ + "guid": "event1", + "name": "No timezone defined", + "dates": { + "start": "2029-11-21T12:00:00.000Z", + "end": "2029-11-21T14:00:00.000Z" + } + }] + """ + Then we get OK response + When we post to "/events" + """ + [{ + "guid": "event2", + "name": "null timezone", + "dates": { + "start": "2029-11-21T12:00:00.000Z", + "end": "2029-11-21T14:00:00.000Z", + "tz": null + } + }] + """ + Then we get OK response \ No newline at end of file diff --git a/server/planning/events/events_schema.py b/server/planning/events/events_schema.py index 54134d973..4c207a78b 100644 --- a/server/planning/events/events_schema.py +++ b/server/planning/events/events_schema.py @@ -101,7 +101,10 @@ "type": "datetime", "nullable": True, }, - "tz": {"type": "string"}, + "tz": { + "type": "string", + "nullable": True, + }, "end_tz": {"type": "string"}, "all_day": {"type": "boolean"}, "no_end_time": {"type": "boolean"},