Skip to content

Commit

Permalink
Update specs checking Hello World card on seed realm
Browse files Browse the repository at this point in the history
  • Loading branch information
lukemelia committed Dec 23, 2024
1 parent 1b09e17 commit 469098f
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
16 changes: 11 additions & 5 deletions packages/matrix/tests/live-cards.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,22 @@ test.describe('Live Cards', () => {
skipOpeningAssistant: true,
});
await createRealm(page, realmName);
await page.goto(`${realmURL}hello-world`);
await page.goto(
`${realmURL}HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0`,
);
await expect(
page.locator(`[data-test-card="${realmURL}hello-world"]`),
).toContainText('Hello World');
page.locator(
`[data-test-card="${realmURL}HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0"]`,
),
).toContainText('Some folks say');

// assert that instance updates are live bound
let helloWorldPath = join(
realmServer.realmPath,
'..',
'user1',
realmName,
'hello-world.json',
'HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0.json',
);
await expect(
page.locator('[data-test-realm-indexing-indicator]'),
Expand All @@ -90,7 +94,9 @@ test.describe('Live Cards', () => {
page.locator('[data-test-realm-indexing-indicator]'),
).toHaveCount(1);
await expect(
page.locator(`[data-test-card="${realmURL}hello-world"]`),
page.locator(
`[data-test-card="${realmURL}HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0"]`,
),
).toContainText('Hello Mars');
await expect(
page.locator('[data-test-realm-indexing-indicator]'),
Expand Down
20 changes: 14 additions & 6 deletions packages/matrix/tests/registration-with-token.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,9 @@ test.describe('User Registration w/ Token - isolated realm server', () => {
).toHaveCount(1);
await showAllCards(page);
await expect(
page.locator(`[data-test-cards-grid-item="${newRealmURL}hello-world"]`),
page.locator(
`[data-test-cards-grid-item="${newRealmURL}HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0"]`,
),
).toHaveCount(1);
await page.locator(`[data-test-workspace-chooser-toggle]`).click();
await expect(page.locator('[data-test-workspace-chooser]')).toHaveCount(1);
Expand Down Expand Up @@ -262,23 +264,29 @@ test.describe('User Registration w/ Token - isolated realm server', () => {

// assert that logged in user can navigate directly to card in private realm without
// being asked to login
await page.goto(`${newRealmURL}hello-world`);
await page.goto(
`${newRealmURL}HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0`,
);
await expect(
page.locator(`[data-test-card="${newRealmURL}hello-world"]`),
).toContainText('Hello World');
page.locator(
`[data-test-card="${newRealmURL}HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0"]`,
),
).toContainText('Some folks say');

// assert that non-logged in user is prompted to login before navigating
// directly to card in private repo
await logout(page);
await assertLoggedOut(page);

await login(page, 'user1', 'mypassword1!', {
url: `${newRealmURL}hello-world`,
url: `${newRealmURL}HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0`,
skipOpeningAssistant: true,
});
await assertLoggedIn(page, { displayName: 'Test User' });
await expect(
page.locator(`[data-test-card="${newRealmURL}hello-world"]`),
page.locator(
`[data-test-card="${newRealmURL}HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0"]`,
),
).toHaveCount(1);

let auth = await loginUser(`user1`, 'mypassword1!');
Expand Down
9 changes: 7 additions & 2 deletions packages/realm-server/tests/realm-server-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3079,8 +3079,13 @@ module('Realm Server', function (hooks) {
'seed file index.json exists',
);
assert.ok(
existsSync(join(realmPath, 'hello-world.json')),
'seed file hello-world.json exists',
existsSync(
join(
realmPath,
'HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0.json',
),
),
'seed file HelloWorld/47c0fc54-5099-4e9c-ad0d-8a58572d05c0.json exists',
);
assert.notOk(
existsSync(join(realmPath, 'package.json')),
Expand Down

0 comments on commit 469098f

Please sign in to comment.