Updated tests

This commit is contained in:
Ivymaster
2026-10-20 17:03:38 +02:00
parent 4f07a7708b
commit 5dd8f648ac
9 changed files with 2920 additions and 2744 deletions
+18 -1
View File
@@ -33,4 +33,21 @@ DECLARE res varchar(32);
SELECT studiensemester_kurzbz into res FROM public.tbl_studiensemester WHERE start<=now() ORDER BY start DESC LIMIT 1;
return res;
END;
$$ LANGUAGE plpgsql;
$$ LANGUAGE plpgsql;
CREATE OR REPLACE FUNCTION get_current_week_timestamp(
p_day_offset INTEGER,
p_time TIME,
p_utc_offset INTERVAL DEFAULT INTERVAL '+00:00'
)
RETURNS TIMESTAMPTZ
LANGUAGE plpgsql
AS $$
BEGIN
RETURN (
date_trunc('week', CURRENT_DATE)
+ (p_day_offset * INTERVAL '1 day')
+ p_time
) AT TIME ZONE p_utc_offset;
END;
$$;
+46 -42
View File
@@ -30,14 +30,14 @@ VALUES
-- Calendar setup for event drag and drop tests
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, insertamum, insertvon, updateamum, updatevon) VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '08:00:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '08:45:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '08:45:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '09:30:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '09:40:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '10:25:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '10:25:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '11:10:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '09:40:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '10:25:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '09:40:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '10:25:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '10:25:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '11:10:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '10:25:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '11:10:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
(get_current_week_timestamp(2, '08:00:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '08:45:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '08:45:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '09:30:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '09:40:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '10:25:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '10:25:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '11:10:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '09:40:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '10:25:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '09:40:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '10:25:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '10:25:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '11:10:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '10:25:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '11:10:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
;
INSERT INTO lehre.tbl_kalender_ort
@@ -61,11 +61,15 @@ VALUES
-- Calendar setup for resize tests
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, insertamum, insertvon, updateamum, updatevon) VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '08:00:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '08:45:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '10:25:00', date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '11:10:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '10:25:00', date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '11:10:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
(get_current_week_timestamp(3, '08:00:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '08:45:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '10:25:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '11:10:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '10:25:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '11:10:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
;
INSERT INTO lehre.tbl_kalender_ort
(location, ort_kurzbz, kalender_id)
VALUES(NULL, 'Bro_F7.39', 9);
INSERT INTO lehre.tbl_kalender_lehreinheit
(lehreinheit_id, kalender_id)
VALUES
@@ -78,12 +82,12 @@ VALUES
-- Calendar setup for role preview tests
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, insertamum, insertvon, updateamum, updatevon) VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '13:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '14:20:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '13:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '14:20:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '13:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '14:20:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '13:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '14:20:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '13:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '14:20:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '13:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '14:20:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
(get_current_week_timestamp(3, '13:35:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '14:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '13:35:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '14:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '13:35:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '14:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '13:35:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '14:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '13:35:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '14:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '13:35:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '14:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
;
INSERT INTO lehre.tbl_kalender_lehreinheit
@@ -100,8 +104,8 @@ VALUES
-- Calendar setup for API event creation tests
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, insertamum, insertvon, updateamum, updatevon) VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '18:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '19:20:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '18:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '19:20:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
(get_current_week_timestamp(2, '18:35:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '19:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '18:35:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '19:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
;
INSERT INTO lehre.tbl_kalender_lehreinheit
@@ -116,17 +120,17 @@ VALUES
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, insertamum, insertvon, updateamum, updatevon)
VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '1 day' + TIME '19:30:00', date_trunc('week', CURRENT_DATE) + INTERVAL '1 day' + TIME '20:15:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '19:30:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '20:15:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '20:15:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '21:00:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '19:30:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '20:15:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '20:15:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '21:00:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '19:30:00', date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '20:15:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '19:30:00', date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '20:15:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '20:15:00', date_trunc('week', CURRENT_DATE) + INTERVAL '4 day' + TIME '21:00:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '5 day' + TIME '19:30:00', date_trunc('week', CURRENT_DATE) + INTERVAL '5 day' + TIME '20:15:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '5 day' + TIME '20:15:00', date_trunc('week', CURRENT_DATE) + INTERVAL '5 day' + TIME '21:00:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '5 day' + TIME '20:15:00', date_trunc('week', CURRENT_DATE) + INTERVAL '5 day' + TIME '21:00:00', 'reservierung', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
(get_current_week_timestamp(1, '19:30:00', INTERVAL '+02:00'), get_current_week_timestamp(1, '20:15:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '19:30:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '20:15:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '20:15:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '21:00:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '19:30:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '20:15:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '20:15:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '21:00:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(4, '19:30:00', INTERVAL '+02:00'), get_current_week_timestamp(4, '20:15:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(4, '19:30:00', INTERVAL '+02:00'), get_current_week_timestamp(4, '20:15:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(4, '20:15:00', INTERVAL '+02:00'), get_current_week_timestamp(4, '21:00:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(5, '19:30:00', INTERVAL '+02:00'), get_current_week_timestamp(5, '20:15:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(5, '20:15:00', INTERVAL '+02:00'), get_current_week_timestamp(5, '21:00:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(5, '20:15:00', INTERVAL '+02:00'), get_current_week_timestamp(5, '21:00:00', INTERVAL '+02:00'), 'reservierung', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
;
INSERT INTO lehre.tbl_kalender_ort
@@ -155,8 +159,8 @@ VALUES
-- Calendar setup for Stundenraster disabled tests
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, insertamum, insertvon, updateamum, updatevon) VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '11:20:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '12:05:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '11:20:00', date_trunc('week', CURRENT_DATE) + INTERVAL '2 day' + TIME '12:05:00', 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
(get_current_week_timestamp(2, '11:20:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '12:05:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(2, '11:20:00', INTERVAL '+02:00'), get_current_week_timestamp(2, '12:05:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, now(), 'demoadmin', NULL, 'demoadmin')
;
INSERT INTO lehre.tbl_kalender_lehreinheit
@@ -171,10 +175,10 @@ VALUES
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, eindeutige_kalender_gruppen_id, insertamum, insertvon, updateamum, updatevon)
VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '19:30:00', date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '20:15:00', 'lehreinheit', 'live', NULL, 'ec1bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '20:15:00', date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '21:00:00', 'lehreinheit', 'live', NULL, 'ec2bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '17:50:00', date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '18:35:00', 'lehreinheit', 'live', NULL, 'ec3bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '18:35:00', date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '19:20:00', 'lehreinheit', 'live', NULL, 'ec4bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin')
(get_current_week_timestamp(6, '19:30:00', INTERVAL '+02:00'), get_current_week_timestamp(6, '20:15:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, 'ec1bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(6, '20:15:00', INTERVAL '+02:00'), get_current_week_timestamp(6, '21:00:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, 'ec2bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(6, '17:50:00', INTERVAL '+02:00'), get_current_week_timestamp(6, '18:35:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, 'ec3bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(6, '18:35:00', INTERVAL '+02:00'), get_current_week_timestamp(6, '19:20:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, 'ec4bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin')
;
INSERT INTO lehre.tbl_kalender_lehreinheit
@@ -189,7 +193,7 @@ VALUES
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, eindeutige_kalender_gruppen_id, insertamum, insertvon, updateamum, updatevon)
VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '16:55:00', date_trunc('week', CURRENT_DATE) + INTERVAL '6 day' + TIME '17:40:00', 'lehreinheit', 'live', NULL, 'ec1bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin');
(get_current_week_timestamp(6, '16:55:00', INTERVAL '+02:00'), get_current_week_timestamp(6, '17:40:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, 'ec1bd001-facf-4b21-a671-bcb2d4f037fd', now(), 'demoadmin', NULL, 'demoadmin');
INSERT INTO lehre.tbl_kalender_lehreinheit
(lehreinheit_id, kalender_id)
@@ -200,8 +204,8 @@ VALUES
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, eindeutige_kalender_gruppen_id, insertamum, insertvon, updateamum, updatevon)
VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '14:30:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '15:15:00', 'lehreinheit', 'live', NULL, null, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '15:15:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '16:00:00', 'lehreinheit', 'live', NULL, null, now(), 'demoadmin', NULL, 'demoadmin');
(get_current_week_timestamp(3, '14:30:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '15:15:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, null, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '15:15:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '16:00:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, null, now(), 'demoadmin', NULL, 'demoadmin');
INSERT INTO lehre.tbl_kalender_lehreinheit
(lehreinheit_id, kalender_id)
@@ -218,8 +222,8 @@ VALUES
INSERT INTO lehre.tbl_kalender
(von, bis, typ, status_kurzbz, vorgaenger_kalender_id, eindeutige_kalender_gruppen_id, insertamum, insertvon, updateamum, updatevon)
VALUES
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '16:10:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '16:55:00', 'lehreinheit', 'live', NULL, null, now(), 'demoadmin', NULL, 'demoadmin'),
(date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '16:55:00', date_trunc('week', CURRENT_DATE) + INTERVAL '3 day' + TIME '17:40:00', 'lehreinheit', 'live', NULL, null, now(), 'demoadmin', NULL, 'demoadmin');
(get_current_week_timestamp(3, '16:10:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '16:55:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, null, now(), 'demoadmin', NULL, 'demoadmin'),
(get_current_week_timestamp(3, '16:55:00', INTERVAL '+02:00'), get_current_week_timestamp(3, '17:40:00', INTERVAL '+02:00'), 'lehreinheit', 'live', NULL, null, now(), 'demoadmin', NULL, 'demoadmin');
INSERT INTO lehre.tbl_kalender_lehreinheit
(lehreinheit_id, kalender_id)
@@ -290,5 +294,5 @@ VALUES(30, 'teilnehmer', 'demolektor4', NULL, NULL, NULL, NULL, NULL, NULL, NULL
INSERT INTO campus.tbl_zeitsperre
(zeitsperre_id, zeitsperretyp_kurzbz, mitarbeiter_uid, bezeichnung, vondatum, vonstunde, bisdatum, bisstunde, vertretung_uid, updateamum, updatevon, insertamum, insertvon, erreichbarkeit_kurzbz, freigabeamum, freigabevon)
VALUES(1, 'DienstV', 'demolektor1', 'Test', date_trunc('week', CURRENT_DATE) + INTERVAL '5 day', NULL, date_trunc('week', CURRENT_DATE) + INTERVAL '5 day', NULL, 'demoadmin', '2007-04-02 11:04:31.000', 'demoadmin', '2007-04-02 11:04:31.000', 'demoadmin', 't', NULL, NULL);
VALUES(1, 'DienstV', 'demolektor1', 'Test', get_current_week_timestamp(5, '00:00:00', INTERVAL '+02:00'), NULL, get_current_week_timestamp(5, '00:00:00', INTERVAL '+02:00'), NULL, 'demoadmin', '2007-04-02 11:04:31.000', 'demoadmin', '2007-04-02 11:04:31.000', 'demoadmin', 't', NULL, NULL);
+18 -18
View File
@@ -1,22 +1,22 @@
const { defineConfig } = require("cypress");
require("dotenv").config();
const { defineConfig } = require('cypress');
require('dotenv').config();
module.exports = defineConfig({
allowCypressEnv: true,
e2e: {
baseUrl: process.env.BASE_URL || "http://localhost:8080",
defaultCommandTimeout: 20000,
pageLoadTimeout: 20000,
retries: {
runMode: 2,
openMode: 2
}
},
env: {
adminusername: process.env.USER_NAME || "2",
adminpassword: process.env.USER_PASSWORD || "2",
loginAsUser: process.env.LOGIN_AS_USER || process.env.USER_NAME || "demoadmin"
}
allowCypressEnv: true,
e2e: {
baseUrl: process.env.BASE_URL || 'http://localhost:8080',
defaultCommandTimeout: 10000,
pageLoadTimeout: 10000,
retries: {
runMode: 1,
openMode: 1,
},
},
env: {
adminusername: process.env.USER_NAME || '2',
adminpassword: process.env.USER_PASSWORD || '2',
loginAsUser:
process.env.LOGIN_AS_USER || process.env.USER_NAME || 'demoadmin',
},
});
File diff suppressed because it is too large Load Diff
@@ -1,194 +1,200 @@
import { waitForOk } from "../../../../support/helpers/network";
import { tempusPage } from "../../../../support/pages/tempus.po";
import { tempusApi } from "../../../../support/api/tempusApi";
import { waitForOk } from '../../../../support/helpers/network';
import { tempusPage } from '../../../../support/pages/tempus.po';
import { tempusApi } from '../../../../support/api/tempusApi';
const TARGETED_STUDY_PLAN_SHORT_CODE = "STG5";
context("Tempus course picker tests", () => {
before(() => {
tempusPage.visitAndWaitForPlanner();
tempusPage.setCurrentSemester();
});
beforeEach(() => {
tempusPage.visitAndWaitForPlanner();
});
it("shows a course's events after selecting it", () => {
tempusPage.getSlideInCoursesMenu().should("exist");
tempusPage.getCourseTreeRows().should("have.length.greaterThan", 0);
tempusPage.getCoursePicker().should("exist");
tempusPage.getCoursePickerRows().should("have.length", 0);
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk("@fetchCoursePickerCourses");
tempusPage.getCoursePickerRows().should("have.length.greaterThan", 0);
});
it("filters course teaching units using the course-picker search", () => {
tempusPage.getSlideInCoursesMenu().should("exist");
tempusPage.getCourseTreeRows().should("have.length.greaterThan", 0);
tempusPage.getCoursePicker().should("exist");
tempusPage.getCoursePickerRows().should("have.length", 0);
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk("@fetchCoursePickerCourses");
cy.wait(1000);
tempusPage.getCoursePickerRows()
.should("be.visible")
.should("have.length.greaterThan", 0);
tempusPage
.getCoursePickerRows()
.last()
.find("div:first span:first")
.invoke("text")
.as("randomCourseText");
cy.get("@randomCourseText").then((randomCourseText) => {
tempusPage.getCoursePickerSearchInput().type(randomCourseText);
tempusPage.getCoursePickerRows().should("have.length.greaterThan", 0);
tempusPage
.getCoursePickerRows()
.first()
.should("contain.text", randomCourseText);
});
});
it("for active room selection dialog config option, shows room selection dialog when adding a course from the course-picker", () => {
let settingsData = tempusApi.getSettingsData();
settingsData.roomless_planning = false;
settingsData.room_planning = "dialog_room_planning";
tempusApi.updateSettingsData(settingsData).then((response) => {
tempusApi.deletePlannerEventsForDay("monday");
const TARGETED_STUDY_PLAN_SHORT_CODE = 'STG5';
context('Tempus course picker tests', () => {
before(() => {
tempusPage.visitAndWaitForPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.setCurrentSemester();
});
beforeEach(() => {
tempusPage.visitAndWaitForPlanner();
});
it("shows a course's events after selecting it", () => {
tempusPage.getSlideInCoursesMenu().should('exist');
tempusPage.getCourseTreeRows().should('have.length.greaterThan', 0);
tempusPage.getCoursePicker().should('exist');
tempusPage.getCoursePickerRows().should('have.length', 0);
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk("@fetchCoursePickerCourses");
waitForOk('@fetchCoursePickerCourses');
tempusPage.getCoursePickerRows().should("have.length.greaterThan", 0);
tempusPage.getCoursePickerRows().should('have.length.greaterThan', 0);
});
tempusPage.getCalendarEvents().then(($events) => {
const initialEventCount = $events.length;
it('filters course teaching units using the course-picker search', () => {
tempusPage.getSlideInCoursesMenu().should('exist');
tempusPage.getCourseTreeRows().should('have.length.greaterThan', 0);
tempusPage.getCoursePicker().should('exist');
tempusPage.getCoursePickerRows().should('have.length', 0);
tempusPage.dropCourseOnCalendarPart(0, 10);
waitForOk("@addCalendarEvent");
tempusPage.getRoomSelectionModal().should("be.visible");
tempusPage.selectFirstRoomAndSave();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk('@fetchCoursePickerCourses');
waitForOk("@addCalendarEvent");
waitForOk("@fetchPlanData");
cy.wait(1000);
tempusPage
.getCoursePickerRows()
.should('be.visible')
.should('have.length.greaterThan', 0);
tempusPage
.getCoursePickerRows()
.last()
.find('div:first span:first')
.invoke('text')
.as('randomCourseText');
cy.get('@randomCourseText').then((randomCourseText) => {
tempusPage.getCoursePickerSearchInput().type(randomCourseText);
tempusPage.getCoursePickerRows().should('have.length.greaterThan', 0);
tempusPage
.getCoursePickerRows()
.first()
.should('contain.text', randomCourseText);
});
});
it('for active room selection dialog config option, shows room selection dialog when adding a course from the course-picker', () => {
let settingsData = tempusApi.getSettingsData();
settingsData.roomless_planning = false;
settingsData.room_planning = 'dialog_room_planning';
tempusApi.updateSettingsData(settingsData).then((response) => {
tempusApi.deletePlannerEventsForDay('monday');
tempusPage.visitAndWaitForPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEvents()
.should("have.length", initialEventCount + 1);
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk('@fetchCoursePickerCourses');
tempusPage.getCoursePickerRows().should('have.length.greaterThan', 0);
tempusPage.getCalendarEvents().then(($events) => {
const initialEventCount = $events.length;
tempusPage.dropCourseOnCalendarPart(0, 10);
waitForOk('@addCalendarEvent');
tempusPage.getRoomSelectionModal().should('be.visible');
tempusPage.selectFirstRoomAndSave();
waitForOk('@addCalendarEvent');
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEvents()
.should('have.length', initialEventCount + 1);
});
});
});
it('for active room selection dialog config option, does not add an event to the calendar when the room selection dialog is closed', () => {
let settingsData = tempusApi.getSettingsData();
settingsData.roomless_planning = false;
settingsData.room_planning = 'dialog_room_planning';
tempusApi.updateSettingsData(settingsData).then((response) => {
tempusApi.deletePlannerEventsForDay('monday');
tempusPage.visitAndWaitForPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk('@fetchCoursePickerCourses');
tempusPage.getCoursePickerRows().should('have.length.greaterThan', 0);
tempusPage.getCalendarEvents().then(($events) => {
const initialEventCount = $events.length;
tempusPage.dropCourseOnCalendarPart(0, 10);
tempusPage.getRoomSelectionModal().should('be.visible');
tempusPage
.getRoomSelectionModal()
.find("button[data-cy='closeRoomSelection']")
.click();
tempusPage.getRoomSelectionModal().should('not.exist');
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getCalendarEvents().should('have.length', initialEventCount);
});
});
});
it('for active room selection dialog config option, does not add an event to the calendar when no room is selected', () => {
let settingsData = tempusApi.getSettingsData();
settingsData.roomless_planning = false;
settingsData.room_planning = 'dialog_room_planning';
tempusApi.updateSettingsData(settingsData).then((response) => {
tempusApi.deletePlannerEventsForDay('monday');
tempusPage.visitAndWaitForPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk('@fetchCoursePickerCourses');
tempusPage.getCoursePickerRows().should('have.length.greaterThan', 0);
tempusPage.getCalendarEvents().then(($events) => {
const initialEventCount = $events.length;
tempusPage.dropCourseOnCalendarPart(0, 10);
tempusPage.getRoomSelectionModal().should('be.visible');
tempusPage
.getRoomSelectionModal()
.find("button[data-cy='saveRoomSelection']")
.click();
tempusPage.getRoomSelectionModal().should('exist');
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getCalendarEvents().should('have.length', initialEventCount);
});
});
});
it('for active priority room config option, adds an event to the calendar without room selection dialog', () => {
let settingsData = tempusApi.getSettingsData();
settingsData.roomless_planning = false;
settingsData.room_planning = 'priority_room_planning';
tempusApi.updateSettingsData(settingsData).then((response) => {
tempusApi.deletePlannerEventsForDay('monday');
tempusPage.visitAndWaitForPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk('@fetchCoursePickerCourses');
tempusPage.getCoursePickerRows().should('have.length.greaterThan', 0);
tempusPage.getCalendarEvents().then(($events) => {
const initialEventCount = $events.length;
tempusPage.dropCourseOnCalendarPart(0, 10);
tempusPage.getRoomSelectionModal().should('not.exist');
tempusPage.getCalendarEvents().should('have.length', initialEventCount);
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getCalendarEvents().should('have.length', initialEventCount);
});
});
});
});
it("for active room selection dialog config option, does not add an event to the calendar when the room selection dialog is closed", () => {
let settingsData = tempusApi.getSettingsData();
settingsData.roomless_planning = false;
settingsData.room_planning = "dialog_room_planning";
tempusApi.updateSettingsData(settingsData).then((response) => {
tempusApi.deletePlannerEventsForDay("monday");
tempusPage.visitAndWaitForPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk("@fetchCoursePickerCourses");
tempusPage.getCoursePickerRows().should("have.length.greaterThan", 0);
tempusPage.getCalendarEvents().then(($events) => {
const initialEventCount = $events.length;
tempusPage.dropCourseOnCalendarPart(0, 10);
tempusPage.getRoomSelectionModal().should("be.visible");
tempusPage.getRoomSelectionModal().find("button[data-cy='closeRoomSelection']").click();
tempusPage.getRoomSelectionModal().should("not.exist");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getCalendarEvents().should("have.length", initialEventCount);
});
});
});
it("for active room selection dialog config option, does not add an event to the calendar when no room is selected", () => {
let settingsData = tempusApi.getSettingsData();
settingsData.roomless_planning = false;
settingsData.room_planning = "dialog_room_planning";
tempusApi.updateSettingsData(settingsData).then((response) => {
tempusApi.deletePlannerEventsForDay("monday");
tempusPage.visitAndWaitForPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk("@fetchCoursePickerCourses");
tempusPage.getCoursePickerRows().should("have.length.greaterThan", 0);
tempusPage.getCalendarEvents().then(($events) => {
const initialEventCount = $events.length;
tempusPage.dropCourseOnCalendarPart(0, 10);
tempusPage.getRoomSelectionModal().should("be.visible");
tempusPage.getRoomSelectionModal().find("button[data-cy='saveRoomSelection']").click();
tempusPage.getRoomSelectionModal().should("exist");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getCalendarEvents().should("have.length", initialEventCount);
});
});
});
it("for active priority room config option, adds an event to the calendar without room selection dialog", () => {
let settingsData = tempusApi.getSettingsData();
settingsData.roomless_planning = false;
settingsData.room_planning = "priority_room_planning";
tempusApi.updateSettingsData(settingsData).then((response) => {
tempusApi.deletePlannerEventsForDay("monday");
tempusPage.visitAndWaitForPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk("@fetchCoursePickerCourses");
tempusPage.getCoursePickerRows().should("have.length.greaterThan", 0);
tempusPage.getCalendarEvents().then(($events) => {
const initialEventCount = $events.length;
tempusPage.dropCourseOnCalendarPart(0, 10);
tempusPage.getRoomSelectionModal().should("not.exist");
tempusPage.getCalendarEvents().should("have.length", initialEventCount);
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getCalendarEvents().should("have.length", initialEventCount);
});
});
});
});
@@ -1,473 +1,483 @@
import { waitForOk } from "../../../../support/helpers/network";
import { tempusApi } from "../../../../support/api/tempusApi";
import { waitForOk } from '../../../../support/helpers/network';
import { tempusApi } from '../../../../support/api/tempusApi';
import {
LEKTOR,
STUDENT,
tempusPage,
} from "../../../../support/pages/tempus.po";
LEKTOR,
STUDENT,
tempusPage,
} from '../../../../support/pages/tempus.po';
const TARGETED_STUDY_PLAN_SHORT_CODE = "STG5";
const TARGETED_STUDY_PLAN_SHORT_CODE = 'STG5';
context("Tempus event mutation tests", () => {
beforeEach(() => {
tempusPage.visitAndWaitForPlanner();
context('Tempus event mutation tests', () => {
before(() => {
cy.login();
tempusApi.deletePlannerEventsForDay("monday");
});
let settingsData = tempusApi.getSettingsData();
settingsData.ignore_kollision = true;
settingsData.roomless_planning = false;
settingsData.room_planning = 'dialog_room_planning';
tempusApi.updateSettingsData(settingsData);
});
beforeEach(() => {
tempusPage.visitAndWaitForPlanner();
it("updates an event room in the planner preview while other previews retain the original room", () => {
tempusPage.syncAndReloadPlanner();
tempusApi.deletePlannerEventsForDay('monday');
});
tempusPage
.getCalendarEventsWithLehreinheitAndRoomByWeekdayAndStartTime(
"Wednesday",
"08:00:00",
)
.should("have.length.greaterThan", 0);
tempusPage
.getCalendarEventsWithLehreinheitAndRoomByWeekdayAndStartTime(
"Wednesday",
"08:00:00",
)
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventData = JSON.parse(eventJSON);
const eventId = eventData?.id;
let originalRoom = eventData?.orig?.ort_kurzbz;
if (Array.isArray(originalRoom)) originalRoom = originalRoom.length ? originalRoom[0] : "";
expect(eventId, "planner event id").to.exist;
expect(originalRoom, "original event room").to.be.a("string").and.not.be
.empty;
tempusPage.expectCalendarEventRoom(eventId, originalRoom);
tempusPage.changeEventRoom(eventId, originalRoom).then((result) => {
const { newRoom, updatedEventId } = result;
tempusPage.expectCalendarEventRoom(updatedEventId, newRoom);
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage.expectCalendarEventRoom(eventId, originalRoom);
tempusPage.selectRoleAndWait(STUDENT);
tempusPage.expectCalendarEventRoom(eventId, originalRoom);
});
});
});
it("selects and displays a room for an event", () => {
tempusPage
.getCalendarEventsByWeekdayAndTimeRange(
"Thursday",
"14:30:00",
"15:15:00",
)
.should("have.length.greaterThan", 0)
.first()
.rightclick();
tempusPage.getEventContextMenuOption("Raumauswahl").click({ force: true });
waitForOk("@fetchRoomSuggestions");
tempusPage.selectFirstRoomAndSave().then((selectedRoom) => {
tempusPage.waitForUpdatedEventId().then((updatedEventId) => {
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.expectCalendarEventRoom(updatedEventId, selectedRoom);
});
});
});
it("changes an event room", () => {
tempusPage
.getCalendarEventsByWeekdayAndTimeRange(
"Thursday",
"15:15:00",
"16:00:00",
)
.should("have.length.greaterThan", 0)
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventData = JSON.parse(eventJSON);
const eventId = eventData?.id;
let originalRoom = eventData?.orig?.ort_kurzbz;
if (Array.isArray(originalRoom))
originalRoom = originalRoom.length ? originalRoom[0] : "";
expect(eventId, "planner event id").to.exist;
expect(originalRoom, "original event room").to.be.a("string").and.not
.be.empty;
tempusPage.changeEventRoom(eventId, originalRoom).then((result) => {
expect(result.newRoom, "updated room").to.not.eq(originalRoom);
tempusPage.expectCalendarEventRoom(
result.updatedEventId,
result.newRoom,
);
});
});
});
it("adds multiple rooms to an event", () => {
tempusPage
.getCalendarEventsByWeekdayAndTimeRange(
"Thursday",
"15:15:00",
"16:00:00",
)
.should("have.length.greaterThan", 0)
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventData = JSON.parse(eventJSON);
const eventId = eventData?.id;
const currentRooms = eventData?.orig?.ort_kurzbz ?? [];
expect(eventId, "planner event id").to.exist;
tempusPage.getCalendarEventById(eventId).rightclick();
tempusPage.getEventContextMenuOption("Raumauswahl").click({ force: true });
waitForOk("@fetchRoomSuggestions");
tempusPage
.selectAdditionalRoomsAndSave(currentRooms)
.then((additionalRooms) => {
tempusPage.waitForUpdatedEventId().then((updatedEventId) => {
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.expectCalendarEventRooms(updatedEventId, additionalRooms);
});
});
});
});
it("moves an event from the calendar to the parking slot", () => {
tempusPage.getEventParkingSlot().should("exist");
tempusPage.getParkedEvents().should("have.length", 0);
tempusPage
.getCalendarEventsByWeekdayAndStartTime("Wednesday", "08:45:00")
.first()
.drag(tempusPage.selectors.parkingSlot);
tempusPage.getParkedEvents().should("have.length", 1);
});
it("keeps a deleted planner event visible in lecturer and student previews, before syncing", () => {
tempusPage.syncAndReloadPlanner();
tempusPage
.getCalendarEventsBySoftTimeRange("16:10:00", "16:55:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventGroupId =
JSON.parse(eventJSON)?.orig?.eindeutige_kalender_gruppen_id;
expect(eventGroupId).to.exist;
it('updates an event room in the planner preview while other previews retain the original room', () => {
tempusPage
.getCalendarEventsWithLehreinheitAndRoomByWeekdayAndStartTime(
'Wednesday',
'08:00:00',
)
.should('have.length.greaterThan', 0);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.getCalendarEventsWithLehreinheitAndRoomByWeekdayAndStartTime(
'Wednesday',
'08:00:00',
)
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventData = JSON.parse(eventJSON);
const eventId = eventData?.id;
let originalRoom = eventData?.orig?.ort_kurzbz;
if (Array.isArray(originalRoom))
originalRoom = originalRoom.length ? originalRoom[0] : '';
expect(eventId, 'planner event id').to.exist;
expect(originalRoom, 'original event room').to.be.a('string').and.not.be
.empty;
tempusPage.expectCalendarEventRoom(eventId, originalRoom);
tempusPage.changeEventRoom(eventId, originalRoom).then((result) => {
const { newRoom, updatedEventId } = result;
tempusPage.expectCalendarEventRoom(updatedEventId, newRoom);
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage.expectCalendarEventRoom(eventId, originalRoom);
tempusPage.selectRoleAndWait(STUDENT);
tempusPage.expectCalendarEventRoom(eventId, originalRoom);
});
});
});
it('selects and displays a room for an event', () => {
tempusPage
.getCalendarEventsByWeekdayAndTimeRange(
'Thursday',
'14:30:00',
'15:15:00',
)
.should('have.length.greaterThan', 0)
.first()
.rightclick();
tempusPage
.getEventContextMenuOption("Delete")
.click({ force: true });
tempusPage.getEventContextMenuOption('Raumauswahl').click({ force: true });
waitForOk('@fetchRoomSuggestions');
waitForOk("@deleteCalendarEvent");
waitForOk("@fetchPlanData");
tempusPage.selectFirstRoomAndSave().then((selectedRoom) => {
tempusPage.waitForUpdatedEventId().then((updatedEventId) => {
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should("exist");
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should("exist");
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should("exist");
tempusPage.expectCalendarEventRoom(updatedEventId, selectedRoom);
});
});
});
it("keeps a deleted planner event invisible after syncing", () => {
tempusPage.syncAndReloadPlanner();
tempusPage
.getCalendarEventsBySoftTimeRange("16:55:00", "17:40:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventGroupId =
JSON.parse(eventJSON)?.orig?.eindeutige_kalender_gruppen_id;
expect(eventGroupId).to.exist;
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.rightclick();
tempusPage
.getEventContextMenuOption("Delete")
.click({ force: true });
waitForOk("@deleteCalendarEvent");
waitForOk("@fetchPlanData");
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should("exist");
tempusPage.syncAndReloadPlanner();
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should("not.exist");
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should("not.exist");
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should("not.exist");
});
});
it("resizes an event from the bottom in the planner preview", () => {
tempusPage.getCalendarSection().should("exist");
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEventsByWeekdayAndStartTime("Thursday", "08:00:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
cy.wrap(JSON.parse(eventJSON)).its("id").as("eventId");
cy.wrap(JSON.parse(eventJSON).orig)
.its("beginn")
.as("originalEventStart");
cy.wrap(JSON.parse(eventJSON).orig).its("ende").as("originalEventEnd");
});
cy.get("@eventId").then((eventId) => {
tempusPage
.getCalendarEventById(eventId)
.find(".fhc-resize-bar--bottom")
.first()
.realHover()
.realMouseDown("center", {
button: "left",
})
.realMouseMove(0, 5)
.realMouseMove(0, 5)
.realMouseMove(0, 10)
.realMouseMove(0, 100)
.realMouseUp();
cy.wait("@updateCalendarEvent").then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
const updatedGroupEventId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
cy.wrap(updatedGroupEventId).as("updatedGroupEventId");
});
waitForOk("@fetchPlanData");
cy.get("@updatedGroupEventId").then((updatedGroupEventId) => {
tempusPage
.getCalendarEventByUniqueCalenderGroupId(updatedGroupEventId)
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
let newEventStart = JSON.parse(eventJSON)?.orig?.beginn;
let newEventEnd = JSON.parse(eventJSON)?.orig?.ende;
cy.get("@originalEventStart").then((originalEventStart) => {
expect(newEventStart).to.eq(originalEventStart);
});
cy.get("@originalEventEnd").then((originalEventEnd) => {
expect(newEventEnd).to.not.eq(originalEventEnd);
});
});
});
});
});
it.skip("resizes an event from the top in the planner preview", () => {
tempusPage.getCalendarSection().should("exist");
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEventsByWeekdayAndStartTime("Friday", "10:25:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
cy.wrap(JSON.parse(eventJSON)).its("id").as("eventId");
cy.wrap(JSON.parse(eventJSON).orig)
.its("beginn")
.as("originalEventStart");
cy.wrap(JSON.parse(eventJSON).orig).its("ende").as("originalEventEnd");
});
cy.get("@eventId").then((eventId) => {
tempusPage
.getCalendarEventById(eventId)
.find(".fhc-resize-bar--top")
.first()
.realHover()
.realMouseDown("center", {
button: "left",
})
.realMouseMove(0, -5)
.realMouseMove(0, -5)
.realMouseMove(0, -10)
.realMouseMove(0, -20)
.realMouseUp();
cy.wait("@updateCalendarEvent").then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
const updatedGroupEventId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
cy.wrap(updatedGroupEventId).as("updatedGroupEventId");
});
waitForOk("@fetchPlanData");
cy.get("@updatedGroupEventId").then((updatedGroupEventId) => {
tempusPage
.getCalendarEventByUniqueCalenderGroupId(updatedGroupEventId)
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
let newEventStart = JSON.parse(eventJSON)?.orig?.beginn;
let newEventEnd = JSON.parse(eventJSON)?.orig?.ende;
cy.get("@originalEventStart").then((originalEventStart) => {
expect(newEventStart).to.not.eq(originalEventStart);
});
cy.get("@originalEventEnd").then((originalEventEnd) => {
expect(newEventEnd).to.eq(originalEventEnd);
});
});
});
});
});
it.skip("adds a course event to the calendar when Stundenraster is disabled", () => {
tempusPage.setCurrentSemester();
tempusPage.getCalendarSection().should("exist");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.disableStundenraster();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk("@fetchCoursePickerCourses");
cy.wait(1000);
tempusPage.getCalendarEvents().then(($events) => {
cy.wrap($events.length).as("initialEventCount");
});
tempusPage.getCoursePickerRows().should("have.length.greaterThan", 0);
tempusPage
.getCoursePickerRows()
.first()
.scrollIntoView()
.should("be.visible")
.drag(".fhc-calendar-base-grid-line:first", {
waitForAnimations: true,
animationDistanceThreshold: 0,
target: { position: "top" },
});
waitForOk("@addCalendarEvent");
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
cy.get("@initialEventCount").then((initialEventCount) => {
tempusPage
.getCalendarEvents()
.should("have.length", initialEventCount + 1);
});
});
it.skip("moves an existing event when Stundenraster is disabled", () => {
tempusPage.syncAndReloadPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.disableStundenraster();
cy.wait(1000);
tempusPage
.getCalendarEventsByWeekdayAndStartTime("Wednesday", "11:20:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
tempusPage
.getCalendarEventById(eventId)
.should("be.visible")
.drag(".fhc-calendar-base-grid-line:first", {
waitForAnimations: true,
animationDistanceThreshold: 0,
target: { position: "top" },
});
cy.wait("@updateCalendarEvent").then((interception) => {
expect(interception.response.statusCode).to.eq(200);
const updatedEventId = tempusPage.getUpdatedKalenderId(interception);
expect(updatedEventId, "updated planner event id").to.exist;
cy.wrap(updatedEventId).as("updatedEventId");
});
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
cy.get("@updatedEventId").then((updatedEventId) => {
tempusPage.getCalendarEventById(updatedEventId).should("be.visible");
tempusPage
.getCalendarEventsByWeekday("Monday")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((movedEventJSON) => {
const movedEventId = JSON.parse(movedEventJSON)?.id;
expect(movedEventId).to.eq(updatedEventId);
});
});
});
});
});
it('changes an event room', () => {
tempusPage
.getCalendarEventsByWeekdayAndTimeRange(
'Thursday',
'15:15:00',
'16:00:00',
)
.should('have.length.greaterThan', 0)
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventData = JSON.parse(eventJSON);
const eventId = eventData?.id;
let originalRoom = eventData?.orig?.ort_kurzbz;
if (Array.isArray(originalRoom))
originalRoom = originalRoom.length ? originalRoom[0] : '';
expect(eventId, 'planner event id').to.exist;
expect(originalRoom, 'original event room').to.be.a('string').and.not.be
.empty;
tempusPage.changeEventRoom(eventId, originalRoom).then((result) => {
expect(result.newRoom, 'updated room').to.not.eq(originalRoom);
tempusPage.expectCalendarEventRoom(
result.updatedEventId,
result.newRoom,
);
});
});
});
it('adds multiple rooms to an event', () => {
tempusPage
.getCalendarEventsByWeekdayAndTimeRange(
'Thursday',
'15:15:00',
'16:00:00',
)
.should('have.length.greaterThan', 0)
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventData = JSON.parse(eventJSON);
const eventId = eventData?.id;
const currentRooms = eventData?.orig?.ort_kurzbz ?? [];
expect(eventId, 'planner event id').to.exist;
tempusPage.getCalendarEventById(eventId).rightclick();
tempusPage
.getEventContextMenuOption('Raumauswahl')
.click({ force: true });
waitForOk('@fetchRoomSuggestions');
tempusPage
.selectAdditionalRoomsAndSave(currentRooms)
.then((additionalRooms) => {
tempusPage.waitForUpdatedEventId().then((updatedEventId) => {
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
tempusPage.expectCalendarEventRooms(
updatedEventId,
additionalRooms,
);
});
});
});
});
it('moves an event from the calendar to the parking slot', () => {
tempusPage.getEventParkingSlot().should('exist');
tempusPage.getParkedEvents().should('have.length', 0);
tempusPage
.getCalendarEventsByWeekdayAndStartTime('Wednesday', '08:45:00')
.first()
.drag(tempusPage.selectors.parkingSlot);
tempusPage.getParkedEvents().should('have.length', 1);
});
it('keeps a deleted planner event visible in lecturer and student previews, before syncing', () => {
tempusPage.syncAndReloadPlanner();
tempusPage
.getCalendarEventsBySoftTimeRange('16:10:00', '16:55:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventGroupId =
JSON.parse(eventJSON)?.orig?.eindeutige_kalender_gruppen_id;
expect(eventGroupId).to.exist;
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.rightclick();
tempusPage.getEventContextMenuOption('Delete').click({ force: true });
waitForOk('@deleteCalendarEvent');
waitForOk('@fetchPlanData');
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should('exist');
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should('exist');
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should('exist');
});
});
it('keeps a deleted planner event invisible after syncing', () => {
tempusPage.syncAndReloadPlanner();
tempusPage
.getCalendarEventsBySoftTimeRange('16:55:00', '17:40:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventGroupId =
JSON.parse(eventJSON)?.orig?.eindeutige_kalender_gruppen_id;
expect(eventGroupId).to.exist;
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.rightclick();
tempusPage.getEventContextMenuOption('Delete').click({ force: true });
waitForOk('@deleteCalendarEvent');
waitForOk('@fetchPlanData');
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should('exist');
tempusPage.syncAndReloadPlanner();
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should('not.exist');
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should('not.exist');
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getCalendarEventByUniqueCalenderGroupId(eventGroupId)
.should('not.exist');
});
});
it('resizes an event from the bottom in the planner preview', () => {
tempusPage.getCalendarSection().should('exist');
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEventsByWeekdayAndStartTime('Thursday', '08:00:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
cy.wrap(JSON.parse(eventJSON)).its('id').as('eventId');
cy.wrap(JSON.parse(eventJSON).orig)
.its('beginn')
.as('originalEventStart');
cy.wrap(JSON.parse(eventJSON).orig).its('ende').as('originalEventEnd');
});
cy.get('@eventId').then((eventId) => {
tempusPage.scrollCalendarEventIntoView(eventId).then(() => {
tempusPage
.getCalendarEventById(eventId)
.find('.fhc-resize-bar--bottom')
.first()
.realHover()
.realMouseDown('center', {
button: 'left',
})
.realMouseMove(0, 5)
.realMouseMove(0, 5)
.realMouseMove(0, 10)
.realMouseMove(0, 100)
.realMouseUp();
});
cy.wait('@updateCalendarEvent').then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
const updatedGroupEventId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
cy.wrap(updatedGroupEventId).as('updatedGroupEventId');
});
waitForOk('@fetchPlanData');
cy.get('@updatedGroupEventId').then((updatedGroupEventId) => {
tempusPage
.getCalendarEventByUniqueCalenderGroupId(updatedGroupEventId)
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
let newEventStart = JSON.parse(eventJSON)?.orig?.beginn;
let newEventEnd = JSON.parse(eventJSON)?.orig?.ende;
cy.get('@originalEventStart').then((originalEventStart) => {
expect(newEventStart).to.eq(originalEventStart);
});
cy.get('@originalEventEnd').then((originalEventEnd) => {
expect(newEventEnd).to.not.eq(originalEventEnd);
});
});
});
});
});
it.skip('resizes an event from the top in the planner preview', () => {
tempusPage.getCalendarSection().should('exist');
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEventsByWeekdayAndStartTime('Friday', '10:25:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
cy.wrap(JSON.parse(eventJSON)).its('id').as('eventId');
cy.wrap(JSON.parse(eventJSON).orig)
.its('beginn')
.as('originalEventStart');
cy.wrap(JSON.parse(eventJSON).orig).its('ende').as('originalEventEnd');
});
cy.get('@eventId').then((eventId) => {
tempusPage
.getCalendarEventById(eventId)
.find('.fhc-resize-bar--top')
.first()
.realHover()
.realMouseDown('center', {
button: 'left',
})
.realMouseMove(0, -5)
.realMouseMove(0, -5)
.realMouseMove(0, -10)
.realMouseMove(0, -20)
.realMouseUp();
cy.wait('@updateCalendarEvent').then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
const updatedGroupEventId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
cy.wrap(updatedGroupEventId).as('updatedGroupEventId');
});
waitForOk('@fetchPlanData');
cy.get('@updatedGroupEventId').then((updatedGroupEventId) => {
tempusPage
.getCalendarEventByUniqueCalenderGroupId(updatedGroupEventId)
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
let newEventStart = JSON.parse(eventJSON)?.orig?.beginn;
let newEventEnd = JSON.parse(eventJSON)?.orig?.ende;
cy.get('@originalEventStart').then((originalEventStart) => {
expect(newEventStart).to.not.eq(originalEventStart);
});
cy.get('@originalEventEnd').then((originalEventEnd) => {
expect(newEventEnd).to.eq(originalEventEnd);
});
});
});
});
});
it.skip('adds a course event to the calendar when Stundenraster is disabled', () => {
tempusPage.setCurrentSemester();
tempusPage.getCalendarSection().should('exist');
tempusPage.waitForCalendarToFinishLoading();
tempusPage.disableStundenraster();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.selectCourseByName(TARGETED_STUDY_PLAN_SHORT_CODE);
waitForOk('@fetchCoursePickerCourses');
cy.wait(1000);
tempusPage.getCalendarEvents().then(($events) => {
cy.wrap($events.length).as('initialEventCount');
});
tempusPage.getCoursePickerRows().should('have.length.greaterThan', 0);
tempusPage
.getCoursePickerRows()
.first()
.scrollIntoView()
.should('be.visible')
.drag('.fhc-calendar-base-grid-line:first', {
waitForAnimations: true,
animationDistanceThreshold: 0,
target: { position: 'top' },
});
waitForOk('@addCalendarEvent');
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
cy.get('@initialEventCount').then((initialEventCount) => {
tempusPage
.getCalendarEvents()
.should('have.length', initialEventCount + 1);
});
});
it.skip('moves an existing event when Stundenraster is disabled', () => {
tempusPage.syncAndReloadPlanner();
tempusPage.waitForCalendarToFinishLoading();
tempusPage.disableStundenraster();
cy.wait(1000);
tempusPage
.getCalendarEventsByWeekdayAndStartTime('Wednesday', '11:20:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
const eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
tempusPage
.getCalendarEventById(eventId)
.should('be.visible')
.drag('.fhc-calendar-base-grid-line:first', {
waitForAnimations: true,
animationDistanceThreshold: 0,
target: { position: 'top' },
});
cy.wait('@updateCalendarEvent').then((interception) => {
expect(interception.response.statusCode).to.eq(200);
const updatedEventId = tempusPage.getUpdatedKalenderId(interception);
expect(updatedEventId, 'updated planner event id').to.exist;
cy.wrap(updatedEventId).as('updatedEventId');
});
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
cy.get('@updatedEventId').then((updatedEventId) => {
tempusPage.getCalendarEventById(updatedEventId).should('be.visible');
tempusPage
.getCalendarEventsByWeekday('Monday')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((movedEventJSON) => {
const movedEventId = JSON.parse(movedEventJSON)?.id;
expect(movedEventId).to.eq(updatedEventId);
});
});
});
});
});
@@ -1,356 +1,370 @@
import { waitForOk } from "../../../../support/helpers/network";
import { tempusPage } from "../../../../support/pages/tempus.po";
import { waitForOk } from '../../../../support/helpers/network';
import { tempusPage } from '../../../../support/pages/tempus.po';
import { tempusApi } from '../../../../support/api/tempusApi';
context("Tempus filter tests", () => {
beforeEach(() => {
tempusPage.visitAndWaitForPlanner();
});
context('Tempus filter tests', () => {
before(() => {
cy.login();
it("filters calendar events by a selected room", () => {
tempusPage.waitForCalendarToFinishLoading();
let settingsData = tempusApi.getSettingsData();
settingsData.ignore_kollision = true;
settingsData.roomless_planning = false;
settingsData.room_planning = 'dialog_room_planning';
tempusApi.updateSettingsData(settingsData);
});
tempusPage
.getCalendarEventsWithRoom()
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
beforeEach(() => {
tempusPage.visitAndWaitForPlanner();
});
let selectedRoom = JSON.parse(eventJSON)?.orig?.ort_kurzbz;
if (Array.isArray(selectedRoom)) selectedRoom = selectedRoom.length ? selectedRoom[0] : "";
it('filters calendar events by a selected room', () => {
tempusPage.waitForCalendarToFinishLoading();
expect(selectedRoom, "first event room").to.be.a("string").and.not.be
.empty;
expect(
selectedRoom.length,
"room search query length",
).to.be.greaterThan(1);
tempusPage
.getCalendarEventsWithRoom()
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getNavbarSearchInput().clear().type(selectedRoom, {
parseSpecialCharSequences: false,
});
waitForOk("@searchbarSearch");
let selectedRoom = JSON.parse(eventJSON)?.orig?.ort_kurzbz;
if (Array.isArray(selectedRoom))
selectedRoom = selectedRoom.length ? selectedRoom[0] : '';
tempusPage
.getNavbarRoomSearchResult(selectedRoom)
.should("be.visible")
.click();
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
expect(selectedRoom, 'first event room').to.be.a('string').and.not.be
.empty;
expect(
selectedRoom.length,
'room search query length',
).to.be.greaterThan(1);
tempusPage.getSelectedRoomIndicator(selectedRoom).should("be.visible");
tempusPage.getCalendarEvents().should("have.length.greaterThan", 0);
tempusPage.getCalendarEvents().each(($event) => {
const eventData = tempusPage.getCalendarEventData($event);
tempusPage.getNavbarSearchInput().clear().type(selectedRoom, {
parseSpecialCharSequences: false,
});
waitForOk('@searchbarSearch');
let eventRoom = eventData?.orig?.ort_kurzbz;
if (Array.isArray(eventRoom)) eventRoom = eventRoom.length ? eventRoom.join(",") : "";
tempusPage
.getNavbarRoomSearchResult(selectedRoom)
.should('be.visible')
.click();
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
expect(eventRoom, "event data room").to.contain(
selectedRoom,
);
cy.wrap($event)
.find("[data-cy='calendar-event-room']")
.invoke("text")
.then((eventPlace) => {
expect(eventPlace.trim(), "event body room").to.contain(selectedRoom);
});
});
});
});
tempusPage.getSelectedRoomIndicator(selectedRoom).should('be.visible');
tempusPage.getCalendarEvents().should('have.length.greaterThan', 0);
tempusPage.getCalendarEvents().each(($event) => {
const eventData = tempusPage.getCalendarEventData($event);
it("restores all calendar events after removing a room filter", () => {
tempusPage.waitForCalendarToFinishLoading();
let eventRoom = eventData?.orig?.ort_kurzbz;
if (Array.isArray(eventRoom))
eventRoom = eventRoom.length ? eventRoom.join(',') : '';
tempusPage
.getCalendarEventsWithRoom()
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
expect(eventRoom, 'event data room').to.contain(selectedRoom);
cy.wrap($event)
.find("[data-cy='calendar-event-room']")
.invoke('text')
.then((eventPlace) => {
expect(eventPlace.trim(), 'event body room').to.contain(
selectedRoom,
);
});
});
});
});
let selectedRoom = JSON.parse(eventJSON)?.orig?.ort_kurzbz;
if (Array.isArray(selectedRoom)) selectedRoom = selectedRoom.length ? selectedRoom[0] : "";
it('restores all calendar events after removing a room filter', () => {
tempusPage.waitForCalendarToFinishLoading();
expect(selectedRoom, "first event room").to.be.a("string").and.not.be
.empty;
expect(
selectedRoom.length,
"room search query length",
).to.be.greaterThan(1);
tempusPage
.getCalendarEventsWithRoom()
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getCalendarEvents().then(($events) => {
const originalEventCount = $events.length;
cy.wrap(originalEventCount).as("originalEventCount");
});
let selectedRoom = JSON.parse(eventJSON)?.orig?.ort_kurzbz;
if (Array.isArray(selectedRoom))
selectedRoom = selectedRoom.length ? selectedRoom[0] : '';
tempusPage.getNavbarSearchInput().clear().type(selectedRoom, {
parseSpecialCharSequences: false,
});
waitForOk("@searchbarSearch");
expect(selectedRoom, 'first event room').to.be.a('string').and.not.be
.empty;
expect(
selectedRoom.length,
'room search query length',
).to.be.greaterThan(1);
tempusPage
.getNavbarRoomSearchResult(selectedRoom)
.should("be.visible")
.click();
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getCalendarEvents().then(($events) => {
const originalEventCount = $events.length;
cy.wrap(originalEventCount).as('originalEventCount');
});
tempusPage.getSelectedRoomIndicator(selectedRoom).should("be.visible");
tempusPage.getCalendarEvents().should("have.length.greaterThan", 0);
tempusPage.getNavbarSearchInput().clear().type(selectedRoom, {
parseSpecialCharSequences: false,
});
waitForOk('@searchbarSearch');
tempusPage.getSelectedRoomRemoveButton(selectedRoom).first().click();
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getNavbarRoomSearchResult(selectedRoom)
.should('be.visible')
.click();
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getSelectedRoomIndicator(selectedRoom).should("not.exist");
cy.get("@originalEventCount").then((originalEventCount) => {
tempusPage
.getCalendarEvents()
.should("have.length", originalEventCount);
});
});
});
tempusPage.getSelectedRoomIndicator(selectedRoom).should('be.visible');
tempusPage.getCalendarEvents().should('have.length.greaterThan', 0);
it("filters calendar events by a selected lecturer", () => {
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getSelectedRoomRemoveButton(selectedRoom).first().click();
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEventsWithLecturer()
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getSelectedRoomIndicator(selectedRoom).should('not.exist');
cy.get('@originalEventCount').then((originalEventCount) => {
tempusPage
.getCalendarEvents()
.should('have.length', originalEventCount);
});
});
});
const selectedLecturer = tempusPage.getFirstLecturer(
JSON.parse(eventJSON),
);
expect(selectedLecturer?.kurzbz, "first event lecturer").to.exist;
it('filters calendar events by a selected lecturer', () => {
tempusPage.waitForCalendarToFinishLoading();
const lecturerSearch =
selectedLecturer.mitarbeiter_uid ??
selectedLecturer.uid ??
selectedLecturer.kurzbz;
expect(lecturerSearch, "lecturer search query").to.be.a("string").and
.not.be.empty;
tempusPage
.getCalendarEventsWithLecturer()
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getNavbarSearchInput().clear().type(lecturerSearch, {
parseSpecialCharSequences: false,
});
waitForOk("@searchbarSearch");
const selectedLecturer = tempusPage.getFirstLecturer(
JSON.parse(eventJSON),
);
expect(selectedLecturer?.kurzbz, 'first event lecturer').to.exist;
tempusPage
.getFirstNavbarEmployeeSearchResult()
.should("be.visible")
.invoke("text")
.then((lecturerName) => {
const selectedLecturerName = lecturerName.trim();
const lecturerSearch =
selectedLecturer.mitarbeiter_uid ??
selectedLecturer.uid ??
selectedLecturer.kurzbz;
expect(lecturerSearch, 'lecturer search query').to.be.a('string').and
.not.be.empty;
tempusPage.getFirstNavbarEmployeeSearchResult().click();
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getNavbarSearchInput().clear().type(lecturerSearch, {
parseSpecialCharSequences: false,
});
waitForOk('@searchbarSearch');
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should("be.visible");
tempusPage.getCalendarEvents().should("have.length.greaterThan", 0);
tempusPage.getCalendarEvents().each(($event) => {
const eventData = tempusPage.getCalendarEventData($event);
const eventLecturers = eventData?.orig?.lektor ?? [];
tempusPage
.getFirstNavbarEmployeeSearchResult()
.should('be.visible')
.invoke('text')
.then((lecturerName) => {
const selectedLecturerName = lecturerName.trim();
expect(
eventLecturers.map((lecturer) => lecturer.kurzbz),
"event data lecturers",
).to.include(selectedLecturer.kurzbz);
cy.wrap($event)
.find(".event-lectors")
.then(($lecturers) => {
const bodyLecturers = [...$lecturers].map((lecturer) =>
lecturer.innerText.trim(),
);
tempusPage.getFirstNavbarEmployeeSearchResult().click();
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
expect(bodyLecturers, "event body lecturers").to.include(
selectedLecturer.kurzbz,
);
});
});
});
});
});
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should('be.visible');
tempusPage.getCalendarEvents().should('have.length.greaterThan', 0);
tempusPage.getCalendarEvents().each(($event) => {
const eventData = tempusPage.getCalendarEventData($event);
const eventLecturers = eventData?.orig?.lektor ?? [];
it("restores all calendar events after removing a lecturer filter", () => {
tempusPage.waitForCalendarToFinishLoading();
expect(
eventLecturers.map((lecturer) => lecturer.kurzbz),
'event data lecturers',
).to.include(selectedLecturer.kurzbz);
cy.wrap($event)
.find('.event-lectors')
.then(($lecturers) => {
const bodyLecturers = [...$lecturers].map((lecturer) =>
lecturer.innerText.trim(),
);
tempusPage
.getCalendarEventsWithLecturer()
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
expect(bodyLecturers, 'event body lecturers').to.include(
selectedLecturer.kurzbz,
);
});
});
});
});
});
const selectedLecturer = tempusPage.getFirstLecturer(
JSON.parse(eventJSON),
);
expect(selectedLecturer?.kurzbz, "first event lecturer").to.exist;
it('restores all calendar events after removing a lecturer filter', () => {
tempusPage.waitForCalendarToFinishLoading();
const lecturerSearch =
selectedLecturer.mitarbeiter_uid ??
selectedLecturer.uid ??
selectedLecturer.kurzbz;
expect(lecturerSearch, "lecturer search query").to.be.a("string").and
.not.be.empty;
tempusPage
.getCalendarEventsWithLecturer()
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getCalendarEvents().then(($events) => {
const originalEventCount = $events.length;
cy.wrap(originalEventCount).as("originalEventCount");
});
const selectedLecturer = tempusPage.getFirstLecturer(
JSON.parse(eventJSON),
);
expect(selectedLecturer?.kurzbz, 'first event lecturer').to.exist;
tempusPage.getNavbarSearchInput().clear().type(lecturerSearch, {
parseSpecialCharSequences: false,
});
waitForOk("@searchbarSearch");
const lecturerSearch =
selectedLecturer.mitarbeiter_uid ??
selectedLecturer.uid ??
selectedLecturer.kurzbz;
expect(lecturerSearch, 'lecturer search query').to.be.a('string').and
.not.be.empty;
tempusPage
.getFirstNavbarEmployeeSearchResult()
.should("be.visible")
.invoke("text")
.then((lecturerName) => {
const selectedLecturerName = lecturerName.trim();
tempusPage.getCalendarEvents().then(($events) => {
const originalEventCount = $events.length;
cy.wrap(originalEventCount).as('originalEventCount');
});
tempusPage.getFirstNavbarEmployeeSearchResult().click();
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getNavbarSearchInput().clear().type(lecturerSearch, {
parseSpecialCharSequences: false,
});
waitForOk('@searchbarSearch');
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should("be.visible");
tempusPage.getCalendarEvents().should("have.length.greaterThan", 0);
tempusPage
.getFirstNavbarEmployeeSearchResult()
.should('be.visible')
.invoke('text')
.then((lecturerName) => {
const selectedLecturerName = lecturerName.trim();
tempusPage
.getSelectedLecturerRemoveButton(selectedLecturerName)
.click();
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getFirstNavbarEmployeeSearchResult().click();
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should("not.exist");
cy.get("@originalEventCount").then((originalEventCount) => {
tempusPage
.getCalendarEvents()
.should("have.length", originalEventCount);
});
});
});
});
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should('be.visible');
tempusPage.getCalendarEvents().should('have.length.greaterThan', 0);
it("hides calendar events when the selected lecturer's plan is disabled", () => {
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getSelectedLecturerRemoveButton(selectedLecturerName)
.click();
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getCalendarEventsWithLecturer()
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should('not.exist');
cy.get('@originalEventCount').then((originalEventCount) => {
tempusPage
.getCalendarEvents()
.should('have.length', originalEventCount);
});
});
});
});
const selectedLecturer = tempusPage.getFirstLecturer(
JSON.parse(eventJSON),
);
expect(selectedLecturer?.kurzbz, "first event lecturer").to.exist;
it("hides calendar events when the selected lecturer's plan is disabled", () => {
tempusPage.waitForCalendarToFinishLoading();
const lecturerSearch =
selectedLecturer.mitarbeiter_uid ??
selectedLecturer.uid ??
selectedLecturer.kurzbz;
expect(lecturerSearch, "lecturer search query").to.be.a("string").and
.not.be.empty;
tempusPage
.getCalendarEventsWithLecturer()
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getNavbarSearchInput().clear().type(lecturerSearch, {
parseSpecialCharSequences: false,
});
waitForOk("@searchbarSearch");
const selectedLecturer = tempusPage.getFirstLecturer(
JSON.parse(eventJSON),
);
expect(selectedLecturer?.kurzbz, 'first event lecturer').to.exist;
tempusPage
.getFirstNavbarEmployeeSearchResult()
.should("be.visible")
.invoke("text")
.then((lecturerName) => {
const selectedLecturerName = lecturerName.trim();
const lecturerSearch =
selectedLecturer.mitarbeiter_uid ??
selectedLecturer.uid ??
selectedLecturer.kurzbz;
expect(lecturerSearch, 'lecturer search query').to.be.a('string').and
.not.be.empty;
tempusPage.getFirstNavbarEmployeeSearchResult().click();
waitForOk("@fetchPlanData");
tempusPage.waitForCalendarToFinishLoading();
tempusPage.getNavbarSearchInput().clear().type(lecturerSearch, {
parseSpecialCharSequences: false,
});
waitForOk('@searchbarSearch');
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should("be.visible");
tempusPage.getCalendarEvents().should("have.length.greaterThan", 0);
tempusPage
.getFirstNavbarEmployeeSearchResult()
.should('be.visible')
.invoke('text')
.then((lecturerName) => {
const selectedLecturerName = lecturerName.trim();
tempusPage
.getSelectedLecturerPlanToggle(selectedLecturerName)
.click();
tempusPage.getCalendarEvents().should("not.exist");
});
});
});
tempusPage.getFirstNavbarEmployeeSearchResult().click();
waitForOk('@fetchPlanData');
tempusPage.waitForCalendarToFinishLoading();
it("toggles wish overlays for the selected lecturer", () => {
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should('be.visible');
tempusPage.getCalendarEvents().should('have.length.greaterThan', 0);
tempusPage
.getCalendarEventsWithLecturer()
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage
.getSelectedLecturerPlanToggle(selectedLecturerName)
.click();
tempusPage.getCalendarEvents().should('not.exist');
});
});
});
const selectedLecturer = tempusPage.getFirstLecturer(
JSON.parse(eventJSON),
);
expect(selectedLecturer?.kurzbz, "first event lecturer").to.exist;
it('toggles wish overlays for the selected lecturer', () => {
tempusPage.waitForCalendarToFinishLoading();
const lecturerSearch =
selectedLecturer.mitarbeiter_uid ??
selectedLecturer.uid ??
selectedLecturer.kurzbz;
expect(lecturerSearch, "lecturer search query").to.be.a("string").and
.not.be.empty;
tempusPage
.getCalendarEventsWithLecturer()
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getNavbarSearchInput().clear().type(lecturerSearch, {
parseSpecialCharSequences: false,
});
waitForOk("@searchbarSearch");
const selectedLecturer = tempusPage.getFirstLecturer(
JSON.parse(eventJSON),
);
expect(selectedLecturer?.kurzbz, 'first event lecturer').to.exist;
tempusPage
.getFirstNavbarEmployeeSearchResult()
.should("be.visible")
.invoke("text")
.then((lecturerName) => {
const selectedLecturerName = lecturerName.trim();
const lecturerSearch =
selectedLecturer.mitarbeiter_uid ??
selectedLecturer.uid ??
selectedLecturer.kurzbz;
expect(lecturerSearch, 'lecturer search query').to.be.a('string').and
.not.be.empty;
tempusPage.getFirstNavbarEmployeeSearchResult().click();
waitForOk("@fetchPlanData");
tempusPage.getNavbarSearchInput().clear().type(lecturerSearch, {
parseSpecialCharSequences: false,
});
waitForOk('@searchbarSearch');
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getFirstNavbarEmployeeSearchResult()
.should('be.visible')
.invoke('text')
.then((lecturerName) => {
const selectedLecturerName = lecturerName.trim();
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should("be.visible");
tempusPage
.getSelectedLecturerWishToggle(selectedLecturerName)
.should("be.visible")
.click();
tempusPage.getLecturerWishOverlays().should("have.length", 0);
tempusPage.getFirstNavbarEmployeeSearchResult().click();
waitForOk('@fetchPlanData');
tempusPage
.getSelectedLecturerWishToggle(selectedLecturerName)
.should("be.visible")
.click();
tempusPage
.getLecturerWishOverlays()
.should("have.length.greaterThan", 0);
});
});
});
tempusPage.waitForCalendarToFinishLoading();
tempusPage
.getSelectedLecturerIndicator(selectedLecturerName)
.should('be.visible');
tempusPage
.getSelectedLecturerWishToggle(selectedLecturerName)
.should('be.visible')
.click();
tempusPage.getLecturerWishOverlays().should('have.length', 0);
tempusPage
.getSelectedLecturerWishToggle(selectedLecturerName)
.should('be.visible')
.click();
tempusPage
.getLecturerWishOverlays()
.should('have.length.greaterThan', 0);
});
});
});
});
@@ -1,335 +1,383 @@
import { waitForOk } from "../../../../support/helpers/network";
import { tempusApi } from "../../../../support/api/tempusApi";
import { waitForOk } from '../../../../support/helpers/network';
import { tempusApi } from '../../../../support/api/tempusApi';
import {
LEKTOR,
PLANER,
STUDENT,
tempusPage,
} from "../../../../support/pages/tempus.po";
LEKTOR,
PLANER,
STUDENT,
tempusPage,
} from '../../../../support/pages/tempus.po';
context("Tempus role preview tests", () => {
beforeEach(() => {
tempusPage.visitAndWaitForPlanner();
context('Tempus role preview tests', () => {
before(() => {
cy.login();
tempusApi.deletePlannerEventsForDay("monday");
});
let settingsData = tempusApi.getSettingsData();
settingsData.ignore_kollision = true;
settingsData.roomless_planning = false;
settingsData.room_planning = 'dialog_room_planning';
tempusApi.updateSettingsData(settingsData);
});
beforeEach(() => {
tempusPage.visitAndWaitForPlanner();
it("shows the same number of calendar events for all role previews", () => {
const rolePreviews = [PLANER, LEKTOR, STUDENT];
const eventCounts = {};
tempusApi.deletePlannerEventsForDay('monday');
});
tempusPage.syncAndReloadPlanner();
it('shows the same number of calendar events for all role previews', () => {
const rolePreviews = [PLANER, LEKTOR, STUDENT];
const eventCounts = {};
cy.wrap(rolePreviews)
.each((role) => {
tempusPage.selectRoleAndWait(role);
tempusPage.syncAndReloadPlanner();
tempusPage.getCalendarEvents().then(($events) => {
eventCounts[role] = $events.length;
});
})
.then(() => {
const expectedCount = eventCounts[rolePreviews[0]];
cy.wrap(rolePreviews)
.each((role) => {
tempusPage.selectRoleAndWait(role);
Object.entries(eventCounts).forEach(([role, count]) => {
expect(count, `${role} calendar event count`).to.eq(expectedCount);
});
});
});
tempusPage.getCalendarEvents().then(($events) => {
eventCounts[role] = $events.length;
});
})
.then(() => {
const expectedCount = eventCounts[rolePreviews[0]];
it("keeps events unchanged in lecturer and student previews after a planner edit", () => {
tempusPage.syncAndReloadPlanner();
Object.entries(eventCounts).forEach(([role, count]) => {
expect(count, `${role} calendar event count`).to.eq(expectedCount);
});
});
});
tempusPage
.getCalendarEventsByTimeRange("13:35:00", "14:20:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
it('keeps events unchanged in lecturer and student previews after a planner edit', () => {
tempusPage.syncAndReloadPlanner();
let eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
tempusPage
.getCalendarEventsByTimeRange('13:35:00', '14:20:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.dropEventOnCalendarPart(eventId, 3, {
scrollIntoView: true,
});
let eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
cy.wait("@updateCalendarEvent").then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
tempusPage.dropEventOnCalendarPart(eventId, 3, {
scrollIntoView: true,
});
const updatedEventGroupId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
cy.wait('@updateCalendarEvent').then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
cy.wrap(updatedEventGroupId).as("updatedEventGroupId");
});
waitForOk("@fetchPlanData");
const updatedEventGroupId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
cy.get("@updatedEventGroupId").then((updatedEventGroupId) => {
tempusPage.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId).then((gridRowStyle) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId).then((lecturerGridRow) => {
expect(lecturerGridRow).to.not.eq(gridRowStyle);
});
cy.wrap(updatedEventGroupId).as('updatedEventGroupId');
});
waitForOk('@fetchPlanData');
tempusPage.selectRoleAndWait(STUDENT);
tempusPage.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId).then((studentGridRow) => {
expect(studentGridRow).to.not.eq(gridRowStyle);
});
});
});
});
cy.get('@updatedEventGroupId').then((updatedEventGroupId) => {
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((gridRowStyle) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(
updatedEventGroupId,
)
.then((lecturerGridRow) => {
expect(lecturerGridRow).to.not.eq(gridRowStyle);
});
cy.get(".fhc-calendar-base-grid > div:last-child()").invoke(
"css",
"overflow",
"auto",
);
});
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(
updatedEventGroupId,
)
.then((studentGridRow) => {
expect(studentGridRow).to.not.eq(gridRowStyle);
});
});
});
});
it("keeps events unchanged in lecturer and student previews after a planner edit and syncing", () => {
tempusPage.syncAndReloadPlanner();
cy.get('.fhc-calendar-base-grid > div:last-child()').invoke(
'css',
'overflow',
'auto',
);
});
tempusPage
.getCalendarEventsBySoftTimeRange("13:35:00", "14:20:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
it('keeps events unchanged in lecturer and student previews after a planner edit and syncing', () => {
tempusPage.syncAndReloadPlanner();
let eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
tempusPage
.getCalendarEventsBySoftTimeRange('13:35:00', '14:20:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.dropEventOnCalendarPart(eventId, 4, {
scrollIntoView: true,
});
let eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
cy.wait("@updateCalendarEvent").then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
const updatedEventGroupId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
tempusPage.dropEventOnCalendarPart(eventId, 4, {
scrollIntoView: true,
});
cy.wrap(updatedEventGroupId).as("updatedEventGroupId");
});
waitForOk("@fetchPlanData");
cy.wait('@updateCalendarEvent').then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
tempusPage.syncAndReloadPlanner();
const updatedEventGroupId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
cy.get("@updatedEventGroupId").then((updatedEventGroupId) => {
tempusPage.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId).then((gridRowStyle) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((lecturerGridRow) => {
expect(lecturerGridRow).not.to.eq(gridRowStyle);
});
cy.wrap(updatedEventGroupId).as('updatedEventGroupId');
});
waitForOk('@fetchPlanData');
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((studentGridRow) => {
expect(studentGridRow).not.to.eq(gridRowStyle);
});
});
});
});
});
tempusPage.syncAndReloadPlanner();
it("updates events in the lecturer preview but not the student preview after releasing and syncing", () => {
tempusPage.syncAndReloadPlanner();
cy.get('@updatedEventGroupId').then((updatedEventGroupId) => {
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((gridRowStyle) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(
updatedEventGroupId,
)
.then((lecturerGridRow) => {
expect(lecturerGridRow).not.to.eq(gridRowStyle);
});
tempusPage
.getCalendarEventsBySoftTimeRange("13:35:00", "14:20:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(
updatedEventGroupId,
)
.then((studentGridRow) => {
expect(studentGridRow).not.to.eq(gridRowStyle);
});
});
});
});
});
const eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
it('updates events in the lecturer preview but not the student preview after releasing and syncing', () => {
tempusPage.syncAndReloadPlanner();
const updatedEventGroupId = JSON.parse(eventJSON)?.orig?.eindeutige_kalender_gruppen_id;
expect(updatedEventGroupId).to.exist;
tempusPage
.getCalendarEventsBySoftTimeRange('13:35:00', '14:20:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.dropEventOnCalendarPart(eventId, 4, {
scrollIntoView: true,
});
const eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
cy.wait("@updateCalendarEvent").then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
const updatedEventGroupId =
JSON.parse(eventJSON)?.orig?.eindeutige_kalender_gruppen_id;
expect(updatedEventGroupId).to.exist;
const updatedEventGroupId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
tempusPage.dropEventOnCalendarPart(eventId, 4, {
scrollIntoView: true,
});
cy.wrap(updatedEventGroupId).as("updatedEventGroupId");
});
waitForOk("@fetchPlanData");
cy.wait('@updateCalendarEvent').then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
tempusPage.getCalendarEventByUniqueCalenderGroupId(updatedEventGroupId).rightclick();
tempusPage
.getEventContextMenuOption("Freischalten für Voransicht")
.click({ force: true });
waitForOk("@syncCalendarToLecturer");
waitForOk("@fetchPlanData");
const updatedEventGroupId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
tempusPage.syncAndReloadPlanner();
cy.wrap(updatedEventGroupId).as('updatedEventGroupId');
});
waitForOk('@fetchPlanData');
cy.get("@updatedEventGroupId").then((updatedEventGroupId) => {
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((plannerGridRow) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((lecturerGridRow) => {
expect(lecturerGridRow).to.eq(plannerGridRow);
});
tempusPage
.getCalendarEventByUniqueCalenderGroupId(updatedEventGroupId)
.rightclick();
tempusPage
.getEventContextMenuOption('Freischalten für Voransicht')
.click({ force: true });
waitForOk('@syncCalendarToLecturer');
waitForOk('@fetchPlanData');
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((studentGridRow) => {
expect(studentGridRow).not.to.eq(plannerGridRow);
});
});
});
});
});
tempusPage.syncAndReloadPlanner();
it("updates events in the lecturer and student previews after releasing for live and syncing", () => {
tempusPage.syncAndReloadPlanner();
cy.get('@updatedEventGroupId').then((updatedEventGroupId) => {
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((plannerGridRow) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(
updatedEventGroupId,
)
.then((lecturerGridRow) => {
expect(lecturerGridRow).to.eq(plannerGridRow);
});
tempusPage
.getCalendarEventsBySoftTimeRange("13:35:00", "14:20:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(
updatedEventGroupId,
)
.then((studentGridRow) => {
expect(studentGridRow).not.to.eq(plannerGridRow);
});
});
});
});
});
const eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
const updatedEventGroupId =
JSON.parse(eventJSON)?.orig?.eindeutige_kalender_gruppen_id;
expect(updatedEventGroupId).to.exist;
it('updates events in the lecturer and student previews after releasing for live and syncing', () => {
tempusPage.syncAndReloadPlanner();
tempusPage.dropEventOnCalendarPart(eventId, 4, {
scrollIntoView: true,
});
tempusPage
.getCalendarEventsBySoftTimeRange('13:35:00', '14:20:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
cy.wait("@updateCalendarEvent").then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
const eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
const updatedEventGroupId =
JSON.parse(eventJSON)?.orig?.eindeutige_kalender_gruppen_id;
expect(updatedEventGroupId).to.exist;
const updatedEventGroupId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
tempusPage.dropEventOnCalendarPart(eventId, 4, {
scrollIntoView: true,
});
cy.wrap(updatedEventGroupId).as("updatedEventGroupId");
});
waitForOk("@fetchPlanData");
cy.wait('@updateCalendarEvent').then((interception) => {
expect(interception.response.statusCode).to.eq(200);
expect(interception.response.body.data).to.exist;
tempusPage
.getCalendarEventByUniqueCalenderGroupId(updatedEventGroupId)
.rightclick();
tempusPage
.getEventContextMenuOption("Freischalten für Live")
.click({ force: true });
waitForOk("@syncCalendarToStudent");
waitForOk("@fetchPlanData");
const updatedEventGroupId =
interception.response.body.data?.eindeutige_kalender_gruppen_id ??
interception.response.body.data;
tempusPage.syncAndReloadPlanner();
cy.wrap(updatedEventGroupId).as('updatedEventGroupId');
});
waitForOk('@fetchPlanData');
cy.get("@updatedEventGroupId").then((updatedEventGroupId) => {
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((plannerGridRow) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((lecturerGridRow) => {
expect(lecturerGridRow).to.eq(plannerGridRow);
});
tempusPage
.getCalendarEventByUniqueCalenderGroupId(updatedEventGroupId)
.rightclick();
tempusPage
.getEventContextMenuOption('Freischalten für Live')
.click({ force: true });
waitForOk('@syncCalendarToStudent');
waitForOk('@fetchPlanData');
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((studentGridRow) => {
expect(studentGridRow).to.eq(plannerGridRow);
});
});
});
});
});
it("prevents event changes in the lecturer preview", () => {
tempusPage.syncAndReloadPlanner();
tempusPage.syncAndReloadPlanner();
tempusPage.selectRoleAndWait(LEKTOR);
cy.get('@updatedEventGroupId').then((updatedEventGroupId) => {
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(updatedEventGroupId)
.then((plannerGridRow) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(
updatedEventGroupId,
)
.then((lecturerGridRow) => {
expect(lecturerGridRow).to.eq(plannerGridRow);
});
tempusPage
.getCalendarEventsBySoftTimeRange("08:00:00", "14:20:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingUniqueCalendarGroupId(
updatedEventGroupId,
)
.then((studentGridRow) => {
expect(studentGridRow).to.eq(plannerGridRow);
});
});
});
});
});
let eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
it('prevents event changes in the lecturer preview', () => {
tempusPage.syncAndReloadPlanner();
tempusPage.dropEventOnCalendarPart(eventId, 15);
tempusPage.selectRoleAndWait(LEKTOR);
cy.get("@updateCalendarEvent").should("not.exist");
tempusPage
.getCalendarEventsBySoftTimeRange('08:00:00', '14:20:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getGridRowByContainingEventId(eventId).then((gridRowStyle) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage.getGridRowByContainingEventId(eventId).then((lecturerGridRow) => {
expect(lecturerGridRow).to.eq(gridRowStyle);
});
let eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
tempusPage.selectRoleAndWait(STUDENT);
tempusPage.getGridRowByContainingEventId(eventId).then((studentGridRow) => {
expect(studentGridRow).to.eq(gridRowStyle);
});
});
});
});
tempusPage.dropEventOnCalendarPart(eventId, 15);
it("prevents event changes in the student preview", () => {
tempusPage.syncAndReloadPlanner();
cy.get('@updateCalendarEvent').should('not.exist');
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingEventId(eventId)
.then((gridRowStyle) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingEventId(eventId)
.then((lecturerGridRow) => {
expect(lecturerGridRow).to.eq(gridRowStyle);
});
tempusPage
.getCalendarEventsBySoftTimeRange("08:00:00", "14:20:00")
.first()
.invoke("attr", "data-fhc-draggable-value")
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingEventId(eventId)
.then((studentGridRow) => {
expect(studentGridRow).to.eq(gridRowStyle);
});
});
});
});
let eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
it('prevents event changes in the student preview', () => {
tempusPage.syncAndReloadPlanner();
tempusPage.dropEventOnCalendarPart(eventId, 15);
tempusPage.selectRoleAndWait(STUDENT);
cy.get("@updateCalendarEvent").should("not.exist");
tempusPage
.getCalendarEventsBySoftTimeRange('08:00:00', '14:20:00')
.first()
.invoke('attr', 'data-fhc-draggable-value')
.then((eventJSON) => {
expect(eventJSON).to.exist;
tempusPage.getGridRowByContainingEventId(eventId).then((gridRowStyle) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage.getGridRowByContainingEventId(eventId).then((lecturerGridRow) => {
expect(lecturerGridRow).to.eq(gridRowStyle);
});
let eventId = JSON.parse(eventJSON)?.id;
expect(eventId).to.exist;
tempusPage.selectRoleAndWait(STUDENT);
tempusPage.getGridRowByContainingEventId(eventId).then((studentGridRow) => {
expect(studentGridRow).to.eq(gridRowStyle);
});
});
});
});
tempusPage.dropEventOnCalendarPart(eventId, 15);
cy.get('@updateCalendarEvent').should('not.exist');
tempusPage
.getGridRowByContainingEventId(eventId)
.then((gridRowStyle) => {
tempusPage.selectRoleAndWait(LEKTOR);
tempusPage
.getGridRowByContainingEventId(eventId)
.then((lecturerGridRow) => {
expect(lecturerGridRow).to.eq(gridRowStyle);
});
tempusPage.selectRoleAndWait(STUDENT);
tempusPage
.getGridRowByContainingEventId(eventId)
.then((studentGridRow) => {
expect(studentGridRow).to.eq(gridRowStyle);
});
});
});
});
});
File diff suppressed because it is too large Load Diff