Development and Debugging Tips Follow
This document includes development and debugging tips while developing in AuraPlayer.
Development tips
- Develop in Chrome - Chrome is the most friendly browser for web development with the best performance. It includes features such as:
1. It includes profound DevTools
2. You can easily emulate mobile devices with many types and sizes
- While you develop the application in Chrome, test it on all browsers that are used by your users.
- Develop your application in Single Page Application (SPA) mode - SPA is faster than the standard mode and it is easier to debug.
- Progressive Web Application (PWA) - If you would like your application to look like a mobile native application you can change the application type to PWA before moving it to production. However it would require HTTPS...
- Work agile - It is easier to develop one flow at a time including its pages and record its services rather than build the whole application at once. Thus:
1. Start with recording the first set of services for one flow
2. Create pages for one flow
3. Test it
4. Continue to build next flows as needed
Working with Partial Services
Working with partial services will make you be aware of the server sessions (Forms/EBS). This is because a partial service relies on an open session that was created by a previous full service. So when calling a full service that proceeds with partial services that session must be kept open. Here are a few tips to avoid bugs while managing sessions:
- In most cases you do not need more than one open session.
- Calling Services.startSession() in JavaScript will tell the application to keep the session open after any service call.
- Any session has a default timeout - If you are not closing a session properly the timeout will handle it for you. Just make sure to put a reasonable timeout so the session will not stay open for a long time.
- You need to close the session programmatically by calling Services.killSession() in JavaScript. Since UI programming is event based, you would probably need to close the session in a few places (e.g. different flows, error, etc). Thus, we recommend the following:
1. Call Services.killSession() In any place you are sure the session should be closed.
Note: If you call killSession that is already closed nothing happens. Thus, you avoid keeping a redundant open session.
2. Call Services.killSession() just before opening a new session.
Note: If you call killSession that is already closed nothing happens. Thus, you avoid opening more than one session in parallel.
- For debug purposes you can see the active sessions in the Admin->Sessions - you can take a look at the opened session and check whether you keep redundant opened sessions.
Debug and Troubleshooting
- Use Chrome DevTools - As stated before, we recommend to use Chrome to develop the application. Chrome DevTools include convenient tools to debug the application, see the network, get JavaScript errors, etc.
- Use HTML snapshots - When creating HTML services you can save snapshots of your underlying application for convenient debugging. All snapshots are saved in Admin->Server Files, under temp folder. AuraPlayer supports several methods to create snapshots:
1. Automatically - upon exception using the name HtmlDump_[service name]
2. Manually in the HTML recorder - Using the command storeHtmlSource will via the recorder will create an HTML snapshot.
Note: Do not forget to remove the command before launch. Otherwise, redundant snapshots will be created every time the service is being executed.
3. Manually when calling a service - you can pass a special input parameter: screenshots = true in the Form data of each service. Snapshots will be saved for each step of the service.
Note: Do not forget to remove the parameter before launch. Otherwise, redundant snapshots will be created every time the service is being executed.
4. Dynamically upon demand - click 3 times on the hamburger menu will open a hidden debug menu, where you can save snapshots. It helps to debug without changing the code.
- Using AuraPlayer Log Files - AuraPlayer server collects logs by default. You can reach the log data in two ways:
1. via Admin->View Log.
2. Via Admin->Statistics->Admin Log - to filter the log by time, application, and service.
In addition, you can enhance the default log with your own logs and comments:
1. Use the echo command in the HTML recorder
2. Use Console.log() in JavaScript service
Comments
0 comments
Please sign in to leave a comment.