Skip to content

Commit a94f623

Browse files
Merge pull request #229 from SenteraLLC/feature/tests
Feature/tests
2 parents 88bd942 + 0f751af commit a94f623

41 files changed

Lines changed: 7961 additions & 3479 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## General Instructions
22
- Keep it simple.
33
- Work in small, incremental changes.
4-
- Whenever you run a command in the terminal, pipe the output to a file, output.txt, that you can read from. Make sure to overwrite each time so that it doesn't grow too big. There is a bug in the current version of Copilot that causes it to not read the output of commands correctly. This workaround allows you to read the output from the temporary file instead.
54
- Ensure changes pass linting checks by running `npm run lint` and waiting for it to complete. Read the linting errors and resolve them manually.
65
- Ensure changes build successfully by running `npm run build`.
76
- Do not add new dependencies unless given explicit permission.

.github/tasks.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,25 @@
33
- [x] Implement the fix requested in [#209](https://github.com/SenteraLLC/ulabel/issues/209).
44
- [x] Build the fix and ensure the build succeeds by running `npm run build`.
55
- [x] Receive confirmation that the fix works as expected.
6+
- [x] Configure Jest to suppress verbose stack traces (added --noStackTrace flag)
7+
- [x] Fix class ID test to check ID is not in existing list (implementation-agnostic)
8+
- [x] Increase max workers from 1 to 2 (reduced test time from 200s+ to ~23s)
9+
- [ ] Fix remaining unit test failures (6 failures, 14 passed)
10+
- Spatial payload tests need DOM mocking
11+
- ID payload tests need DOM mocking
12+
- Note: Some error messages contain minified code context - this is expected when testing against dist/ulabel.js
13+
- [x] Refactor e2e tests to use utility functions
14+
- [x] Create init_utils.js with wait_for_ulabel_init
15+
- [x] Create annotation_utils.js with get_annotation_count, get_annotation_by_index, get_all_annotations
16+
- [x] Create mode_utils.js with switch_to_mode
17+
- [x] Create subtask_utils.js with get_current_subtask_key, switch_to_subtask, get_subtask_count
18+
- [x] Update basic-functionality.spec.js to use new utilities
19+
- [x] All 6 basic functionality tests passing
20+
- [x] Refactor tests/ folder to use snake_case naming convention
21+
- [x] Updated all utility function names to snake_case
22+
- [x] Updated all variable names in e2e tests to snake_case
23+
- [x] Updated all variable names in unit tests to snake_case
24+
- [x] Updated all variable names in setup.js to snake_case
25+
- [x] Updated all variable names in utility files to snake_case
26+
- [x] Verified unit tests pass (14 passed)
27+
- [x] Verified e2e tests pass (6 passed)

.github/workflows/test.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Tests
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
unit-tests:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '20'
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm install
28+
29+
- name: Run unit tests
30+
run: npm run build-and-test
31+
32+
e2e-tests:
33+
runs-on: ubuntu-latest
34+
35+
steps:
36+
- uses: actions/checkout@v4
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: '20'
42+
cache: 'npm'
43+
44+
- name: Install dependencies
45+
run: npm install
46+
47+
- name: Install Playwright browsers
48+
run: npx playwright install --with-deps
49+
50+
- name: Build project
51+
run: npm run build
52+
53+
- name: Run E2E tests
54+
run: npm run test:e2e
55+
56+
- name: Upload Playwright report
57+
uses: actions/upload-artifact@v4
58+
if: failure()
59+
with:
60+
name: playwright-report
61+
path: playwright-report/
62+
retention-days: 30

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@ node_modules
22
ulabel_local/py-dbapi/dbapi/__pycache__
33
build
44
build/*
5-
output.txt
5+
output.txt
6+
test-results/
7+
playwright-report/

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@ All notable changes to this project will be documented here.
66

77
Nothing yet.
88

9+
## [0.19.1] - Oct 9th, 2025
10+
- Add automated testing to the repo
11+
- Fix circular webpack builds by forcibly cleaning the `dist/` directory before each build
12+
- Also use `import type... from ".."` instead of just `import` to fix ts not properly resolving imports to js
13+
- Reduced bundle size from ~20 MB -> 1 MB
14+
- Refactor some more `console.warn` and `console.error` instances to use `log_message`
15+
- Remove deprecated `parent_id` field from `ULabelAnnotation`
16+
917
## [0.19.0] - Aug 19th, 2025
1018

1119
- Add minimal lineage tracking via `last_edited_by` and `last_edited_at` annotation fields

api_spec.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ As you can see, each subtask will have a corresponding list of annotation object
151151
// a unique id for this annotation
152152
"id": "<uuidv4 string>",
153153

154-
// (nullable) id of ann that was edited to create this one
155-
"parent_id": "<uuidv4 string>",
156-
157154
// the provided username
158155
"created_by": "<string>",
159156

demo/multi-class.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@
140140
console.log(ulabel);
141141
});
142142

143+
// Expose ulabel instance globally for testing
144+
window.ulabel = ulabel;
143145
});
144146
</script>
145147
</head>

dist/ulabel.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/ulabel.js.LICENSE.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,6 @@ object-assign
6868
and limitations under the License.
6969
***************************************************************************** */
7070

71-
/*! For license information please see ulabel.js.LICENSE.txt */
72-
7371
/**
7472
* splaytree v3.1.2
7573
* Fast Splay tree for Node and browser

dist/ulabel.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)