Skip to content

Commit

Permalink
Merge branch 'main' into fix/NoForcedAwsSdkOnAdmin
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekCrannaford authored Oct 4, 2024
2 parents ec11440 + fa14a49 commit f108233
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 10 deletions.
34 changes: 30 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop, main ]

Expand All @@ -16,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 Expand Up @@ -130,11 +129,11 @@ jobs:
-v ${{ github.workspace }}/boilerplate/.codepipeline/test_agent/configs/test_agent-config.php:/var/www/html/config.php:rw \
-v ${{ github.workspace }}/boilerplate/test:/var/www/html/test:rw \
-v ${{ github.workspace }}/boilerplate/storage:/var/www/html/storage:rw \
-v ${{ github.workspace }}/core/system:/var/www/html/system:rw \
-e DB_HOST=mysql-8 \
-e DB_USERNAME=$DB_USERNAME \
-e DB_PASSWORD=$DB_PASSWORD \
-e DB_DATABASE=$DB_DATABASE \
-e INSTALL_CORE_BRANCH=$CORE_BRANCH \
-e ENVIRONMENT=development \
--network=cmfive \
$BOILERPLATE_IMAGE
Expand All @@ -152,6 +151,23 @@ jobs:
fi
done
- name: Get source code details
if: ${{ failure() }} || ${{ success() }}
run: |
echo ">> CONTAINER LABELS (BOILERPLATE) <<"
echo "===================================="
docker inspect --format='{{range $key, $value := .Config.Labels}}{{$key}}={{$value}}{{println}}{{end}}' cmfive
echo ""
echo ""
echo ">> CORE COMMIT DETAILS <<"
echo "========================="
echo "VENDOR DIRECTORY: (should be unused)"
docker exec -u cmfive cmfive sh -c "cd composer/vendor/2pisoftware/cmfive-core && git log -1 --pretty=format:"CORE_HASH=\"%H\"%nCORE_COMMIT_MSG=\"%s\"%nCORE_REF=\"%D\"""
echo ""
echo "MOUNTED CORE: (should be used, this is mounted to /system)"
pushd core
git log -1 --pretty=format:"CORE_HASH=\"%H\"%nCORE_COMMIT_MSG=\"%s\"%nCORE_REF=\"%D\""
- name: Compile the theme
run: |
# Copy the theme from the docker container
Expand All @@ -166,6 +182,16 @@ jobs:
- name: Setup cmfive Test Environment
run: |
docker exec -t cmfive sh -c "chmod -R ugo=rwX /var/www/html*"
sudo locale-gen en_AU.UTF-8
sudo update-locale en_AU.UTF-8
LANG=en_AU.UTF-8
LC_ALL=en_AU.UTF-8
echo "Test Execution context:"
echo "Runner locale info"
date
locale
echo "Web host timezone"
docker exec -t cmfive sh -c "date"
- name: Inject configs into cmfive Test Environment
run: |
Expand Down Expand Up @@ -271,7 +297,7 @@ jobs:
if [ $? -gt 0 ]; then
echo "Timelog module tests failed"
fi
- name: Get container logs
if: ${{ failure() }} || ${{ success() }}
run: |
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 f108233

Please sign in to comment.