Agama and Puppeteer Need To Know » History » Version 1
rainerkoenig, 2024-08-23 12:00
First notes of what I found out
1 | 1 | rainerkoenig | # Agama and Puppeteer Need To Know |
---|---|---|---|
2 | |||
3 | ## Basic ideas and concepts |
||
4 | - Agama should be tested by using the [Puppeteer](https://pptr.dev/) library instead of the Playwright framework |
||
5 | - Puppeteer is **JavaScript** |
||
6 | - Nevertheless we would like to use [TypeScript](https://www.typescriptlang.org/) for our tests, because TypeScript has the advantage of data types that can be checked |
||
7 | |||
8 | ## Typescript to JavaScript conversion |
||
9 | I watched [this video](https://www.youtube.com/watch?v=O6JNTocH0y0) which explains how we can convert TypeScript sources to JavaScript: |
||
10 | |||
11 | - `npx tsc` converts files to JavaScript. |
||
12 | - `npx tsc --watch` triggers the watch mode, so every time you modify a `*.ts` file it will be translated to JavaScript automatically. |
||
13 | |||
14 | ## The first test runs |
||
15 | |||
16 | To try this out (as of August 23, 2024) I cloned [Joaquin's repo on GitHub](https://github.com/jknphy/agama-puppeteer) to my local machine running Leap 15.6. |
||
17 | |||
18 | The installation test was performed on a VM using the `agama-installer.x86_64-9.0.0-openSUSE-Build11.9.iso` image. What you need to do when booting this: |
||
19 | - Edit the bootloader settings and append `live.password=nots3cr3t` to the kernel parameter line |
||
20 | - 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 |
||
21 | |||
22 | Then switch to your local repo and use this commands: |
||
23 | ``` |
||
24 | export AGAMA_SERVER=http:/192.168.0.50 # or whatever your VM has as an IP |
||
25 | export AGAMA_HEADLESS=0 # so you see a browser window |
||
26 | |||
27 | ./agama-integration-tests build/test_install.js |
||
28 | ``` |
||
29 | The last line starts the test script which is already installed and put into the `build` directory. |
||
30 | |||
31 | ## My findings |
||
32 | - On **Leap 15.6** we get failures when using Firefox (which is the default browser defined in the code). So I need to switch by setting `export AGAMA_BROWSER=chromium` (or chrome). |
||
33 | - Running in Chroimium or Chrome on Leap 15.6 looks a bit better, but I stil got failures. Digging into this revealed that the problem were my language settings which caused some parts of the Agama UI to be translated. To solve this I had to set `export LANG=en_US.utf8`. |
||
34 | - With those settings I am able to almost pass the test: |
||
35 | |||
36 | ``` |
||
37 | Agama test |
||
38 | ✔ should have Agama page title |
||
39 | ✔ allows logging in |
||
40 | ✔ should optionally display the product selection dialog (30760ms) |
||
41 | ✔ should have an Overview section |
||
42 | ✔ should allow setting the root password |
||
43 | ✔ should be ready for installation |
||
44 | ✔ should create first user |
||
45 | 1) should start installation |
||
46 | |||
47 | |||
48 | 7 passing (34s) |
||
49 | 1 failing |
||
50 | |||
51 | 1) Agama test |
||
52 | should start installation: |
||
53 | |||
54 | AssertionError: expected 'Configuring the product, please wait …' to deeply equal 'Installing the system, please wait ...' |
||
55 | + expected - actual |
||
56 | |||
57 | -Configuring the product, please wait ... |
||
58 | +Installing the system, please wait ... |
||
59 | |||
60 | at Context.<anonymous> (tests/test_install.ts:237:45) |
||
61 | |||
62 | ``` |
||
63 | |||
64 | The interesting part is that the installation in this case is really triggered, you can see it in the UI of the Agama VM. So this seems to be just a minor issue. |
||
65 | |||
66 | So my next attempt was using my **Tumbleweed* VM which I first updated. Then cloning my repo to the VM and putting the settings for `AGAMA_SERVER` and `AGAMA_HEADLESS`. |
||
67 | |||
68 | In this configiruation I was able to perform a full installation using Firefox. It was not completely reproducible, some attempts also resulted in errors, but some runs really performed the install. |