gemini generated image tgzk84tgzk84tgzk

From Code to Clicks: Integrating Page Scripting with AL-Go CI/CD


đź’ˇ The Spark: Why I Wanted AL-Go to Test Itself

We’ve all watched AL-Go evolve into a developer’s best friend — automating builds, signing apps, deploying to sandboxes, and releasing to production.
But something was missing: confidence.

Sure, your pipeline compiles, publishes, and runs automated tests.
But can it open a Business Central page, create an invoice, and click “Post” just like a user would?

Until recently, that answer was “no.”
That’s when Microsoft quietly dropped a game-changer: the Page Scripting Tool and its sidekick, bc-replay.


⚙️ The Breakthrough: Business Central Gets a UI Brain

In the 2024 release wave, Microsoft introduced the ability to record Business Central user actions as YAML scripts.
Then in 2025, they made the magic happen — you can now replay those scripts inside your CI/CD pipelines.

Think about it:

“Your AL-Go pipeline doesn’t just build your extension.
It acts like a user and validates your business flow — automatically.”

This is made possible by @microsoft/bc-replay, a Node.js package that runs your recorded UI scripts via Playwright.

Official source:
👉 Run page scripts in pipelines for automated testing


đź§± My Mission: Teaching AL-Go to Test Itself

I wanted to push AL-Go beyond build validation — into true process validation.
The idea: wire bc-replay as a post-CI workflow that replays a page script inside GitHub Actions.

That’s how “Teaching AL-Go to Test Itself” was born.


🧰 Step 1 – Bootstrapping the Playground

I started with a fresh repository from the official AL-Go PTE Template.
After the usual setup, I had a working CI/CD pipeline ready to run.

Then came the tools:

npm install -g @microsoft/bc-replay
npx replay --help

And just like that, Business Central had a test automation bridge between its UI and my GitHub pipeline.

1

🧑‍💻 Step 2 – Recording the “Human” Test

I opened my Business Central sandbox, switched on Page Scripting, and recorded a scenario every consultant knows by heart:

Creating and posting a Sales Invoice.

6

When I hit “Stop Recording,” BC handed me a YAML file — a perfectly scripted playbook of my clicks and inputs.

That file became:

/tests/pageScripts/post-sales-invoice.yml

I committed it, smiled, and moved to the fun part.

Make sure you have the necessary permission sets.

5

🔄 Step 3 – Wiring the Replay into AL-Go

Here’s the magic workflow that made it all real:

name: Run page scripts (post AL-Go CI)

on:
  workflow_run:
    workflows: [" CI/CD"]
    types: [completed]
  workflow_dispatch:

jobs:
  replay-ui:
    runs-on: windows-latest
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    steps:
      - uses: actions/checkout@v4
      - uses: actions/setup-node@v4
        with:
          node-version: '20'
      - run: npm install @microsoft/bc-replay --save
      - run: npx playwright install
      - run: New-Item -ItemType Directory -Path ".\\tests\\pageScripts\\results" -Force
      - name: Replay Test
        env:
          BC_URL: ${{ secrets.BC_URL }}
          BC_USER: ${{ secrets.BC_USER }}
          BC_PASSWORD: ${{ secrets.BC_PASSWORD }}
        run: >
          npx @microsoft/bc-replay replay
          -Tests ".\\tests\\pageScripts\\post-sales-invoice.yml"
          -StartAddress "$env:BC_URL"
          -Authentication AAD
          -UserNameKey BC_USER
          -PasswordKey BC_PASSWORD
          -ResultDir ".\\tests\\pageScripts\\results"
      - uses: actions/upload-artifact@v4
        with:
          name: playwright-report
          path: tests/pageScripts/results/playwright-report

This workflow triggers automatically after AL-Go finishes the CI/CD build — it’s the “afterparty test.”


🧩 Step 4 – The Secrets Behind the Scenes

For security, I stored my connection details as GitHub Secrets:

  • BC_URL
  • BC_USER
  • BC_PASSWORD

Even on a public repo, GitHub Secrets remain encrypted and safe.
The workflow retrieves them at runtime — nothing leaks, nothing breaks.

8

✅ Step 5 – The Moment of Truth

When I pushed the workflow, I watched GitHub Actions come alive:

  • AL-Go built and published the app.
  • bc-replay launched Chrome.
  • The pipeline logged into BC and posted an invoice — just like me.
  • The results zipped into an artifact: playwright-report.

It felt like watching a colleague run user acceptance testing — except faster, repeatable, and 100% automated.

10
11

And once the job completed, the invoice is now posted in Business Central

12

đź§  What This Means for Business Central DevOps

This isn’t just another testing trick.
This is the first time Business Central pipelines can validate real user behavior — right after code is deployed.

AL-Go + bc-replay transforms your pipeline into a digital tester:

  • âś… Verifies UI flows
  • âś… Ensures updates don’t break key processes
  • âś… Makes partners’ QA efforts continuous

As Microsoft noted:

“In 2024 release wave 2, we added standalone page script replayer support for CI/CD pipelines.”
— Microsoft Learn, 2024 Wave 2 Release Notes


🌍 Where It’s Going

Microsoft already confirmed that deeper AL-Go integration is on the way — and you can feel it.
Imagine a future where your pull requests automatically spin up a sandbox, run UI scripts, and comment “All tests passed” before you even merge.

We’re closer than ever.


đź§ľ Conclusion: From Code to Confidence

So here’s the truth:
AL-Go was already powerful — but bc-replay made it human.

If you want your pipeline to think like a tester, act like a user, and never miss a step — this is your next evolution.

I’ve shared the full repo and documentation here:
👉 GitHub Repo

And if you try this setup, tag me — I’d love to see how you make your pipelines “click.”


đź”— References

Leave a Reply

Your email address will not be published. Required fields are marked *