Runs --check=browser: the checks of the page in Playwright, and the keys of the presenter
--check=browser runs each check of --check=a11y, and then it uses the
presenter as the presenter does, with real key presses. It needs Node, the
npm packages playwright and axe-core, the Chromium of Playwright, and
the Hex package playwright_ex. find/2 finds them.
run/4 writes a copy of the document with axe-core to a temporary
directory, and opens it in a page of 1920 × 1080:
- With
?check=a11y, the page runs the layout check and axe-core.assets/src/check.tsgives the rules. - With no query, the session presses the key of the next step from the first step to the last step. After each key, the slide and the step that show must be the next entry of the list of the steps.
- The session opens the menu, the list of keys, the overview and the
handout view with their keys. Each view must open. The menu and the list
of keys must take the focus, and
Escapemust close them and give the focus back. - Each error of the script of the page, and each
console.error, during the steps 2 and 3 is a problem too.
The keys come from the program of Expresso.Presenter.Default, so the
check presses the keys that the list of keys of the deck shows.
Summary
Functions
Find the tools of --check=browser
Return the key of a mode of a program that runs a command
Run the checks of the page and the keys of the presenter on a document
Types
Functions
@spec find([Path.t()], %{required(String.t()) => String.t()}) :: {:ok, tools()} | {:error, String.t()}
Find the tools of --check=browser
The function looks for each tool in this sequence, and it returns the error of the first tool that it does not find:
- The Hex package
playwright_ex. - Node, as
nodeon thePATH. - The npm package
playwright. The variableEXPRESSO_PLAYWRIGHTinenvgives the path of itscli.js. Without it, the function looks fornode_modules/playwright/cli.jsin each directory ofdirectories, in each parent of them, and in the directory ofExpresso.Check.Tools. - axe-core, as
Expresso.Check.Browser.find_axe/2finds it.
@spec key(Expresso.Presenter.Program.t(), atom(), tuple()) :: String.t()
Return the key of a mode of a program that runs a command
A binding with more than one key gives the key that the list of keys shows first in this sense: a letter before another key, and a short name before a long name.
iex> deck = Expresso.Builder.deck([Expresso.Builder.slide("one", elements: [])], name: "k")
iex> program = Expresso.Presenter.Program.compile(Expresso.Presenter.Definition.presenter(), deck)
iex> Expresso.Check.Session.key(program, :present, {:step, 1})
"j"
iex> Expresso.Check.Session.key(program, :present, {:set, :menu, true})
"m"
@spec run(String.t(), Expresso.Deck.t(), tools(), keyword()) :: {:ok, [{{Expresso.Check.size(), :light | :dark | nil}, map()}]} | {:error, String.t()}
Run the checks of the page and the keys of the presenter on a document
deck gives the list of the steps and the program of the keys. The option
:schemes gives the variants of the theme, such as [:light, :dark], and
[nil] by default for the variant of the document. The option :sizes
gives the sizes of the page, such as [{1280, 720}], and
[{1920, 1080}] by default. The page runs its checks one time for each
size and each variant, and the keys run one time, at the first size and in
the first variant.
The function returns a list with a tuple {{size, scheme}, result} for
each size and each variant. A result holds the result of the page, as
Expresso.Check.Browser.decode/1 returns it. The first result also holds
the problems of the keys and of the script in :session. The option :env
gives the environment, and EXPRESSO_CHROMIUM in it gives a different
browser than the Chromium of Playwright.