Skip to content

Add listing tests#251

Merged
tintinthong merged 18 commits intomainfrom
add-listing-create-test
Mar 25, 2026
Merged

Add listing tests#251
tintinthong merged 18 commits intomainfrom
add-listing-create-test

Conversation

@tintinthong
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the CI setup for the catalog repo by switching from the previous catalog acceptance/integration test execution to a new “live test” workflow in the Boxel monorepo, and introduces a sample card + live-test module alongside a shared copy script.

Changes:

  • Removed the existing catalog acceptance tests and the listing-update-specs integration test from this repo.
  • Added a reusable copy-catalog-to-monorepo.sh script and updated CI workflows to use it.
  • Added sample-command-card.gts and sample-command-card-test.gts for live-test coverage.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tests/integration/listing-update-specs-test.gts Deletes the listing-update-specs integration test.
tests/acceptance/real-catalog-app-test.gts Deletes the “real catalog app” acceptance test.
tests/acceptance/catalog-app-test.gts Deletes the large catalog acceptance suite.
scripts/copy-catalog-to-monorepo.sh Adds a shared script to wipe/sync catalog files into the Boxel monorepo.
sample-command-card.gts Adds a sample realm card, but currently includes embedded test-only imports/code.
sample-command-card-test.gts Adds a live-test module that exercises saving + search indexing for the sample card.
.github/workflows/ci-test.yaml Renames job and switches CI to run pnpm test:live plus uploads a junit artifact.
.github/workflows/ci-lint.yaml Switches the copy step to use the new script.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +37 to +46
echo "[copy-catalog] Syncing catalog source into monorepo..."
rsync -av \
--exclude='.git/' \
--include='index.json' \
--exclude='*.json' \
--exclude='.gitignore' \
--exclude='tests/' \
--exclude='scripts/' \
--exclude='system-card/' \
"$CATALOG_SRC/" "$CATALOG_REALM/"
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rsync excludes all *.json files (except index.json) after the script has removed most of packages/catalog-realm. That combination will wipe out the catalog realm’s JSON card content (e.g. Category/Tag/Theme/Listing instances) in the Boxel checkout and not restore it, which will likely break the realm and any tests that depend on those cards. Consider either (a) copying JSON cards from boxel-catalog-src (remove --exclude='*.json' and instead exclude only the config JSONs you don’t want to overwrite), or (b) if JSON content should remain from the monorepo, update the find keep-list to preserve those directories so they aren’t deleted.

Copilot uses AI. Check for mistakes.
Comment on lines +8 to +23
// ── Tests (imports resolved via loader.shimModule in live-test.js) ────────────
import { on } from '@ember/modifier'; import { service } from '@ember/service';
import { click, render, waitUntil } from '@ember/test-helpers';
import GlimmerComponent from '@glimmer/component';
import { module, test } from 'qunit';

import { type Store } from '@cardstack/runtime-common';
import {
setupCardTest,
setupIntegrationTestRealm,
testRealmURL,
withCachedRealmSetup,
type TestContextWithSave,
} from '@cardstack/host/tests/helpers';
import { TestRealmAdapter } from '@cardstack/host/tests/helpers/adapter';

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sample-command-card.gts mixes a realm card module with test-only dependencies (@ember/test-helpers, qunit, @cardstack/host/tests/helpers, etc.). Outside the live-test harness these imports won’t resolve for a normal realm loader/indexer, so this card module can fail to load (and it also pulls test-only code into the realm bundle). Suggest splitting this so sample-command-card.gts contains only the card definition (and any runtime UI), and keep all QUnit/Ember-test code in sample-command-card-test.gts (or another test-only file that won’t be shipped/loaded by the realm).

Copilot uses AI. Check for mistakes.
} from 'https://cardstack.com/base/card-api';
import StringField from 'https://cardstack.com/base/string';
// ── Tests (imports resolved via loader.shimModule in live-test.js) ────────────
import { on } from '@ember/modifier'; import { service } from '@ember/service';
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two separate import statements are on the same line, which is likely to fail formatting/lint rules and makes diffs harder to read. Please split these into separate lines (and let the formatter handle ordering).

Suggested change
import { on } from '@ember/modifier'; import { service } from '@ember/service';
import { on } from '@ember/modifier';
import { service } from '@ember/service';

Copilot uses AI. Check for mistakes.
static isolated = class Isolated extends Component<typeof SampleCommandCard> {
<template>
<h1><@fields.title /></h1>
<button type='button'>Create Card</button>
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The card’s isolated template renders a “Create Card” button, but it isn’t wired to any action (the click handler exists only in the separate CreateCardButton test component). If this button is meant to demonstrate the command behavior, consider rendering CreateCardButton (or adding an {{on 'click' ...}} handler) in the isolated template; otherwise remove the button to avoid a misleading UI.

Suggested change
<button type='button'>Create Card</button>

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +82
await render(<template><CreateCardButton /></template>);
await click('button');

assert.ok(savedUrl, 'card was saved to realm');
let relativePath = `${savedUrl!.href.substring(testRealmURL.length)}.json`;
let file = await testRealmAdapter.openFile(relativePath);
assert.ok(file, 'card JSON file exists in the realm adapter');
});
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test asserts savedUrl immediately after click('button'), but the save callback can run asynchronously depending on how store.add flushes writes. That can make the test flaky and can lead to savedUrl still being undefined when computing relativePath. Suggest waiting until savedUrl is set (as you already do in the next test) before the assertions and file lookup.

Copilot uses AI. Check for mistakes.
Comment on lines +75 to +77
await render(<template><CreateCardButton /></template>);
await click('button');

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using click('button') is brittle if additional buttons get introduced by the test harness or template changes. Prefer targeting a specific button via a data-test-* attribute (or a more specific selector) so the test intent stays stable.

Copilot uses AI. Check for mistakes.
Comment on lines +15 to 17
live-test:
name: Live Tests (realm)
runs-on: ubuntu-latest
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR title says "Add listing tests", but this change set removes the existing catalog acceptance/integration test suites and switches CI to a different pnpm test:live workflow. If the intent is to migrate away from the previous listing tests, consider updating the PR title/description to match, or reintroducing the listing-specific coverage in the new live test suite so coverage doesn’t regress.

Copilot uses AI. Check for mistakes.
@tintinthong tintinthong merged commit ddf517f into main Mar 25, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants