trmnlp-test 0.1.11 → 0.1.13

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1a8cf6e0c24f5af6b9efe85a649ba2db67c317879b1fceadcb65d1ffc067eebe
4
- data.tar.gz: 2b6815bf81815329f8acc596fb42ef20f58166ed34e0b834929a3e9bb6b904e8
3
+ metadata.gz: a85d35469820b185b895fa3d414e16615b96da98daac3ceb03e2a2efb1acb485
4
+ data.tar.gz: 125994095861e0b2fa05b4bdb894d96b881394d607669d368b97cc017ed4c42e
5
5
  SHA512:
6
- metadata.gz: 89a21ae5fec6701fe57b7601467ab61de49e27eae862b4081853e8989150024767813610c1b685243b8308e12e3a7407b74d7757c69c668ead777a732195bc79
7
- data.tar.gz: 918d5191358825fa4f6a00022c232030e5e97b5d8d8bc43fbd55ed22c0f1442e3a381156d45763a556e37ef17e38b3c3b22ee6fd43a8430f0a4dfe7983728d8c
6
+ metadata.gz: 5953aee8123875b73f26f388070c128dfd82e11e7242d8d2409aeb53e4fbde364418cccc562027333e901779311355262ee19db3ec595029f9202a529b643e37
7
+ data.tar.gz: 1fea3465492de2efd996a3bc8ee94d8ffa165003708f2e6fd3232cb9250ade51f5e776feb323568e5aac26c7b2ecc6505dc7867e99fdbede925379d53e9f80b7
data/README.md CHANGED
@@ -23,6 +23,8 @@ trmnlp-test init # trmnlp-test.config.js + test/trmnl/plugin.spec.
23
23
  trmnlp-test # run; Playwright args pass through (-g, --update-snapshots)
24
24
  trmnlp-test models | versions # device models / framework versions
25
25
  trmnlp-test update # pull the image now (otherwise at most once a day)
26
+ trmnlp-test views.spec # only some tests (a file or a filter); Playwright args pass through
27
+ trmnlp-test run -- --rebaseline # args after -- reach the specs: require('trmnlp-test').args
26
28
  trmnlp-test help | --version # all commands and options / versions of trmnlp-test, trmnlp, Playwright
27
29
  ```
28
30
 
@@ -88,6 +90,7 @@ test('menu', async ({ trmnl }) => {
88
90
  await expect(screen).toHaveQr('BCD\n002...'); // black on white; { inverted: true | 'any' } for dark codes
89
91
  await expect(screen).toMatchScreen(); // PNG snapshot (--update-snapshots)
90
92
  await expect(screen).toFitDeviceImageLimit();
93
+ await expect(screen).toMatchReference('refs/photo.png', { selector: '.dial', refRect, minIoU: 0.93 }); // diff attached
91
94
  const png = await screen.png(); // pixel(x,y), colors(), inkRatio(rect), inkBounds(), crop()
92
95
  });
93
96
 
@@ -114,7 +117,7 @@ Other helpers: `trmnl.plugin('other/dir')`, `trmnl.lint()` with `toPassLint({ al
114
117
 
115
118
  ## How it works
116
119
 
117
- See [docs/README.md](docs/README.md) for diagrams of the components, a render, sessions and the file structure.
120
+ See [docs/README.md](docs/README.md) for diagrams and [docs/SPEC.md](docs/SPEC.md) for the full specification.
118
121
 
119
122
  ## Examples and self-tests
120
123
 
data/exe/trmnlp-test CHANGED
@@ -2,7 +2,8 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  # Runs trmnlp-test (a Docker image) against a TRMNL plugin repository.
5
- # trmnlp-test [--repo DIR] [--mount DIR]... [run|init|models|versions|refresh|update|shell|version] [playwright args]
5
+ # trmnlp-test [run|init|models|versions|refresh|update|shell|version|help] [args] [-- spec args]
6
+ # --repo DIR, --mount DIR and --env NAME[=VALUE] are taken from anywhere before `--`.
6
7
  require 'etc'
7
8
  require 'fileutils'
8
9
  require_relative '../lib/trmnlp_test/version'
@@ -11,12 +12,25 @@ require_relative '../lib/trmnlp_test/version'
11
12
  image = ENV.fetch('TRMNLP_TEST_IMAGE', "#{TrmnlpTest::IMAGE}:latest")
12
13
  repo = Dir.pwd
13
14
  mounts = []
14
- args = ARGV.dup
15
- while %w[--repo --mount].include?(args.first)
16
- flag, dir = args.shift(2)
17
- abort "trmnlp-test: #{flag} needs a directory" unless dir
18
- path = File.realpath(dir)
19
- flag == '--repo' ? repo = path : mounts += ['-v', "#{path}:#{path}"]
15
+ # the container sees TRMNLP_TEST_* and CI; --env NAME[=VALUE] passes more
16
+ env = %w[CI FORCE_COLOR].flat_map { |k| ['-e', k] } + ENV.keys.grep(/\ATRMNLP_TEST_/).flat_map { |k| ['-e', k] }
17
+ args = []
18
+ rest = ARGV.dup
19
+ until rest.empty?
20
+ arg = rest.shift
21
+ if arg == '--'
22
+ args.push(arg, *rest)
23
+ break
24
+ elsif %w[--repo --mount --env].include?(arg)
25
+ value = rest.shift or abort("trmnlp-test: #{arg} needs a value")
26
+ case arg
27
+ when '--repo' then repo = File.realpath(value)
28
+ when '--mount' then (path = File.realpath(value)) && mounts.push('-v', "#{path}:#{path}")
29
+ else env.push('-e', value)
30
+ end
31
+ else
32
+ args << arg
33
+ end
20
34
  end
21
35
 
22
36
  USAGE = File.read(File.expand_path('../lib/trmnlp_test/usage.txt', __dir__))
@@ -59,6 +73,5 @@ if args.first == 'shell'
59
73
  entry = ['--entrypoint', 'bash']
60
74
  end
61
75
  tty = $stdout.tty? ? ['-t'] : []
62
- env = %w[CI TRMNLP_TEST_DEBUG TRMNLP_TEST_WORKERS TRMNLP_TEST_SHOW_DIFFERENCES FORCE_COLOR].flat_map { |k| ['-e', k] }
63
76
  exec 'docker', 'run', '--rm', '-i', *tty, '--init', '--ipc=host', '-u', "#{Process.uid}:#{Process.gid}",
64
77
  '-v', "#{repo}:#{repo}", '-w', repo, '-v', "#{cache}:/cache", *mounts, *env, *entry, image, *args
@@ -1,9 +1,10 @@
1
- Usage: trmnlp-test [options] [command] [args]
1
+ Usage: trmnlp-test [command] [args] [options] [-- spec args]
2
2
 
3
3
  Tests TRMNL plugins in the trmnlp format, in Docker.
4
4
 
5
5
  Commands:
6
- run [playwright args] run the tests (default), e.g. -g "dark", --update-snapshots, -j 4
6
+ run [playwright args] run the tests (default), e.g. -g "dark", --update-snapshots, -j 4;
7
+ a spec file or filter in first place runs those: trmnlp-test views.spec
7
8
  init create trmnlp-test.config.js and test/trmnl/plugin.spec.js
8
9
  models list the TRMNL device models and their palettes
9
10
  versions list the TRMNL framework versions
@@ -18,6 +19,9 @@ Options:
18
19
  --mount DIR also mount DIR into the container (repeatable)
19
20
  --root DIR the directory with trmnlp-test.config.js, inside the repository
20
21
  --report DIR where the report goes (default: config "report")
22
+ --env NAME[=VALUE] pass an environment variable to the specs (repeatable);
23
+ TRMNLP_TEST_* variables always pass
24
+ -- ARGS everything after -- reaches the specs as require('trmnlp-test').args
21
25
  -h, --help show this help
22
26
  -v, --version show versions
23
27
 
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TrmnlpTest
4
- VERSION = '0.1.11'
4
+ VERSION = '0.1.13'
5
5
  IMAGE = 'ghcr.io/excusemi/trmnlp-test'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trmnlp-test
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - ExcuseMi