Skip to content

Testing

AI Summary

A short gist of this page, generated for you.

Powered by AI. Summaries can miss nuance — when in doubt, read the page.

You can test an integration in three ways. Use the first one before every submission.

#Developer Portal preview

Upload your build in the Developer Portal and play it in the preview on the game's page. The game runs the way it will on Funox, and you get:

  • the SDK checklist, which ticks init(), gameplayStart(), gameplayStop() and commercialBreak() as your game calls them
  • a live feed of every SDK call your build makes, with the data it sent

See Preview tool for details.

#Standalone mode

Serve your game on localhost and open it in the browser. Outside a host page the SDK runs in standalone mode, so every call still works:

javascript
FunOxSDK.configure({ debug: true }); // log every SDK call to the console

FunOxSDK.init().then(function (result) {
  console.log(result.mode); // 'standalone'
  startGame();
});
Call Behaviour in standalone mode
getUser() Resolves null
saveProgress() / loadProgress() Use the browser's localStorage
commercialBreak() / rewardedBreak() Request ads as usual; may resolve with shown: false
submitScore(), getLeaderboard() Resolve without doing anything
getLanguage() Returns the browser's language code
Platform events (pause, mute, userChanged…) Never fire
Info

In standalone mode the SDK loads Google Analytics and the Google ad library, so expect those network requests while you test.

#A local test page

Use this when you need to simulate the platform itself, for example a logged-in player. Create a test.html next to your game and serve both from localhost — the SDK ignores replies from a page opened as a file:// URL.

html
<!DOCTYPE html>
<html>
<head><title>Funox SDK Test</title></head>
<body>
  <iframe
    src="http://localhost:8080"
    width="800"
    height="600"
    style="border:none"
  ></iframe>
  <script>
    // Simulate Funox platform responses
    var testUser = { id: 'test-user', name: 'TestPlayer', avatar: '' };
    var save = null;

    window.addEventListener('message', function (e) {
      var msg = e.data;
      if (!msg || msg.type !== 'funox-sdk-request') return;

      var data = {};
      if (msg.action === 'init') {
        data = { gameId: 'test-game', sessionToken: 'test-session', user: testUser };
      } else if (msg.action === 'getUser') {
        data = testUser;
      } else if (msg.action === 'saveProgress') {
        save = msg.payload.data;
        data = { saved: true, timestamp: Date.now() };
      } else if (msg.action === 'loadProgress') {
        data = save;
      } else if (msg.action === 'getLanguage') {
        data = { language: 'en' };
      }

      e.source.postMessage(
        { type: 'funox-sdk-response', id: msg.id, success: true, data: data },
        '*'
      );
    });
  </script>
</body>
</html>

#Checklist before you submit

Required to submit. The portal will not accept a submission until its preview has seen these four calls:

  • FunOxSDK.init() at game start, before any gameplay
  • FunOxSDK.gameplayStart() when active gameplay begins — not during loading or menus
  • FunOxSDK.gameplayStop() on game over or quit
  • FunOxSDK.commercialBreak() at a natural break

They must all pass again for every new build you upload.

Reported by the upload check. These appear as issues on your build if they are wrong:

  • The SDK is loaded from https://funox.com/sdk/v1/funox-sdk.js, once, before your game scripts — not from a copy inside your build
  • Your game code calls FunOxSDK

Check these yourself:

  • The game pauses and mutes before commercialBreak() and rewardedBreak(), and resumes after the promise settles
  • rewardedBreak() only grants the reward when result.completed === true
  • The game keeps working when an ad call resolves with shown: false
  • The player is read with getUser() or userChanged, not from the init() result
  • saveProgress() handles NOT_AUTHENTICATED for guests, and loadProgress() handles null
  • The game handles the pause / resume and mute / unmute platform events
  • SDK errors are caught and the game continues
  • FunOxSDK.configure({ debug: true }) is removed