From 6c225ddf8a68ff158f8bd72ad7bc5c4e188df436 Mon Sep 17 00:00:00 2001 From: Tynan Matthews <30655787+tynanmatthews@users.noreply.github.com> Date: Mon, 12 Feb 2024 00:04:47 +0000 Subject: [PATCH 1/4] added installDatabaseSeeds utility function --- test/playwright/cmfive.utils.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/playwright/cmfive.utils.ts b/test/playwright/cmfive.utils.ts index e64a3bf..ad03a19 100644 --- a/test/playwright/cmfive.utils.ts +++ b/test/playwright/cmfive.utils.ts @@ -67,4 +67,24 @@ export class CmfiveHelper { await page.keyboard.type(search); await page.locator('.ui-menu-item :text("' + value + '")').click(); } + + static async installDatabaseSeeds(page: Page, module: string){ + //installs databse seeds if not installed + await CmfiveHelper.clickCmfiveNavbar(page, "Admin", "Migrations"); + await page.getByRole('link', {name: 'Database Seeds'}).click(); + const moduleTab = await page.locator(`#${module}-tab-seed`); + + //collect number of buttons + await moduleTab.click() + const installButtons = await page.getByRole('button', {name: 'Install'}); + const installButtonsCount = await installButtons.count(); + + //loop for number of buttons aka how many seeds to install + for (let i = 0; i < installButtonsCount; i++) { + await moduleTab.click() + //each time you click the button it takes one locator result off the page + await installButtons.first().click(); //this always resolves the first button + await page.waitForSelector('div.alert-success', {state: 'visible'}); + } + } } From f133d663e669406b449dc22dfb2a4390f3082a1a Mon Sep 17 00:00:00 2001 From: Tynan Matthews <30655787+tynanmatthews@users.noreply.github.com> Date: Sun, 3 Mar 2024 01:38:47 +0000 Subject: [PATCH 2/4] Improve crm nav bar utility function --- test/playwright/cmfive.utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/playwright/cmfive.utils.ts b/test/playwright/cmfive.utils.ts index 72b6f56..affb659 100644 --- a/test/playwright/cmfive.utils.ts +++ b/test/playwright/cmfive.utils.ts @@ -43,7 +43,7 @@ export class CmfiveHelper { await navbarCategory.hover(); } - await navbarCategory.getByRole('link', {name: option}).click(); + await navbarCategory.getByRole('link', {name: option, exact: true}).click(); } // Call exactly once per test before any dialogs pop up From 68879b52b839da8c12b876ac7f6d692fac3319d4 Mon Sep 17 00:00:00 2001 From: Tynan Matthews <30655787+tynanmatthews@users.noreply.github.com> Date: Mon, 11 Mar 2024 01:54:24 +0000 Subject: [PATCH 3/4] Moved database seed install function to admin utils --- test/playwright/cmfive.utils.ts | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/test/playwright/cmfive.utils.ts b/test/playwright/cmfive.utils.ts index affb659..42ae59d 100644 --- a/test/playwright/cmfive.utils.ts +++ b/test/playwright/cmfive.utils.ts @@ -69,24 +69,4 @@ export class CmfiveHelper { await page.locator('.ui-menu-item :text("' + value + '")').click(); } - static async installDatabaseSeeds(page: Page, module: string){ - //installs databse seeds if not installed - await CmfiveHelper.clickCmfiveNavbar(page, "Admin", "Migrations"); - await page.getByRole('link', {name: 'Database Seeds'}).click(); - const moduleTab = await page.locator(`#${module}-tab-seed`); - - //collect number of buttons - await moduleTab.click() - const installButtons = await page.getByRole('button', {name: 'Install'}); - const installButtonsCount = await installButtons.count(); - - //loop for number of buttons aka how many seeds to install - for (let i = 0; i < installButtonsCount; i++) { - await moduleTab.click() - //each time you click the button it takes one locator result off the page - await installButtons.first().click(); //this always resolves the first button - await page.waitForSelector('div.alert-success', {state: 'visible'}); - } - } - } From 78fe015a7a5bdcc79f6fa9ee82b5fb49a51aaefb Mon Sep 17 00:00:00 2001 From: Matt Bell Date: Wed, 13 Mar 2024 01:23:33 +0000 Subject: [PATCH 4/4] Improve branch env feature --- .codepipeline/docker/setup.sh | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.codepipeline/docker/setup.sh b/.codepipeline/docker/setup.sh index 5582dbe..c25423d 100755 --- a/.codepipeline/docker/setup.sh +++ b/.codepipeline/docker/setup.sh @@ -38,18 +38,50 @@ chmod ugo=rwX -R cache/ storage/ uploads/ echo "Running cmfive.php actions" echo +# Ensure system files are installed to /system +function checkSymlink() { + pushd /var/www/html + from_dir="composer/vendor/2pisoftware/cmfive-core/system" + link_name="system" + if [ -L "$link_name" ]; then + echo "✅ System dir is a symlink" + else + # Remove if it's a file or dir + if [ -f "$link_name" ] || [ -d "$link_name" ]; then + echo "❌ Removing existing system dir" + rm -rf "$link_name" + fi + echo "➕ Creating system dir" + ln -s "$from_dir" "$link_name" + if [ $? -eq 0 ]; then + echo "✅ Symlink created from $from_dir to $link_name" + else + echo "❌ Failed to create symlink from $from_dir to $link_name" + fi + fi + popd +} + # If system dir exists but composer doesnt print a warning if [ -f "/var/www/html/system/web.php" ] && [ ! -f "/var/www/html/composer.json" ]; then echo "⚠️ Warning: System dir exists but composer packages are missing" fi +# If CMFIVE_CORE_BRANCH is set print to logs +if [ -n "$CMFIVE_CORE_BRANCH" ]; then + echo "Using CMFIVE_CORE_BRANCH [ $CMFIVE_CORE_BRANCH ]" +fi + # System dir and composer packages must exist if [ ! -f "/var/www/html/system/web.php" ] || [ ! -f "/var/www/html/composer.json" ] || [ -n "$CMFIVE_CORE_BRANCH" ]; then CMFIVE_CORE_BRANCH=${CMFIVE_CORE_BRANCH:-master} # Default to master if not set + rm -rf /var/www/html/system # Remove system dir to ensure correct core is installed echo "➕ Installing core from branch [ $CMFIVE_CORE_BRANCH ]" php cmfive.php install core $CMFIVE_CORE_BRANCH - echo "✔️ Core installed" + checkSymlink + echo "✔️ New core installed" else + echo "Using bundled core" echo "✔️ Core already installed" fi