From dea3ea1baaee0a739b679231ec86bf7ed0f155e8 Mon Sep 17 00:00:00 2001 From: Taylor Romero Date: Tue, 30 Jul 2024 15:12:12 -0600 Subject: [PATCH] minor: clicking --- src/pages/concepts/tests.md | 97 +++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) diff --git a/src/pages/concepts/tests.md b/src/pages/concepts/tests.md index 678d5aad..0892991e 100644 --- a/src/pages/concepts/tests.md +++ b/src/pages/concepts/tests.md @@ -2,6 +2,103 @@ Coming soon... +## Polish + +The `Polish` system is built to facilitate front-end automated testing. It is a simple, yet powerful, system that allows you to write "Polish Scripts" quickly and easily. + +### Creating your first Polish Script + +Assuming you are already in a `Skill` or module, you can create a new Polish Script by running the following command: + +```bash +spruce setup.polish +``` + +### Examples + +
+Logging In + +```ts +import { PolishStep } from '@sprucelabs/heartwood-polish' + +const script: PolishStep[] = [ + { + click: { + target: [['Field', 'phone']], + text: '555-000-0018', + }, + }, + { + typeText: { + target: [['Field', 'pin']], + value: '0000' + } + } +] + +export default script +``` +
+ +
+Clicking Buttons + +When you are clicking buttons, you can click by the following: + +1. `primary` +2. `descructive` +3. Index (zero based) + +```ts +import { PolishStep } from '@sprucelabs/heartwood-polish' + +const script: PolishStep[] = [ + { + click: { + target: [['button', 'primary']], + }, + }, + { + click: { + target: [['button', 'destructive']], + }, + }, + { + click: { + target: [['button', 0]], + }, + }, + { + click: { + target: [['button', 1]], + }, + }, +] + +export default script +``` +
+ +
+Clicking Buttons in Dialogs + +```ts +import { PolishStep } from '@sprucelabs/heartwood-polish' + +const script: PolishStep[] = [ + { + click: { + target: ['Dialog', ['Button','primary']] + } + } +] + +export default script +``` + +
+ ### Something Missing?