trmnlp-test 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -2
- data/exe/trmnlp-test +2 -1
- data/lib/trmnlp_test/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b926087a3c37b52ba542f1a113ea8e6d697e365bca15cc6d93c726328d21add1
|
|
4
|
+
data.tar.gz: bc94fc2b7629eb445dc56ea6b7a45120805b51adc107a1606478447092aa5e16
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9b1010584fa48dbaa652a28d2d5ec434a4c7071d3b62832b739dbad9584b09c680275859943d0ee64e7ed0943e97b3efb001c46e21c5da3307f2095ea497adcf
|
|
7
|
+
data.tar.gz: a144a37ba123e5bb7fb2aad230c8aebf17ba01bc5f2a79d454f670050fb359544f7339da7dce01fc8713df50ee637866feac39362c28cd24a81baf2338c8957c
|
data/README.md
CHANGED
|
@@ -53,7 +53,10 @@ const { test, expect, matrix, VIEWS, DEVICES, FRAMEWORK } = require('trmnlp-test
|
|
|
53
53
|
|
|
54
54
|
test('menu', async ({ trmnl }) => {
|
|
55
55
|
const screen = await trmnl.render({
|
|
56
|
-
device: 'og_plus', view: 'full', // any model, orientation: 'portrait', palette,
|
|
56
|
+
device: 'og_plus', view: 'full', // any model, orientation: 'portrait', palette, theme, scale, textScale, fonts, framework
|
|
57
|
+
darkMode: true, // as the server does it: everything inverted except images ('framework': the v3 class only)
|
|
58
|
+
qr: 'server', // qr_code as TRMNL's server returns it (default); 'trmnlp', 'fixed'
|
|
59
|
+
crlf: true, // the template with CR LF newlines, as TRMNL's web editor preview had it
|
|
57
60
|
fields: { data_source: 'webhook' }, // custom field values (defaults + .trmnlp.yml + these)
|
|
58
61
|
webhook: { merge_variables: {...} }, // or data: {...} to render given data as is
|
|
59
62
|
mocks: { 'https://api.example.com/*': { temp: 21 } },
|
|
@@ -64,6 +67,7 @@ test('menu', async ({ trmnl }) => {
|
|
|
64
67
|
await expect(screen.locator('[data-row]')).toHaveCount(7); // any Playwright locator assertion
|
|
65
68
|
await expect(screen).toHaveNoOverflow();
|
|
66
69
|
await expect(screen).toHaveNoOverlap('.title', 'img');
|
|
70
|
+
await expect(screen).toShowText('Espresso'); // visible: not cut off by an ellipsis, clamp or the edge ({ visible: false }: content only)
|
|
67
71
|
await expect(screen).toHaveQr('BCD\n002...');
|
|
68
72
|
await expect(screen).toMatchScreen(); // PNG snapshot (--update-snapshots)
|
|
69
73
|
await expect(screen).toFitDeviceImageLimit();
|
|
@@ -89,6 +93,12 @@ for (const s of matrix({ device: DEVICES.representative, view: VIEWS, darkMode:
|
|
|
89
93
|
}
|
|
90
94
|
```
|
|
91
95
|
|
|
96
|
+
**Where TRMNL differs from trmnlp.** trmnlp-test renders with trmnlp's code, except where TRMNL is known to differ (observed on trmnl.com, 2026-10-02):
|
|
97
|
+
|
|
98
|
+
- `qr_code`: the server ignores the view argument and returns the viewBox plus the code's natural width/height and `style="max-width:100%;height:auto"`, so a code only shrinks, never grows (a 25-module code stays 275 px in a bigger box), and a second width added by the template makes the SVG invalid XML inside an `<img>`. This is the default; `qr: 'trmnlp'` renders trmnlp's scalable SVG, `qr: 'fixed'` one without a viewBox (not observed, for robustness). `matrix({ qr: QR_MODES })` covers all three.
|
|
99
|
+
- Dark mode: `darkMode: true` inverts the whole screen except images, as TRMNL describes it and the server preview showed for an inline SVG on framework 3.4. Not yet confirmed on a device for v3. `darkMode: 'framework'` renders the v3 class only, which leaves inline SVG and hard-coded colours as they are.
|
|
100
|
+
- `crlf: true` (not the server: TRMNL's web editor preview) turns the template's newlines into CR LF, so a newline typed in the template no longer matches `\n` in data.
|
|
101
|
+
|
|
92
102
|
Other helpers: `trmnl.plugin('other/dir')`, `trmnl.lint()` with `toPassLint({ allow })`, `FRAMEWORK.majors()`, `FRAMEWORK.latestOf('2')`.
|
|
93
103
|
|
|
94
104
|
## How it works
|
|
@@ -97,5 +107,5 @@ See [docs/README.md](docs/README.md) for diagrams of the components, a render, s
|
|
|
97
107
|
|
|
98
108
|
## Examples and self-tests
|
|
99
109
|
|
|
100
|
-
- `examples/payment-qr`: the payment QR plugin
|
|
110
|
+
- `examples/payment-qr`: the earlier webhook + serverless version of the payment QR plugin (the current version tests itself with trmnlp-test in its own repository).
|
|
101
111
|
- `test/self`: fixture plugins for every strategy and language (86 tests). Run with `bin/trmnlp-test run --root test/self`.
|
data/exe/trmnlp-test
CHANGED
|
@@ -44,7 +44,8 @@ FileUtils.mkdir_p(cache)
|
|
|
44
44
|
|
|
45
45
|
# a missing image is pulled; a :latest image is refreshed at most once a day
|
|
46
46
|
present = system('docker', 'image', 'inspect', image, out: File::NULL, err: File::NULL)
|
|
47
|
-
stamp
|
|
47
|
+
# the stamp names the launcher version too: a new launcher pulls at once, it may need a newer image
|
|
48
|
+
stamp = File.join(cache, ".pulled-#{TrmnlpTest::VERSION}-" + image.gsub(/[^A-Za-z0-9.]+/, '_'))
|
|
48
49
|
stale = image.end_with?(':latest') && (!File.exist?(stamp) || Time.now - File.mtime(stamp) > 86_400)
|
|
49
50
|
if !present || (stale && !ENV['TRMNLP_TEST_NO_PULL'])
|
|
50
51
|
warn "trmnlp-test: pulling #{image}" unless present
|
data/lib/trmnlp_test/version.rb
CHANGED