-
-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web): re-implement timeout error test
The previous approach with overriding `onload` no longer works if we use indirect eval. However, since we now need to use a server anyways instead of directly loading a file (because of Core), we can add a timeout to the test server and implement this test in a cleaner way.
- Loading branch information
1 parent
387a697
commit c05cf0e
Showing
5 changed files
with
61 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Manual tests | ||
|
||
To run the the manual tests, start the test web server with: | ||
|
||
```bash | ||
cd $KEYMAN_ROOT | ||
web/build.sh start | ||
``` | ||
|
||
Then open <http://localhost:3000> in your browser. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,42 @@ | ||
// JavaScript Document samplehdr.js: Keyboard management for KeymanWeb demonstration pages | ||
|
||
/* | ||
/* | ||
This script is designed to test KeymanWeb error message handling. | ||
*/ | ||
|
||
function loadKeyboards() | ||
{ | ||
function loadKeyboards() | ||
{ | ||
var kmw=keyman; | ||
|
||
// We start by adding a keyboard correctly. It's best to include a 'control' in our experiment. | ||
kmw.addKeyboards({id:'us',name:'English',languages:{id:'en',name:'English'}, | ||
filename:'../us-1.0.js'}); | ||
|
||
// Insert a keyboard that cannot be found. | ||
kmw.addKeyboards({id:'lao_2008_basic',name:'wrong-filename', | ||
languages:{ | ||
id:'lo',name:'debugging',region:'Asia', | ||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']} | ||
}, | ||
filename:'./missing_file.js' // Intentional error - the file doesn't exist, so the <script> tag will raise an error event. | ||
}); | ||
// Insert a keyboard that will generate a timing error. | ||
}); | ||
|
||
// Insert a keyboard that will generate a timing error. | ||
kmw.addKeyboards({id:'unparsable',name:'non-parsable', | ||
languages:{ | ||
id:'lo',name:'debugging',region:'Asia', | ||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']} | ||
}, | ||
filename:'./unparsable.js' // Intentional error - the file has no parsable keyboard, so while the <script> tag will load, | ||
// registration will fail. | ||
}); | ||
}); | ||
|
||
// Insert a keyboard that will generate a timing error. | ||
// Insert a keyboard that will generate a timing error. `timeout.js` doesn't | ||
// exist, but the test server (web/src/tools/testing/test-server/index.cjs) | ||
// has special handling for that URL and times out after 10 seconds. | ||
kmw.addKeyboards({id:'timeout',name:'timeout', | ||
languages:{ | ||
id:'lo',name:'debugging',region:'Asia', | ||
font:{family:'LaoWeb',source:['../font/saysettha_web.ttf','../font/saysettha_web.woff','../font/saysettha_web.eot']} | ||
}, | ||
filename:'./timeout.js' // Intentional (simulated) error - the file never loads, simulating a server timeout. | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters