From def45ff2172081fa5544c37caebab411467bd104 Mon Sep 17 00:00:00 2001 From: Eduard Aksamitov Date: Tue, 19 Mar 2024 10:40:07 +0300 Subject: [PATCH] feat(planner): new slots, fixes and improvements (#4961) Signed-off-by: Eduard Aksamitov --- models/time/src/index.ts | 4 +- packages/theme/styles/_layouts.scss | 1 + packages/theme/styles/_lumia-colors.scss | 5 + packages/theme/styles/common.scss | 9 ++ packages/ui/src/components/ButtonBase.svelte | 7 +- packages/ui/src/components/Hotkey.svelte | 50 +++++++ packages/ui/src/components/HotkeyGroup.svelte | 25 ++++ .../ui/src/components/icons/KeyCommand.svelte | 12 ++ .../ui/src/components/icons/KeyOption.svelte | 8 ++ .../ui/src/components/icons/KeyShift.svelte | 8 ++ packages/ui/src/index.ts | 5 + .../src/components/DateEditor.svelte | 77 +++++----- .../src/components/EditEvent.svelte | 2 +- .../src/components/EventTimeEditor.svelte | 14 +- .../src/components/ReccurancePopup.svelte | 2 +- plugins/time-assets/assets/icons.svg | 8 +- plugins/time-assets/lang/en.json | 3 +- plugins/time-assets/lang/es.json | 3 +- plugins/time-assets/lang/pt.json | 3 +- plugins/time-assets/lang/ru.json | 3 +- plugins/time-assets/src/index.ts | 2 +- .../src/components/CreateToDoPopup.svelte | 131 +++++++++--------- .../src/components/DueDateEditor.svelte | 41 +++--- .../src/components/EditToDo.svelte | 7 +- .../src/components/PriorityEditor.svelte | 2 +- .../src/components/ToDoDuration.svelte | 35 +---- .../src/components/Workslots.svelte | 119 +++++++++++----- plugins/time-resources/src/plugin.ts | 3 +- plugins/time-resources/src/utils.ts | 50 ++++++- plugins/time/src/index.ts | 8 +- tests/create-local.sh | 2 +- .../tests/model/planning/planning-page.ts | 49 ++++--- 32 files changed, 458 insertions(+), 240 deletions(-) create mode 100644 packages/ui/src/components/Hotkey.svelte create mode 100644 packages/ui/src/components/HotkeyGroup.svelte create mode 100644 packages/ui/src/components/icons/KeyCommand.svelte create mode 100644 packages/ui/src/components/icons/KeyOption.svelte create mode 100644 packages/ui/src/components/icons/KeyShift.svelte diff --git a/models/time/src/index.ts b/models/time/src/index.ts index 4bf2aedb54..c9eb03617a 100644 --- a/models/time/src/index.ts +++ b/models/time/src/index.ts @@ -236,7 +236,7 @@ export function createModel (builder: Builder): void { } }, label: time.string.CreateToDo, - icon: time.icon.Target, + icon: time.icon.Calendar, keyBinding: [], input: 'none', category: time.category.Time, @@ -262,7 +262,7 @@ export function createModel (builder: Builder): void { } }, label: time.string.CreateToDo, - icon: time.icon.Target, + icon: time.icon.Calendar, keyBinding: [], input: 'none', category: time.category.Time, diff --git a/packages/theme/styles/_layouts.scss b/packages/theme/styles/_layouts.scss index c8f29cd29a..832ed77c7f 100644 --- a/packages/theme/styles/_layouts.scss +++ b/packages/theme/styles/_layouts.scss @@ -699,6 +699,7 @@ input.search { .min-w-8 { min-width: 2rem; } .min-w-9 { min-width: 2.25rem; } .min-w-12 { min-width: 3rem; } +.min-w-28 { min-width: 7rem; } .min-w-50 { min-width: 12.5rem; } .min-w-60 { min-width: 15rem; } .min-w-80 { min-width: 20rem; } diff --git a/packages/theme/styles/_lumia-colors.scss b/packages/theme/styles/_lumia-colors.scss index 89b5d18c54..40b1b69613 100644 --- a/packages/theme/styles/_lumia-colors.scss +++ b/packages/theme/styles/_lumia-colors.scss @@ -26,6 +26,7 @@ --button-negative-active-BackgroundColor: #c42a32; --tag-on-accent-PorpoiseText: #FFFFFF; + --tag-accent-SunshineBackground: #FFBD2E; } /* Dark Theme */ @@ -70,6 +71,8 @@ --tag-on-subtle-PorpoiseText: #F2F4F6; --tag-subtle-PorpoiseBackground: #343F49; + --tag-nuance-SunshineBackground: #262F40; + --tag-accent-SunshineText: #FFBD2E; --tag-nuance-SkyBackground: #1F2737; --icon-disabled-IconColor: #394358; @@ -145,6 +148,8 @@ --tag-on-subtle-PorpoiseText: #293139; --tag-subtle-PorpoiseBackground: #C8D1D9; + --tag-nuance-SunshineBackground: #FEF2E2; + --tag-accent-SunshineText: #8E5E00; --tag-nuance-SkyBackground: #EEF4FD; --icon-disabled-IconColor: #B3BCCC; diff --git a/packages/theme/styles/common.scss b/packages/theme/styles/common.scss index 8555182d4a..3eda4b5776 100644 --- a/packages/theme/styles/common.scss +++ b/packages/theme/styles/common.scss @@ -14,9 +14,11 @@ // /* Typography */ +.font-regular-11, .font-medium-11, .font-regular-12, .font-medium-12, +.font-caps-medium-12, .font-bold-12, .font-regular-14, .font-medium-14, @@ -30,11 +32,13 @@ line-height: 1rem; color: var(--global-primary-TextColor); } +.font-regular-11, .font-medium-11 { font-size: 0.6875rem; } .font-regular-12, .font-medium-12, +.font-caps-medium-12, .font-bold-12 { font-size: 0.75rem; } @@ -44,6 +48,7 @@ .paragraph-regular-14 { font-size: 0.875rem; } +.font-regular-11, .font-regular-12, .font-regular-14, .paragraph-regular-14 { @@ -51,6 +56,7 @@ } .font-medium-11, .font-medium-12, +.font-caps-medium-12, .font-medium-14, .heading-medium-16, .heading-medium-20 { @@ -74,6 +80,9 @@ line-height: 1.25rem; color: var(--global-tertiary-TextColor); } +.font-caps-medium-12 { + text-transform: uppercase; +} /* Panels */ * { diff --git a/packages/ui/src/components/ButtonBase.svelte b/packages/ui/src/components/ButtonBase.svelte index c5a36ba6b9..5197c0c2d9 100644 --- a/packages/ui/src/components/ButtonBase.svelte +++ b/packages/ui/src/components/ButtonBase.svelte @@ -120,6 +120,9 @@ } .icon { + display: flex; + align-items: center; + justify-content: center; width: var(--spacing-2_5); height: var(--spacing-2_5); @@ -159,10 +162,11 @@ } &.small { height: var(--global-small-Size); + gap: var(--spacing-0_25); border-radius: var(--small-BorderRadius); &.type-button { - padding: 0 var(--spacing-1_5); + padding: 0 var(--spacing-1); } &.type-button-icon { width: var(--global-small-Size); @@ -363,6 +367,7 @@ } } } + & > * { pointer-events: none; } diff --git a/packages/ui/src/components/Hotkey.svelte b/packages/ui/src/components/Hotkey.svelte new file mode 100644 index 0000000000..68e9b6d35c --- /dev/null +++ b/packages/ui/src/components/Hotkey.svelte @@ -0,0 +1,50 @@ + + + + + {#if isPredefinedKey} + + {:else} + {key} + {/if} + + + diff --git a/packages/ui/src/components/HotkeyGroup.svelte b/packages/ui/src/components/HotkeyGroup.svelte new file mode 100644 index 0000000000..067f59e89f --- /dev/null +++ b/packages/ui/src/components/HotkeyGroup.svelte @@ -0,0 +1,25 @@ + + + +
+ {#each keys as key} + + {/each} +
diff --git a/packages/ui/src/components/icons/KeyCommand.svelte b/packages/ui/src/components/icons/KeyCommand.svelte new file mode 100644 index 0000000000..9a4fa894b5 --- /dev/null +++ b/packages/ui/src/components/icons/KeyCommand.svelte @@ -0,0 +1,12 @@ + + + + + diff --git a/packages/ui/src/components/icons/KeyOption.svelte b/packages/ui/src/components/icons/KeyOption.svelte new file mode 100644 index 0000000000..4403c6a34f --- /dev/null +++ b/packages/ui/src/components/icons/KeyOption.svelte @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/ui/src/components/icons/KeyShift.svelte b/packages/ui/src/components/icons/KeyShift.svelte new file mode 100644 index 0000000000..b95eb9cf98 --- /dev/null +++ b/packages/ui/src/components/icons/KeyShift.svelte @@ -0,0 +1,8 @@ + + + + + diff --git a/packages/ui/src/index.ts b/packages/ui/src/index.ts index a8ade2b7a2..e2c4e5c75b 100644 --- a/packages/ui/src/index.ts +++ b/packages/ui/src/index.ts @@ -141,6 +141,8 @@ export { default as NavGroup } from './components/NavGroup.svelte' export { default as Modal } from './components/Modal.svelte' export { default as AccordionItem } from './components/AccordionItem.svelte' export { default as NotificationToast } from './components/NotificationToast.svelte' +export { default as Hotkey } from './components/Hotkey.svelte' +export { default as HotkeyGroup } from './components/HotkeyGroup.svelte' export { default as IconAdd } from './components/icons/Add.svelte' export { default as IconCircleAdd } from './components/icons/CircleAdd.svelte' @@ -213,6 +215,9 @@ export { default as IconTableOfContents } from './components/icons/TableOfConten export { default as IconRight } from './components/icons/Right.svelte' export { default as IconDropdownDown } from './components/icons/DropdownDown.svelte' export { default as IconDropdownRight } from './components/icons/DropdownRight.svelte' +export { default as IconKeyCommand } from './components/icons/KeyCommand.svelte' +export { default as IconKeyOption } from './components/icons/KeyOption.svelte' +export { default as IconKeyShift } from './components/icons/KeyShift.svelte' export { default as PanelInstance } from './components/PanelInstance.svelte' export { default as Panel } from './components/Panel.svelte' diff --git a/plugins/calendar-resources/src/components/DateEditor.svelte b/plugins/calendar-resources/src/components/DateEditor.svelte index 54e763b9db..7556944814 100644 --- a/plugins/calendar-resources/src/components/DateEditor.svelte +++ b/plugins/calendar-resources/src/components/DateEditor.svelte @@ -14,9 +14,9 @@ --> -
-
- -
+
-
- -
+
- +
- - - - - @@ -44,4 +39,7 @@ + + + diff --git a/plugins/time-assets/lang/en.json b/plugins/time-assets/lang/en.json index f737e6f64f..bc528964a2 100644 --- a/plugins/time-assets/lang/en.json +++ b/plugins/time-assets/lang/en.json @@ -55,6 +55,7 @@ "CreatedToDo": "Created Todo", "NewToDoDetails": "New Todo: {details}", "MarkedAsDone": "Completed", - "WorkSchedule": "Work schedule" + "WorkSchedule": "Work schedule", + "SummaryDuration": "Summary" } } diff --git a/plugins/time-assets/lang/es.json b/plugins/time-assets/lang/es.json index 272be448b1..a651b4aeb0 100644 --- a/plugins/time-assets/lang/es.json +++ b/plugins/time-assets/lang/es.json @@ -55,6 +55,7 @@ "CreatedToDo": "Tarea creada", "NewToDoDetails": "Nueva tarea pendiente: {details}", "MarkedAsDone": "Marcado como hecho", - "WorkSchedule": "Horario de trabajo" + "WorkSchedule": "Horario de trabajo", + "SummaryDuration": "Sumerio" } } \ No newline at end of file diff --git a/plugins/time-assets/lang/pt.json b/plugins/time-assets/lang/pt.json index 932d09c71f..37907f82c5 100644 --- a/plugins/time-assets/lang/pt.json +++ b/plugins/time-assets/lang/pt.json @@ -55,6 +55,7 @@ "CreatedToDo": "Tarefa criada", "NewToDoDetails": "Nova tarefa pendente: {details}", "MarkedAsDone": "Concluído", - "WorkSchedule": "Horário de trabalho" + "WorkSchedule": "Horário de trabalho", + "SummaryDuration": "Sumário" } } \ No newline at end of file diff --git a/plugins/time-assets/lang/ru.json b/plugins/time-assets/lang/ru.json index 6c9704de6b..0517de4f00 100644 --- a/plugins/time-assets/lang/ru.json +++ b/plugins/time-assets/lang/ru.json @@ -55,6 +55,7 @@ "CreatedToDo": "Создал(а) Todo", "NewToDoDetails": "Новое Todo: {details}", "MarkedAsDone": "Выполнено", - "WorkSchedule": "Расписание работы" + "WorkSchedule": "Расписание работы", + "SummaryDuration": "Всего" } } diff --git a/plugins/time-assets/src/index.ts b/plugins/time-assets/src/index.ts index 1d3dcc7a36..a0da35c83d 100644 --- a/plugins/time-assets/src/index.ts +++ b/plugins/time-assets/src/index.ts @@ -21,7 +21,7 @@ loadMetadata(time.icon, { Team: `${icons}#team`, Hashtag: `${icons}#hashtag`, Inbox: `${icons}#inbox`, - Target: `${icons}#target`, + Calendar: `${icons}#calendar`, Flag: `${icons}#flag`, FilledFlag: `${icons}#filledFlag`, Planned: `${icons}#planned`, diff --git a/plugins/time-resources/src/components/CreateToDoPopup.svelte b/plugins/time-resources/src/components/CreateToDoPopup.svelte index 23f3cfd136..633d46179d 100644 --- a/plugins/time-resources/src/components/CreateToDoPopup.svelte +++ b/plugins/time-resources/src/components/CreateToDoPopup.svelte @@ -13,22 +13,22 @@ // limitations under the License. --> - + } + + + diff --git a/plugins/time-resources/src/components/EditToDo.svelte b/plugins/time-resources/src/components/EditToDo.svelte index e5b0e5429c..330ddbbfd7 100644 --- a/plugins/time-resources/src/components/EditToDo.svelte +++ b/plugins/time-resources/src/components/EditToDo.svelte @@ -190,8 +190,8 @@
{/if}
-
- +
+
@@ -235,9 +235,8 @@ } .slots-content { gap: var(--spacing-2); - padding: var(--spacing-3) var(--spacing-4); + padding: var(--spacing-2) var(--spacing-4); border-top: 1px solid var(--theme-divider-color); - border-bottom: 1px solid var(--theme-divider-color); } .eventPopup-container { display: flex; diff --git a/plugins/time-resources/src/components/PriorityEditor.svelte b/plugins/time-resources/src/components/PriorityEditor.svelte index 74e264d2bc..fc617904f0 100644 --- a/plugins/time-resources/src/components/PriorityEditor.svelte +++ b/plugins/time-resources/src/components/PriorityEditor.svelte @@ -46,7 +46,7 @@ } }) $: selected = selectPopupPriorities.find((item) => item.id === value) - $: selectedLabel = selected?.label ?? time.string.NoPriority + $: selectedLabel = selected?.label === time.string.NoPriority ? time.string.SetPriority : selected?.label $: icon = selected?.id === ToDoPriority.NoPriority ? time.icon.Flag : selected?.icon $: iconProps = selected?.iconProps diff --git a/plugins/time-resources/src/components/ToDoDuration.svelte b/plugins/time-resources/src/components/ToDoDuration.svelte index 77ad0ada9f..11e739a37f 100644 --- a/plugins/time-resources/src/components/ToDoDuration.svelte +++ b/plugins/time-resources/src/components/ToDoDuration.svelte @@ -1,35 +1,14 @@ -{res} +{duration} diff --git a/plugins/time-resources/src/components/Workslots.svelte b/plugins/time-resources/src/components/Workslots.svelte index 4260c83197..db8b41037a 100644 --- a/plugins/time-resources/src/components/Workslots.svelte +++ b/plugins/time-resources/src/components/Workslots.svelte @@ -13,15 +13,31 @@ // limitations under the License. --> -
- - {#each slots as slot} -
- change(e, slot)} - on:dueChange={(e) => dueChange(e, slot)} + + +
+ {#each slots as slot, i} +
+ + change(e, slot)} + on:dueChange={(e) => dueChange(e, slot)} + /> +
+ { + dispatch('remove', { _id: slot._id }) + }} /> -
- { - dispatch('remove', { _id: slot._id }) - }} - /> -
- {/each} - -
-
-
-
+ {/each} +
+
+ dispatch('create')} + > + {#if shortcuts} + + {/if} + + {#if duration} +
+
+ {/if}
diff --git a/plugins/time-resources/src/plugin.ts b/plugins/time-resources/src/plugin.ts index 3b8883b9a2..b333d54781 100644 --- a/plugins/time-resources/src/plugin.ts +++ b/plugins/time-resources/src/plugin.ts @@ -61,6 +61,7 @@ export default mergeIds(timeId, time, { AddTo: '' as IntlString, AddTitle: '' as IntlString, MyWork: '' as IntlString, - WorkSchedule: '' as IntlString + WorkSchedule: '' as IntlString, + SummaryDuration: '' as IntlString } }) diff --git a/plugins/time-resources/src/utils.ts b/plugins/time-resources/src/utils.ts index dd703e8ede..499e80ae22 100644 --- a/plugins/time-resources/src/utils.ts +++ b/plugins/time-resources/src/utils.ts @@ -1,6 +1,9 @@ -import type { Client, Ref } from '@hcengineering/core' -import type { DefSeparators } from '@hcengineering/ui' import type { WorkSlot, ToDo } from '@hcengineering/time' +import type { DefSeparators } from '@hcengineering/ui' +import type { Client, Ref } from '@hcengineering/core' +import { DAY, HOUR, MINUTE } from '@hcengineering/ui' +import { translate } from '@hcengineering/platform' +import timePlugin from './plugin' import time from '@hcengineering/time' export * from './types' @@ -36,3 +39,46 @@ export async function ToDoTitleProvider (client: Client, ref: Ref, doc?: T return object.title } + +export function calculateEventsDuration (events: WorkSlot[]): number { + const points = events.flatMap((event) => [ + { time: event.date, type: 'start' }, + { time: event.dueDate, type: 'end' } + ]) + + points.sort((a, b) => a.time - b.time) + + let activeEvents = 0 + let duration = 0 + let lastTime = 0 + + points.forEach((point) => { + if (activeEvents > 0) { + duration += point.time - lastTime + } + activeEvents += point.type === 'start' ? 1 : -1 + lastTime = point.time + }) + + return duration +} + +export async function formatEventsDuration (duration: number, language: string): Promise { + let text = '' + const days = Math.floor(duration / DAY) + if (days > 0) { + text += await translate(timePlugin.string.Days, { days }, language) + } + const hours = Math.floor((duration % DAY) / HOUR) + if (hours > 0) { + text += ' ' + text += await translate(timePlugin.string.Hours, { hours }, language) + } + const minutes = Math.floor((duration % HOUR) / MINUTE) + if (minutes > 0) { + text += ' ' + text += await translate(timePlugin.string.Minutes, { minutes }, language) + } + text = text.trim() + return text +} diff --git a/plugins/time/src/index.ts b/plugins/time/src/index.ts index b1bcf69018..734a768ea8 100644 --- a/plugins/time/src/index.ts +++ b/plugins/time/src/index.ts @@ -13,12 +13,12 @@ // limitations under the License. // -import { Event, Visibility } from '@hcengineering/calendar' -import { Person } from '@hcengineering/contact' -import { AttachedDoc, Class, Doc, Hierarchy, Markup, Mixin, Ref, Space, Timestamp, Type } from '@hcengineering/core' import type { Asset, Plugin, Resource } from '@hcengineering/platform' +import { AttachedDoc, Class, Doc, Hierarchy, Markup, Mixin, Ref, Space, Timestamp, Type } from '@hcengineering/core' import { IntlString, plugin } from '@hcengineering/platform' +import { Event, Visibility } from '@hcengineering/calendar' import { AnyComponent } from '@hcengineering/ui' +import { Person } from '@hcengineering/contact' /** * @public @@ -120,7 +120,7 @@ export default plugin(timeId, { Team: '' as Asset, Hashtag: '' as Asset, Inbox: '' as Asset, - Target: '' as Asset, + Calendar: '' as Asset, Flag: '' as Asset, FilledFlag: '' as Asset, Planned: '' as Asset, diff --git a/tests/create-local.sh b/tests/create-local.sh index f57a9dff0d..7befb98d94 100755 --- a/tests/create-local.sh +++ b/tests/create-local.sh @@ -1,5 +1,5 @@ # Create workspace record in accounts -./tool-local.sh create-workspace sanity-ws -o SanityTest +./tool-local.sh create-workspace sanity-ws -w SanityTest # Create user record in accounts ./tool-local.sh create-account user1 -f John -l Appleseed -p 1234 ./tool-local.sh confirm-email user1 diff --git a/tests/sanity/tests/model/planning/planning-page.ts b/tests/sanity/tests/model/planning/planning-page.ts index 67860c6538..81318a8bd8 100644 --- a/tests/sanity/tests/model/planning/planning-page.ts +++ b/tests/sanity/tests/model/planning/planning-page.ts @@ -40,8 +40,12 @@ export class PlanningPage extends CalendarPage { this.inputPopupCreateTitle = page.locator('div.popup input') this.inputPopupCreateDescription = page.locator('div.popup div.tiptap') this.inputPanelCreateDescription = page.locator('div.hulyModal-container div.tiptap') - this.buttonPopupCreateDueDate = page.locator('div.popup button.antiButton', { hasText: 'Due date' }) - this.buttonPanelCreateDueDate = page.locator('div.hulyModal-container button.antiButton', { hasText: 'Due date' }) + this.buttonPopupCreateDueDate = page.locator( + 'div.popup div.block:first-child div.flex-row-center button:nth-child(3)' + ) + this.buttonPanelCreateDueDate = page.locator( + 'div.hulyModal-container div.slots-content div.flex-row-top.justify-between div.flex-row-center button:first-child' + ) this.buttonPopupCreatePriority = page.locator('div.popup button#priorityButton') this.buttonPanelCreatePriority = page.locator('div.hulyModal-container button#priorityButton') this.buttonPopupCreateVisible = page.locator('div.popup button.type-button.menu', { hasText: 'visible' }) @@ -50,8 +54,8 @@ export class PlanningPage extends CalendarPage { }) this.buttonPopupCreateAddLabel = page.locator('div.popup button.antiButton', { hasText: 'Add label' }) this.buttonPanelCreateAddLabel = page.locator('.hulyHeader-titleGroup > button:nth-child(2)') - this.buttonPopupCreateAddSlot = page.locator('div.popup button.antiButton', { hasText: 'Add Slot' }) - this.buttonPanelCreateAddSlot = page.locator('div.hulyModal-container button.antiButton', { hasText: 'Add Slot' }) + this.buttonPopupCreateAddSlot = page.locator('div.popup button', { hasText: 'Add Slot' }) + this.buttonPanelCreateAddSlot = page.locator('div.hulyModal-container button', { hasText: 'Add Slot' }) this.buttonCalendarToday = page.locator('div.popup div.calendar button.day.today') this.buttonCreateToDo = page.locator('div.popup button.antiButton', { hasText: 'Add ToDo' }) this.inputCreateToDoTitle = page.locator('div.toDos-container input[placeholder="Add todo, press Enter to save"]') @@ -63,7 +67,7 @@ export class PlanningPage extends CalendarPage { ) this.textPanelToDoDescription = page.locator('div.hulyModal-container div.top-content div.tiptap > p') this.textPanelDueDate = page.locator( - 'div.hulyModal-container div.slots-content div.flex-row-top.justify-between div.flex-row-center button.antiButton:first-child div[slot="content"]' + 'div.hulyModal-container div.slots-content div.flex-row-top.justify-between div.flex-row-center button:first-child span' ) this.textPanelPriority = page.locator('div.hulyModal-container button#priorityButton svg') this.textPanelVisible = page.locator( @@ -133,12 +137,12 @@ export class PlanningPage extends CalendarPage { public async setTimeSlot (rowNumber: number, slot: Slot, popup: boolean = false): Promise { const p = popup - ? 'div.popup div.horizontalBox div.flex-row-center' - : 'div.hulyModal-container div.slots-content div.horizontalBox div.flex-row-center' + ? 'div.popup div.horizontalBox div.end div.flex-col div.flex' + : 'div.hulyModal-container div.slots-content div.flex-col div.flex' const row = this.page.locator(p).nth(rowNumber) // dateStart - await row.locator('div.dateEditor-container:nth-child(2) button:first-child').click() + await row.locator('div.dateEditor-container:nth-child(1) button:first-child').click() if (slot.dateStart === 'today') { await this.buttonCalendarToday.click() } else { @@ -154,34 +158,34 @@ export class PlanningPage extends CalendarPage { const hours = slot.timeStart.substring(0, 2) const minutes = slot.timeStart.substring(2, slot.timeStart.length) await row - .locator('div.dateEditor-container:nth-child(2) button:last-child span.digit:first-child') + .locator('div.dateEditor-container:nth-child(1) button:last-child span.digit:first-child') .click({ delay: 200 }) await row - .locator('div.dateEditor-container:nth-child(2) button:last-child span.digit:first-child') + .locator('div.dateEditor-container:nth-child(1) button:last-child span.digit:first-child') .pressSequentially(hours, { delay: 100 }) await row - .locator('div.dateEditor-container:nth-child(2) button:last-child span.digit:last-child') + .locator('div.dateEditor-container:nth-child(1) button:last-child span.digit:last-child') .click({ delay: 200 }) await row - .locator('div.dateEditor-container:nth-child(2) button:last-child span.digit:last-child') + .locator('div.dateEditor-container:nth-child(1) button:last-child span.digit:last-child') .pressSequentially(minutes, { delay: 100 }) // dateEnd + timeEnd - await row.locator('div.dateEditor-container:nth-child(4) button').click() + await row.locator('div.dateEditor-container.difference button').click() await this.fillSelectDatePopup(slot.dateEnd.day, slot.dateEnd.month, slot.dateEnd.year, slot.timeEnd) } private async checkTimeSlot (rowNumber: number, slot: Slot, popup: boolean = false): Promise { const p = popup - ? 'div.popup div.horizontalBox div.flex-row-center' - : 'div.hulyModal-container div.slots-content div.horizontalBox div.flex-row-center' + ? 'div.popup div.horizontalBox div.end div.flex-col div.flex' + : 'div.hulyModal-container div.slots-content div.flex-col div.flex' const row = this.page.locator(p).nth(rowNumber) // timeStart - await expect(row.locator('div.dateEditor-container:nth-child(2) button:last-child div.datetime-input')).toHaveText( + await expect(row.locator('div.dateEditor-container:nth-child(1) button:last-child div.datetime-input')).toHaveText( slot.timeStart ) // timeEnd - await expect(row.locator('div.dateEditor-container:nth-child(4) button > div:first-child')).toHaveText(slot.timeEnd) + await expect(row.locator('div.dateEditor-container.difference button > div:first-child')).toHaveText(slot.timeEnd) } async openToDoByName (toDoName: string): Promise { @@ -255,18 +259,17 @@ export class PlanningPage extends CalendarPage { } public async deleteTimeSlot (rowNumber: number): Promise { - const row = this.page.locator('div.hulyModal-container div.slots-content div.horizontalBox div.tool').nth(rowNumber) + const row = this.page + .locator('div.hulyModal-container div.slots-content div.flex-col div.flex div.tool') + .nth(rowNumber) await row.locator('xpath=..').hover() await row.locator('button').click() - await expect(row.locator('button')).toBeHidden() await this.pressYesDeletePopup(this.page) } public async checkTimeSlotEndDate (rowNumber: number, dateEnd: string): Promise { - const row = this.page - .locator('div.hulyModal-container div.slots-content div.horizontalBox div.flex-row-center') - .nth(rowNumber) + const row = this.page.locator('div.hulyModal-container div.slots-content div.flex-col div.flex').nth(rowNumber) // dateEnd - await expect(row.locator('div.dateEditor-container:nth-child(2) button:first-child')).toContainText(dateEnd) + await expect(row.locator('div.dateEditor-container:nth-child(1) button:first-child')).toContainText(dateEnd) } }