plushie/testing/script
Parser for .plushie test scripts.
The .plushie format is a superset of iced’s .ice test script format,
adding plushie-specific instructions like expect and assert_model.
Format
app: my_app
viewport: 800x600
theme: dark
backend: mock
-----
click "#increment"
expect "Count: 1"
tree_hash "counter-at-1"
Types
Backend selector.
pub type Backend {
MockBackend
HeadlessBackend
WindowedBackend
}
Constructors
-
MockBackend -
HeadlessBackend -
WindowedBackend
A single instruction in a script.
pub type Instruction {
Click(selector: String)
TypeText(selector: String, text: String)
TypeKey(key: String)
Press(key: String)
Release(key: String)
Move(target: String)
MoveTo(x: Int, y: Int)
Toggle(selector: String)
Select(selector: String, value: String)
Slide(selector: String, value: Float)
Expect(text: String)
AssertTreeHash(name: String)
AssertScreenshot(name: String)
AssertText(selector: String, expected: String)
AssertModel(expression: String)
Wait(ms: Int)
}
Constructors
-
Click(selector: String) -
TypeText(selector: String, text: String) -
TypeKey(key: String) -
Press(key: String) -
Release(key: String) -
Move(target: String) -
MoveTo(x: Int, y: Int) -
Toggle(selector: String) -
Select(selector: String, value: String) -
Slide(selector: String, value: Float) -
Expect(text: String) -
AssertTreeHash(name: String) -
AssertScreenshot(name: String) -
AssertText(selector: String, expected: String) -
AssertModel(expression: String) -
Wait(ms: Int)
A parsed script with header and instructions.
pub type Script {
Script(header: Header, instructions: List(Instruction))
}
Constructors
-
Script(header: Header, instructions: List(Instruction))
Values
pub fn parse(content: String) -> Result(Script, String)
Parse a .plushie script from a string.
pub fn parse_file(path: String) -> Result(Script, String)
Parse a .plushie script from a file path.