Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Codi 🐶 Web Test Runner 🏃 #1203

Merged
merged 1 commit into from
Apr 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
},
"devDependencies": {
"clean-jsdoc-theme": "^4.2.17",
"codi-test-framework": "^0.0.15",
"codi-test-framework": "^0.0.23",
"cookie-parser": "^1.4.5",
"dotenv": "^16.4.5",
"esbuild": "^0.19.11",
Expand Down
6 changes: 3 additions & 3 deletions public/tests/_default.test.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, it, assertEqual, assertNotEqual, assertTrue, assertFalse, assertThrows } from 'https://esm.sh/[email protected].15';
import { describe, it, assertEqual, assertNotEqual, assertTrue, assertFalse, assertThrows } from 'https://esm.sh/[email protected].23';
import { layerTest } from './layer.test.mjs';

describe('Mapview test', async () => {
await describe('Mapview test', async () => {

console.log(`MAPP v${mapp.version}`)
// Set Openlayers node in order to move map object.
Expand Down Expand Up @@ -604,6 +604,6 @@ describe('Mapview test', async () => {
assertEqual(mapview.Map.getTargetElement().style.marginTop, '0px', 'Margin top of the map target element should be set to 0 after removeLastTab is called');
});

layerTest(mapview);
await layerTest(mapview);

});
4 changes: 2 additions & 2 deletions public/tests/layer.test.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, it, assertEqual, assertNotEqual, assertTrue, assertFalse, assertThrows } from 'https://esm.sh/[email protected].15';
import { describe, it, assertEqual, assertNotEqual, assertTrue, assertFalse, assertThrows } from 'https://esm.sh/[email protected].23';

export async function layerTest(mapview) {

Expand All @@ -10,7 +10,7 @@ export async function layerTest(mapview) {

const default_zoom = mapview.view.z;

describe(`${mapview.host} : Layer Test`, async () => {
await describe(`${mapview.host} : Layer Test`, async () => {
for (const key in mapview.layers) {
if (mapview.layers.hasOwnProperty(key)) {
await it(`Layer test : ${key}`, async () => {
Expand Down
22 changes: 20 additions & 2 deletions public/views/_test.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@
<link rel="stylesheet" href="{{dir}}/public/css/mapp.css" />
<link rel="stylesheet" href="{{dir}}/public/css/ui.css" />

<script type="importmap">
{
"imports": {
"codi": "https://esm.sh/[email protected]"
}
}
</script>

<script type="module" src="{{dir}}/public/js/lib/mapp.js" defer></script>
<script type="module" src="{{dir}}/public/js/lib/ui.js" defer></script>

Expand Down Expand Up @@ -300,8 +308,18 @@

</div>

</body>
<script type="module">
import { runWebTests } from "codi";

const testFiles = [`${window.location.origin}{{dir}}/public/tests/_default.test.mjs`];

<script src="{{dir}}/public/tests/_default.test.mjs" type="module"></script>
try {
await runWebTests(testFiles);
} catch (error) {
console.error('Error running tests:', error);
}
</script>

</body>

</html>
Loading