Recording tests
Recording turns what you do on a page into a test. You use the website as you normally would, and each click and each thing you type becomes a step. Recording works in every project Raider Desktop creates, and in quick recordings.
The Tests tab
Open a project and go to the Tests tab. It lists every test in the project. Use the Tag list to see the tests with one tag, or All tests. The More menu runs the tagged tests, imports a test or a project, and exports the project.
To tag a test, open it and type in the Tags field above the steps, for example smoke. Tags decide what Smoke, Regression and Run tagged tests run.
Record a new test
- Click New test, or press ⌘N (Ctrl+N).
- Enter a Test name and a Start URL, the page the recording starts on. Start recording stays off until the test has a name and an address.
- Click Start recording. The page opens on the right of the window.
- Use the page. Each action appears in the step list as you go.
- Press Stop & save, or ⌘⇧R (Ctrl+Shift+R), when you are done.
To record again into a test that already has steps, open it and press Record, or ⌘⇧R (Ctrl+Shift+R). The same key starts and stops recording.
What becomes a step
- Opening a page.
- Clicking something, including an empty area of the page.
- Typing into a field, and pressing keys such as Enter.
- Moving into and out of a frame inside the page.
- Every validation you add (see Validations).
Each step says, in plain words, what it does and how it found the element it acts on. A ⚠ next to a step means it found the element by its position in the page, which can break when the page changes. Re-record that step to pick a steadier one.
Typing into a password field records a password step. It does not store the password: it reads it from a variable on your computer whose name starts with RAIDER_SECRET_, for example RAIDER_SECRET_ADMIN. Click Change variable on the step to set the name.
Stop & save and autosave
Stop & save ends the recording and keeps the steps as a test in your project. After that, the test saves itself: any change you make to it is saved straight away, and the line "Changes to this test are saved automatically." under the steps says so. You never need to press Save for a recorded test. See Saving your work.
Change the steps
- Move a step: drag it by its handle. Steps run from top to bottom.
- Delete a step: click its delete button. Click Undo in the message that follows if you change your mind.
- Edit a step: double-click it to edit its code.
Visual steps and Ruby code
The Show as switch above the list changes the view. Visual steps shows the test as cards, one per step. Ruby code shows the code Raider generated from it.
A recorded login looks like this in Ruby code:
driver.navigate.to('https://raider-test-site.onrender.com/')
driver.find_element(by_role('textbox', name: 'Login name', exact: true)).clear
driver.find_element(by_role('textbox', name: 'Login name', exact: true)).send_keys('aguspe')
driver.find_element(by_role('textbox', name: 'Password', exact: true)).clear
driver.find_element(by_role('textbox', name: 'Password', exact: true)).send_keys(ENV.fetch('RAIDER_SECRET_PASSWORD'))
driver.find_element(by_role('button', name: 'Login', exact: true)).click
expect { driver.find_element(css: '.welcome-msg') }.to have_text('Welcome back')
Raider finds each element the way a person sees it: by its role and name, its label (label:), its text (text:) or its test id (test_id:), and only then by id, CSS or XPath. These are the locators and assertions of Writing tests, so a recorded test reads like one you wrote by hand.
View file, or ⌘⇧E (Ctrl+Shift+E), opens the test's Ruby file in the editor, where you can change it like any other file and press Save.
Start over, export and delete
The More menu on a test has Start over, which records the test again and replaces its steps, Export test and Delete test. A deleted test can be put back with Restore.
Record from part-way through
You do not have to record a whole test again to add to it.
- Click the space to the left of a step to set a breakpoint there.
- Click Record from here. Raider replays the steps above the breakpoint, then keeps recording from that point.
If a step cannot be replayed, for example custom code, Raider tells you, and the page may not match your steps.
Validations
A validation, which RSpec calls an assertion, is a step that makes sure something is true on the page, for example that a message appears. A test with validations fails when the page is wrong, not only when a click fails.
To add a validation while recording:
- Press Add validation…, next to Stop & save.
- The page shows "Click the thing you want to check. Press Esc to cancel." Click the element.
- Choose what to check from the Add a validation menu.
You can also right-click the element on the page to open the same menu. Press Esc, or click Cancel in the banner, to stop picking and keep recording.
| Menu item | What it checks | Ruby it writes |
|---|---|---|
| Check it is visible | The element is shown on the page. | be_visible |
| Check it is hidden | The element is not shown on the page. | be_hidden |
| Check it is enabled | The element can be used, for example a button that is not greyed out. | be_enabled |
| Check it is ticked | A checkbox or radio button is ticked. Only offered for those. | be_checked |
| Check its text is exactly… | The element's text matches what you type, exactly. | have_text('…', exact: true) |
| Check its text contains… | The element's text includes what you type. | have_text('…') |
| Check its value is… | A field holds the value you type. | have_value('…') |
| Check the page title is… | The page's title matches what you type. | have_title('…') |
| Check the address contains… | The page's address includes what you type, for example /dashboard. |
include('…') on the address |
| Wait until it… › appears, disappears or is enabled | Waits for the element before the next step. | be_visible, be_hidden, be_enabled |
The checks that end in "…" open a small window titled for the check (for example Check the text or Check the address). Type what you expect in the field, such as Text, Value or Part of the address, and click Add check. The validation appears in the step list like any other step.
Every element validation is written in the retrying block form, for example expect { driver.find_element(label: ['Email', { exact: true }]) }.to have_text('Saved'). It looks the element up again and retries until the page matches or the project's timeout runs out, so you never add a wait by hand.
First-recording guide
The first time you record on a computer, a short guide appears above the steps:
Recording a test
- Use the page on the right as you normally would. Every click and keystroke becomes a step here.
- To add a validation, press Add validation… (or right-click the page) and choose what to check.
- Press Stop & save (⌘⇧R) when you are done, then Run (⌘R) to see it pass.
It never covers the page. Click Got it to close it; it will not show again on its own. To see it again, choose Help › Recording guide, or click Show guide under the steps while recording. The guide's link opens the validations section of this page.
Fixing a failed test
When a recorded test fails, the app shows the step that failed, a picture from when you recorded it and one from when it failed, and the reason in plain words. Three fixes are offered:
- Edit value changes the text the step types.
- Re-pick element replays the test to that step and lets you click the right element on the page; click Use this to keep it.
- Re-record from here replaces this step and the ones after it with a new recording.
Then click Run again to check the fix. See Running tests and results.