Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into observation/tryForInf…
Browse files Browse the repository at this point in the history
…oFromCI
  • Loading branch information
Derek Crannaford committed Sep 25, 2024
2 parents c869dd6 + 2dee6e5 commit c8845b0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:
DB_PASSWORD: cmfive_test
DB_DATABASE: cmfive_test
PLAYWRIGHT_MODULES: "admin channel form tag report task timelog"
LANG: en_AU.UTF-8

jobs:
# Lint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ test("You can create a Timelog using Timer" , async ({page, isMobile}) => {
const taskID = await TaskHelper.createTask(page, isMobile, task, taskgroup, "Software Development");

const timelog = CmfiveHelper.randomID("timelog_");
await TimelogHelper.createTimelogFromTimer(page, isMobile, timelog, task, taskID);

const start_time = new DateTime('now').minus({hours: 1}).toFormat("HH:mm");
await TimelogHelper.createTimelogFromTimer(page, isMobile, timelog, task, taskID, start_time);
await TimelogHelper.deleteTimelog(page, isMobile, timelog, task, taskID);
await TaskHelper.deleteTask(page, isMobile, task, taskID);
await TaskHelper.deleteTaskGroup(page, isMobile, taskgroup, taskgroupID);
Expand All @@ -49,7 +49,7 @@ test("You can create a Timelog using Add Timelog" , async ({page, isMobile}) =>
timelog,
task,
taskID,
DateTime.fromFormat("1/1/2021", "d/M/yyyy"),
DateTime.fromFormat("1/2/2021", "d/M/yyyy"),
"10:00",
"11:00",
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export class TimelogHelper {
await page.getByRole("link", {name: "Time Log"}).click();
await page.reload();
await expect(page.getByText(timelog)).toBeVisible();
//check timelog date and time values
await expect(page.getByText(new DateTime('now').toFormat("dd-LL-yyyy") + ' ' + start_time)).toBeVisible();
}

static async createTimelog(page: Page, isMobile: boolean, timelog: string, taskName: string, taskID: string, date: DateTime, start_time: string, end_time: string, check_duplicate: boolean = false)
Expand Down Expand Up @@ -71,6 +73,9 @@ export class TimelogHelper {
await expect(page.getByText(timelog)).toBeHidden();
else
await expect(page.getByText(timelog)).toBeVisible();
//check timelog date and time values
await expect(page.getByText(date.toFormat("dd-LL-yyyy") + ' ' + start_time)).toBeVisible();
await expect(page.getByText(date.toFormat("dd-LL-yyyy") + ' ' + end_time)).toBeVisible();
}

static async editTimelog(page: Page, isMobile: boolean, timelog: string, taskName: string, taskID: string, date: DateTime, start_time: string, end_time: string)
Expand Down
8 changes: 5 additions & 3 deletions system/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -546,9 +546,7 @@ public function start($init_database = true)
$this->ctx('error', "An error occoured, if this message persists please contact your administrator.");
});
}
if ($init_database) {
$this->initDB();
}


// Set the timezone from Config
$timezone = Config::get('system.timezone');
Expand All @@ -557,6 +555,10 @@ public function start($init_database = true)
}
date_default_timezone_set($timezone);

if ($init_database) {
$this->initDB();
}

//check config for 'gc_maxlifetime' for the session
$gc_maxlifetime = Config::get('system.gc_maxlifetime');
//Checks include is greater than 1 hour (3600 sec) is less than 1 month (2628000 sec)
Expand Down

0 comments on commit c8845b0

Please sign in to comment.