trmnlp-test 0.1.3 → 0.1.4
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 +7 -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: 919b1bf33568827657d00e7b935d0253bfb0e7a9384d9be057cb665c97fa5f96
|
|
4
|
+
data.tar.gz: 92608945975bad2ed2748a732b24ad2bd2a1cc899c1ebb49fa1ca8329e07dad3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c60c6424e6d751d3634da01e3f88b26eeb5090f8c00af4d83014c19aa3f8c195589c070721c9ce9f3978b662f8f91fd10ec51aaee862a076337ac3d3f734bb80
|
|
7
|
+
data.tar.gz: c02bcabd8a0e2541168db2b4793cab321ab91f3b94b49433e3ebb3f87381578304ebba11125b08cc9fa2d4a7a9b920d59fc58d0d855462c4e46b0b00dd03c73f
|
data/README.md
CHANGED
|
@@ -53,7 +53,9 @@ 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
|
+
server: true, // TRMNL's quirks: { qr: 'server' | 'fixed', crlf: true }
|
|
57
59
|
fields: { data_source: 'webhook' }, // custom field values (defaults + .trmnlp.yml + these)
|
|
58
60
|
webhook: { merge_variables: {...} }, // or data: {...} to render given data as is
|
|
59
61
|
mocks: { 'https://api.example.com/*': { temp: 21 } },
|
|
@@ -64,6 +66,7 @@ test('menu', async ({ trmnl }) => {
|
|
|
64
66
|
await expect(screen.locator('[data-row]')).toHaveCount(7); // any Playwright locator assertion
|
|
65
67
|
await expect(screen).toHaveNoOverflow();
|
|
66
68
|
await expect(screen).toHaveNoOverlap('.title', 'img');
|
|
69
|
+
await expect(screen).toShowText('Espresso'); // visible: not cut off by an ellipsis, clamp or the edge ({ visible: false }: content only)
|
|
67
70
|
await expect(screen).toHaveQr('BCD\n002...');
|
|
68
71
|
await expect(screen).toMatchScreen(); // PNG snapshot (--update-snapshots)
|
|
69
72
|
await expect(screen).toFitDeviceImageLimit();
|
|
@@ -89,6 +92,8 @@ for (const s of matrix({ device: DEVICES.representative, view: VIEWS, darkMode:
|
|
|
89
92
|
}
|
|
90
93
|
```
|
|
91
94
|
|
|
95
|
+
**Where the server differs from trmnlp.** trmnlp-test renders with trmnlp's code, so it shares trmnlp's differences from TRMNL's server. The ones seen on trmnl.com are built in: `server: { qr: 'server' }` (the `qr_code` filter ignores "responsive" and returns the viewBox plus its natural width/height and `style="max-width:100%;height:auto"`) and `{ crlf: true }` (the web editor's preview made the template's newlines CR LF, so a newline typed in the template no longer matches `\n` in data). `{ qr: 'fixed' }` (a size and no viewBox) has not been seen and is there for robustness. `server: true` applies the seen ones. `matrix({ server: SERVER.variants })` renders each on its own. Dark mode follows what the server shows (inverted, images kept) rather than the v3 class, which leaves inline SVG and hard-coded colours as they are; `darkMode: 'framework'` renders the class only.
|
|
96
|
+
|
|
92
97
|
Other helpers: `trmnl.plugin('other/dir')`, `trmnl.lint()` with `toPassLint({ allow })`, `FRAMEWORK.majors()`, `FRAMEWORK.latestOf('2')`.
|
|
93
98
|
|
|
94
99
|
## How it works
|
|
@@ -97,5 +102,5 @@ See [docs/README.md](docs/README.md) for diagrams of the components, a render, s
|
|
|
97
102
|
|
|
98
103
|
## Examples and self-tests
|
|
99
104
|
|
|
100
|
-
- `examples/payment-qr`: the payment QR plugin
|
|
105
|
+
- `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
106
|
- `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