Agama and Puppeteer Need To Know » History » Version 2
rainerkoenig, 2024-09-05 10:05
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 | 2 | rainerkoenig | ## Typescript to JavaScript conversion (outdated) |
9 | This is left here for tracking history, as of September 2024 and later move on to the next seection. |
||
10 | |||
11 | 1 | rainerkoenig | I watched [this video](https://www.youtube.com/watch?v=O6JNTocH0y0) which explains how we can convert TypeScript sources to JavaScript: |
12 | |||
13 | - `npx tsc` converts files to JavaScript. |
||
14 | - `npx tsc --watch` triggers the watch mode, so every time you modify a `*.ts` file it will be translated to JavaScript automatically. |
||
15 | |||
16 | 2 | rainerkoenig | |
17 | |||
18 | 1 | rainerkoenig | ## The first test runs |
19 | |||
20 | 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. |
||
21 | |||
22 | 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: |
||
23 | - Edit the bootloader settings and append `live.password=nots3cr3t` to the kernel parameter line |
||
24 | - 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 |
||
25 | |||
26 | Then switch to your local repo and use this commands: |
||
27 | ``` |
||
28 | export AGAMA_SERVER=http:/192.168.0.50 # or whatever your VM has as an IP |
||
29 | export AGAMA_HEADLESS=0 # so you see a browser window |
||
30 | |||
31 | ./agama-integration-tests build/test_install.js |
||
32 | ``` |
||
33 | The last line starts the test script which is already installed and put into the `build` directory. |
||
34 | |||
35 | ## My findings |
||
36 | - 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). |
||
37 | - 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`. |
||
38 | - With those settings I am able to almost pass the test: |
||
39 | |||
40 | ``` |
||
41 | Agama test |
||
42 | ✔ should have Agama page title |
||
43 | ✔ allows logging in |
||
44 | ✔ should optionally display the product selection dialog (30760ms) |
||
45 | ✔ should have an Overview section |
||
46 | ✔ should allow setting the root password |
||
47 | ✔ should be ready for installation |
||
48 | ✔ should create first user |
||
49 | 1) should start installation |
||
50 | |||
51 | |||
52 | 7 passing (34s) |
||
53 | 1 failing |
||
54 | |||
55 | 1) Agama test |
||
56 | should start installation: |
||
57 | |||
58 | AssertionError: expected 'Configuring the product, please wait …' to deeply equal 'Installing the system, please wait ...' |
||
59 | + expected - actual |
||
60 | |||
61 | -Configuring the product, please wait ... |
||
62 | +Installing the system, please wait ... |
||
63 | |||
64 | at Context.<anonymous> (tests/test_install.ts:237:45) |
||
65 | |||
66 | ``` |
||
67 | |||
68 | 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. |
||
69 | |||
70 | 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`. |
||
71 | |||
72 | 2 | rainerkoenig | 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. |