Apex Designer Documentation
What's New
Getting Started
Projects
Business Objects
Processes
User Interfaces
App Behaviors
Files
Dependencies
Project Settings
Libraries
Patterns and Best Practices
App Showcase
Frequently Asked Questions

User Interface Test Suite

Blank Profile Image
Written by Kyle Hoskins
Updated 2 years ago
Less than a minute read

User Interface Test Suite allows for creating unit tests for your Pages and Components.

Basics

  • Start by entering what each test should do.  For example: "it should display Hello World."  "it should update the value on button click."
  • You can run your tests manually by clicking the debug icon in the App Manager dialog, or automatically after each build by checking the "Run tests on build" option.
  • Each test runs separately, but if you need to run common code for each test, you can use the "Initialize Test Cases Script" section.
  • Use each test to verify functionality using the expect() function.  For example expect(myValue).toBe('Hello World');
  • "component" and "fixture" are available in every test as documented by Angular.

Helper Functions and Variables

initializeComponent(); // creates the component to be tested

setProperty('myInputString', 'Hello'); // sets a component property value

expect(component.myInputString).toBe('Hello'); // Tests a UI Property Value
expect(component.twoTimesTwoMethod()).toBe(4); // Tests a UI Method Result

expectText('p.myClassName', 'Hello World'); // Tests HTML text content: <p class="myClassName">Hello World</p>

queryElement('.my-class') // returns an HTML Element via querySelector

// testing with a formControl
expectNext(component.formControl.valueChanges, 'john@smith.com'); // Runs a test on the next value change
const input = queryElement('input');
setInputValue(input, 'john@smith.com'); // updates the input text

expect(component.formControl.value).toBe('john@smith.com'); // Compares the expected form control value

 

 

Powered by Apex Designer
Terms of ServicePrivacy Policy
© 2017-2024 Apex Process Consultants