Project

General

Profile

Actions

Agama and Puppeteer Need To Know

Basic ideas and concepts

  • Agama should be tested by using the Puppeteer library instead of the Playwright framework
  • Puppeteer is JavaScript
  • Nevertheless we would like to use TypeScript for our tests, because TypeScript has the advantage of data types that can be checked

Typescript to JavaScript conversion (outdated)

This is left here for tracking history, as of September 2024 and later move on to the next seection.

I watched this video which explains how we can convert TypeScript sources to JavaScript:

  • npx tsc converts files to JavaScript.
  • npx tsc --watch triggers the watch mode, so every time you modify a *.ts file it will be translated to JavaScript automatically.

New GitHub repo using webpack

Agama development switched to a new repository where we make use of webpack.

Webpack bundles all the JavaScript modules so that at the end we just have one default-installation.cjs file to use and deploy if the test environement is on another machine.

Caution: The files with .cjs extension should not be held in the Git repository. I had troubles because my Pull Request had of course an updated .cjs file, but git mergetool was not able to open in a reasonable time. Besides that, what shall i merge here, this is like an object module that drops out of a build process, you won't put that into a git repo, would you?

To not get crazy about filenmae extension we needed to do slight configuration changes at the tsconfig.json file, thanks to Leo Manfredi for figuring this out. With this you have the big advantage, that you just need to write the imports in your TypeScript files without file extension. Example:

 // classes for Page Object Model
import { LoginAsRootPage } from "../pages/login-as-root-page";
import { ProductSelectionPage } from "../pages/product-selection-page";

Testing on a virtual machine in the local environment

My tests were performed on agama-installer.x86_64-9.0.0-openSUSE-Build11.9.iso.

What you need to do when booting

  • Edit the bootloader settings and append live.password=nots3cr3t to the kernel parameter line. If you want to avoid doing this on every boot, there is a way to patch the ISO image with a custom password.
  • After the machine is up switch to a virtual console and check the IP settings, in my case the IP of the VM was 192.168.0.50

Then switch to your local repo and use this commands:

export AGAMA_SERVER=http:/192.168.0.50  # or whatever your VM has as an IP
export AGAMA_HEADLESS=0 # so you see a browser window

$ node --test-timeout=60000 dist/default_installation.cjs

The last line starts the test script which is already installed and put into the build directory.

My findings

Despite my first impression that Firefox does not work on Leap 15.6 for testing I have to say, that with the new approach Firefox seems to be the only Browser that works. I tried both ´ChromeandChromium` and had problems, that in my local browser the test steps did not advance. With Firefox I was able to repeatedly perform a successful installation.

 node --test-timeout=60000 dist/default_installation.cjs 
▶ Agama test
  ✔ should have Agama page title (55.365252ms)
  ✔ allows logging in (13.519967ms)
  ✔ should optionally display the product selection dialog (26794.771274ms)
  ✔ should display overview section (61.994939ms)
  ✔ should display user dialog (215.073205ms)
  ✔ should enter root password dialog (286.97696ms)
  ✔ should set root password (627.430631ms)
  ✔ should switch to overview (349.829644ms)
  ✔ should be ready for installation (253.257252ms)
  ✔ can launch installation (203.614128ms)
  ✔ can confirm installation (226.882324ms)
  ✔ should start installation (532.787203ms)
  ✔ should finish installation (833424.512108ms)
▶ Agama test (868837.009718ms)
ℹ tests 13
ℹ suites 1
ℹ pass 13
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 868847.424757

Updated by rainerkoenig 3 months ago · 4 revisions