Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: merge main into develop #343

Merged
merged 6 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches: [ develop ]
pull_request:
branches: [ develop, master ]
branches: [ develop, main ]

workflow_dispatch:
env:
Expand All @@ -16,7 +16,6 @@ env:
DB_PASSWORD: cmfive_test
DB_DATABASE: cmfive_test
PLAYWRIGHT_MODULES: "admin channel form tag report task timelog"
BOILERPLATE_IMAGE: ghcr.io/2pisoftware/cmfive:develop

jobs:
# Lint
Expand Down Expand Up @@ -53,12 +52,26 @@ jobs:
with:
path: core

# Set Boilerplate variables by determing which image and branch to use
- name: Set Boilerplate Vars
id: boilerplate_vars
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ] || [ "${{ github.event.pull_request.base.ref }}" == "main" ]; then
# Base branch or current branch of core is main
echo "BOILERPLATE_IMAGE=ghcr.io/2pisoftware/cmfive:latest" >> $GITHUB_ENV
echo "BOILERPLATE_BRANCH=master" >> $GITHUB_ENV
else
# Base branch or current branch of core is another branch
echo "BOILERPLATE_IMAGE=ghcr.io/2pisoftware/cmfive:develop" >> $GITHUB_ENV
echo "BOILERPLATE_BRANCH=develop" >> $GITHUB_ENV
fi

# Checkout the boilerplate
- name: Checkout Boilerplate
uses: actions/checkout@v4
with:
repository: '2pisoftware/cmfive-boilerplate'
ref: 'develop'
ref: ${{ env.BOILERPLATE_BRANCH }}
path: boilerplate

# Pre-requisites Prepare Cmfive Environment
Expand Down Expand Up @@ -121,7 +134,7 @@ jobs:
-e DB_USERNAME=$DB_USERNAME \
-e DB_PASSWORD=$DB_PASSWORD \
-e DB_DATABASE=$DB_DATABASE \
-e CMFIVE_CORE_BRANCH=$CORE_BRANCH \
-e INSTALL_CORE_BRANCH=$CORE_BRANCH \
-e ENVIRONMENT=development \
--network=cmfive \
$BOILERPLATE_IMAGE
Expand Down
8 changes: 4 additions & 4 deletions system/modules/admin/actions/templates/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ function edit_GET(Web $w)
"id|name" => "description",
"value" => $t->description,
"label" => "Description",
]))->setOptions(["placeholder" => "Please provide a brief description of the template"]) //["", "textarea", "description", $t->description]
]))->setOptions(["placeholder" => "Please provide a brief description of the template"])
],
];

Expand All @@ -63,15 +63,15 @@ function edit_GET(Web $w)
"id|name" => "template_title",
"value" => $t->template_title,
"maxlength" => 100
])) //["", "textarea", "template_title", $t->template_title, 100, 1, false]
]))
]
];
$newForm["Template Body"] = [
[
(new \Html\Cmfive\CodeMirrorEditor([
"id|name" => "template_body",
"value" => $t->template_body,
])) //->addToConfig(['extensions' => ['basicSetup'], 'parent' => 'template_body']) //["", "textarea", "template_body", $t->template_body, 60, 100, "codemirror"]
"value" => htmlspecialchars($t->template_body),
]))
]
];

Expand Down
35 changes: 35 additions & 0 deletions system/modules/admin/tests/acceptance/playwright/admin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,41 @@ test("Test that Cmfive Admin handles templates", async ({ page }) => {
await expect(templateTestPage.getByText("Test Company")).toBeVisible();
});

test("Test that Cmfive Admin handles bad templates", async ({ page }) => {
test.setTimeout(GLOBAL_TIMEOUT);

await CmfiveHelper.login(page, "admin", "admin");

const template = CmfiveHelper.randomID("template_");
const templateID = await AdminHelper.createTemplate(page, template, "Admin", "Templates", [
"<link href=\"https://fonts.googleapis.com/css?family=Open+Sans\" rel=\"stylesheet\">",
"<style>",
"body {text-align: left;font-family: \"open sans' sans-serif;",
" color: #2b286a;",
"}",
"</style>",
"<table width='100%' align='center' class='form-table' cellpadding='1'>",
" <tr>",
" <td colspan='2' style='border:none;'>",
" <img width='400' src='' style='width: 400px;' />",
" </td>",
" <td colspan='2' style='border:none; text-align:right;'>",
" Test Company<br/>",
" 123 Test St, Test Town, NSW 1234<br/>",
" [email protected]<br/>",
" ACN: 123456789<br/>",
" ABN: 12345678901<br/>",
" </td>",
" </tr>",
"</table>",
]);

await AdminHelper.viewTemplate(page, template, templateID);
await page.getByRole("link", {name: "Template"}).click();

await expect(await page.locator('.cm-line')).toHaveCount(22);
});

test("Test that Cmfive Admin can create/run/rollback migrations", async ({ page }) => {
test.setTimeout(GLOBAL_TIMEOUT);
CmfiveHelper.acceptDialog(page);
Expand Down
10 changes: 10 additions & 0 deletions system/modules/admin/tests/acceptance/playwright/admin.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,16 @@ export class AdminHelper {
return page.url().split("/admin-templates/edit/")[1].split("#")[0];
}

static async viewTemplate(page: Page, templateTitle: string, templateID: string): Promise<void>
{
if (page.url() != HOST + "/admin-templates/edit/" + templateID + "#details") {
if(page.url() != HOST + "/admin-templates")
await CmfiveHelper.clickCmfiveNavbar(page, "Admin", "Templates");

await CmfiveHelper.getRowByText(page, templateTitle).getByRole("button", {name: "Edit"}).click();
}
}

static async demoTemplate(page: Page, templateTitle: string, templateID: string): Promise<Page>
{
if(page.url() != HOST + "/admin-templates/edit/" + templateID + "#details") {
Expand Down