Update heartwood fixture and re-enable tests

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
This commit is contained in:
xphoniex
2023-01-30 14:27:46 +00:00
parent 40ad8c1efb
commit 9fae5ebb33
7 changed files with 216 additions and 108 deletions
+85 -16
View File
@@ -1,24 +1,29 @@
#!/usr/bin/env bash
killall radicle-node
killall git-daemon
set -euo pipefail
PASSPHRASE=asdf
SEED="0.0.0.0:8080"
export RAD_PASSPHRASE=asdf
REPO_ROOT=$(git rev-parse --show-toplevel)
ID=$(echo $RANDOM | md5sum | head -c 8)
BASE_PATH=$REPO_ROOT/tests/tmp/create-seed-fixture-$ID
ID=$(echo $RANDOM | md5sum | head -c 4)
BASE_PATH=$REPO_ROOT/tests/tmp/heartwood-$ID
TEST_REPO_ARCHIVE=$REPO_ROOT/tests/fixtures/repos/source-browsing.tar.bz2
TEST_REPO_NAME=source-browsing
TEST_REPO_PATH=$BASE_PATH/repos/$TEST_REPO_NAME
PALM_RAD_HOME=$BASE_PATH/seeds/palm
PALM_CHECKOUT=$BASE_PATH/checkout/palm
ALICE_RAD_HOME=$BASE_PATH/peers/alice
ALICE_CHECKOUT=$BASE_PATH/checkout/alice
BOB_RAD_HOME=$BASE_PATH/peers/bob
BOB_CHECKOUT=$BASE_PATH/checkout/bob
mkdir -p $PALM_RAD_HOME
mkdir -p $PALM_CHECKOUT
mkdir -p $ALICE_RAD_HOME
mkdir -p $ALICE_CHECKOUT
mkdir -p $BOB_RAD_HOME
@@ -27,25 +32,89 @@ mkdir -p $TEST_REPO_PATH
tar -xf $TEST_REPO_ARCHIVE -C $TEST_REPO_PATH
RAD_HOME=$PALM_RAD_HOME RAD_PASSPHRASE=$PASSPHRASE rad auth
### PALM NODE ###
GIT_AUTHOR_NAME="Alice Liddell"
GIT_AUTHOR_EMAIL="alice@radicle.xyz"
GIT_COMMITTER_NAME="Alice Liddell"
GIT_COMMITTER_EMAIL="alice@radicle.xyz"
eval $(ssh-agent)
RAD_SEED=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff RAD_HOME=$ALICE_RAD_HOME RAD_PASSPHRASE=$PASSPHRASE rad auth
export RAD_HOME=$PALM_RAD_HOME
export RAD_SEED=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffee
rad auth
radicle-node --listen 0.0.0.0:3446 --git-daemon 0.0.0.0:4446 &
### ALICE ###
export RAD_HOME=$ALICE_RAD_HOME
export RAD_SEED=ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
export GIT_AUTHOR_NAME="Alice Liddell"
export GIT_AUTHOR_EMAIL="alice@radicle.xyz"
export GIT_COMMITTER_NAME="Alice Liddell"
export GIT_COMMITTER_EMAIL="alice@radicle.xyz"
rad auth
cd $ALICE_CHECKOUT
git clone $TEST_REPO_PATH
cd $TEST_REPO_NAME
git checkout feature/branch
git checkout orphaned-branch
git checkout main
RAD_HOME=$ALICE_RAD_HOME RAD_PASSPHRASE=$PASSPHRASE rad init --name "source-browsing" --description "Git repository for source browsing tests" --default-branch "main" --no-confirm
PROJECT_ID=$(RAD_HOME=$ALICE_RAD_HOME RAD_PASSPHRASE=$PASSPHRASE rad .)
git checkout main
rad init --name "source-browsing" \
--description "Git repository for source browsing tests" \
--default-branch "main" \
--no-confirm
git checkout feature/branch
git push rad
git checkout orphaned-branch
git push rad
radicle-node --listen 0.0.0.0:3444 --git-daemon 0.0.0.0:4444 \
--connect z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8@0.0.0.0:3446 &
sleep 1
### PALM CLONE ###
cd $PALM_CHECKOUT
export RAD_HOME=$PALM_RAD_HOME
rad clone rad:zKtT7DmF9H34KkvcKj9PHW19WzjT
### BOB ###
export GIT_AUTHOR_NAME="Bob Belcher"
export GIT_AUTHOR_EMAIL="bob@radicle.xyz"
export GIT_COMMITTER_NAME="Bob Belcher"
export GIT_COMMITTER_EMAIL="bob@radicle.xyz"
export GIT_COMMITTER_DATE="Mon Dec 21 14:00 2022 +0100"
export RAD_HOME=$BOB_RAD_HOME
export RAD_SEED=fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe
rad auth
rad auth
radicle-node --listen 0.0.0.0:3445 --git-daemon 0.0.0.0:4445 \
--connect z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8@0.0.0.0:3446 &
sleep 2
cd $BOB_CHECKOUT
rad clone rad:zKtT7DmF9H34KkvcKj9PHW19WzjT
cd $TEST_REPO_NAME
echo "Updated readme" > README.md
git add README.md
git commit --message "Update readme" --date "$GIT_COMMITTER_DATE"
git push rad
### WAIT FOR SYNC WITH PALM ###
sleep 2
cd $BASE_PATH
tar -cjf palm.tar.bz2 --exclude "post-receive" --exclude "pre-receive" -C $ALICE_RAD_HOME .
tar -cjf palm.tar.bz2 --exclude "post-receive" --exclude "pre-receive" -C $PALM_RAD_HOME .
killall radicle-node
killall git-daemon
+1 -1
View File
@@ -1,7 +1,7 @@
#!/bin/sh
set -e
REV=e01838a70a2e19d747a49085db6445b1b823901e
REV=a5811e43a74043e3bf1e706720bac3ec01b079c4
REPO_ROOT=$(git rev-parse --show-toplevel)
FIXTURE=$REPO_ROOT/tests/fixtures/seeds/palm-heartwood.tar.bz2
+42 -24
View File
@@ -2,6 +2,7 @@ import type { Page } from "@playwright/test";
import {
aliceMainHead,
aliceRemote,
bobRemote,
expect,
projectFixtureUrl,
rid,
@@ -251,17 +252,20 @@ test("clone modal", async ({ page }) => {
});
test("peer and branch switching", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.goto(projectFixtureUrl);
// Alice's peer.
{
await page.getByTitle("Change peer").click();
await page.locator("text=alice").click();
await expect(page.getByTitle("Change peer")).toHaveText("alice delegate");
if (process.env.HEARTWOOD) {
await page.locator(`text=${aliceRemote}`).click();
await expect(page.getByTitle("Change peer")).toHaveText(
`${aliceRemote.substring(0, 6)}…${aliceRemote.slice(-6)}`,
);
} else {
await page.locator("text=alice").click();
await expect(page.getByTitle("Change peer")).toHaveText("alice delegate");
}
await expect(
page.locator(
`text=source-browsing / ${aliceRemote.substring(
@@ -322,31 +326,45 @@ test("peer and branch switching", async ({ page }) => {
// Bob's peer.
{
await page.getByTitle("Change peer").click();
await page.locator("text=bob").click();
await expect(page.getByTitle("Change peer")).toHaveText("bob");
if (process.env.HEARTWOOD) {
await page.locator(`text=${bobRemote}`).click();
await expect(page.getByTitle("Change peer")).toHaveText(
`${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)}`,
);
} else {
await page.locator("text=bob").click();
await expect(page.getByTitle("Change peer")).toHaveText("bob");
}
await expect(page.getByTitle("Change peer")).not.toHaveText("delegate");
// Default `main` branch.
{
await expect(page.getByTitle("Current branch")).toContainText(
"main 2b32f6f",
);
await expectCounts({ commits: 9, contributors: 2 }, page);
await expect(page.locator("text=2b32f6f Update readme")).toBeVisible();
if (process.env.HEARTWOOD) {
await expect(page.getByTitle("Current branch")).toContainText(
"main 1e0bb83",
);
await expectCounts({ commits: 9, contributors: 2 }, page);
await expect(page.locator("text=1e0bb83 Update readme")).toBeVisible();
} else {
await expect(page.getByTitle("Current branch")).toContainText(
"main 2b32f6f",
);
await expectCounts({ commits: 9, contributors: 2 }, page);
await expect(page.locator("text=2b32f6f Update readme")).toBeVisible();
}
}
}
});
test("only one modal can be open at a time", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.goto(projectFixtureUrl);
await page.getByTitle("Change peer").click();
await page.locator(`text=alice ${aliceRemote.substring(0, 6)}`).click();
if (process.env.HEARTWOOD) {
await page.locator(`text=${aliceRemote.substring(0, 6)}`).click();
} else {
await page.locator(`text=alice ${aliceRemote.substring(0, 6)}`).click();
}
await page.getByText("Clone").click();
await expect(page.locator("text=Code font")).not.toBeVisible();
@@ -363,7 +381,11 @@ test("only one modal can be open at a time", async ({ page }) => {
await page.getByTitle("Change peer").click();
await expect(page.locator("text=Code font")).not.toBeVisible();
await expect(page.locator("text=Use the Radicle CLI")).not.toBeVisible();
await expect(page.locator("text=bob hyyzz9")).toBeVisible();
if (process.env.HEARTWOOD) {
await expect(page.locator(`text=${bobRemote}`)).toBeVisible();
} else {
await expect(page.locator("text=bob hyyzz9")).toBeVisible();
}
await expect(page.locator("text=feature/branch")).not.toBeVisible();
page.locator('button[name="Settings"]').click();
@@ -374,10 +396,6 @@ test("only one modal can be open at a time", async ({ page }) => {
});
test.describe("browser error handling", () => {
if (process.env.HEARTWOOD) {
test.skip();
}
test("error appears when folder can't be loaded", async ({ page }) => {
await page.route(
`**/v1/projects/${ridPrefix}${rid}/tree/${aliceMainHead}/markdown/`,
+25 -27
View File
@@ -5,16 +5,18 @@ import {
bobRemote,
} from "@tests/support/fixtures.js";
const modifiedFileFixture = `${projectFixtureUrl}/remotes/${bobRemote}/commits/2b32f6fe50090ebdb4cd7441e943330da3e6ff04`;
const modifiedFileFixture = `${projectFixtureUrl}/remotes/${bobRemote}/commits/${
process.env.HEARTWOOD
? "1e0bb83a89b63da815f2fc24e7ae3c5ceb30e0eb"
: "2b32f6fe50090ebdb4cd7441e943330da3e6ff04"
}`;
test("navigation from commit list", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.goto(projectFixtureUrl);
await page.getByTitle("Change peer").click();
await page.locator("text=bob hyyzz9").click();
await page
.locator(process.env.HEARTWOOD ? `text=${bobRemote}` : "text=bob hyyzz9")
.click();
await page.locator('role=button[name="Commit count"]').click();
await page.locator("text=Update readme").click();
@@ -22,10 +24,6 @@ test("navigation from commit list", async ({ page }) => {
});
test("relative timestamps", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.addInitScript(() => {
window.initializeTestStubs = () => {
window.e2eTestStubs.FakeTimers.install({
@@ -37,25 +35,33 @@ test("relative timestamps", async ({ page }) => {
});
await page.goto(modifiedFileFixture);
await expect(
page.locator(".commit header >> text=bob committed 22 hours ago"),
page.locator(
`.commit header >> text=${
process.env.HEARTWOOD
? "Bob Belcher committed now"
: "bob committed 22 hours ago"
}`,
),
).toBeVisible();
});
test("modified file", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.goto(modifiedFileFixture);
// Commit header.
{
const header = page.locator(".commit header");
await expect(header.locator("text=Update readme")).toBeVisible();
await expect(header.locator("text=Verified")).toBeVisible();
await expect(
header.locator("text=2b32f6fe50090ebdb4cd7441e943330da3e6ff04"),
).toBeVisible();
if (!process.env.HEARTWOOD) {
await expect(header.locator("text=Verified")).toBeVisible();
await expect(
header.locator("text=2b32f6fe50090ebdb4cd7441e943330da3e6ff04"),
).toBeVisible();
} else {
await expect(
header.locator("text=1e0bb83a89b63da815f2fc24e7ae3c5ceb30e0eb"),
).toBeVisible();
}
}
// Diff header.
@@ -71,10 +77,6 @@ test("modified file", async ({ page }) => {
});
test("created file", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.goto(
`${projectFixtureUrl}/remotes/${bobRemote}/commits/d6318f7f3d9c15b8ac6dd52267c53220d00f0982`,
);
@@ -85,10 +87,6 @@ test("created file", async ({ page }) => {
});
test("deleted file", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.goto(
`${projectFixtureUrl}/remotes/${bobRemote}/commits/cd13c2d9a8a930d64a82b6134b44d1b872e33662`,
);
+59 -36
View File
@@ -3,21 +3,25 @@ import {
expect,
projectFixtureUrl,
bobRemote,
aliceRemote,
} from "@tests/support/fixtures.js";
test("peer and branch switching", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.goto(projectFixtureUrl);
await page.locator('role=button[name="Commit count"]').click();
// Alice's peer.
{
await page.getByTitle("Change peer").click();
await page.locator("text=alice hybg18").click();
await expect(page.getByTitle("Change peer")).toHaveText("alice delegate");
if (process.env.HEARTWOOD) {
await page.locator(`text=${aliceRemote}`).click();
await expect(page.getByTitle("Change peer")).toHaveText(
`${aliceRemote.substring(0, 6)}…${aliceRemote.slice(-6)}`,
);
} else {
await page.locator("text=alice hybg18").click();
await expect(page.getByTitle("Change peer")).toHaveText("alice delegate");
}
await expect(page.getByText("Thursday, November 17, 2022")).toBeVisible();
await expect(
@@ -60,13 +64,20 @@ test("peer and branch switching", async ({ page }) => {
// Bob's peer.
{
await page.getByTitle("Change peer").click();
await page.locator("text=bob hyyzz9").click();
await expect(page.getByTitle("Change peer")).toHaveText("bob");
if (process.env.HEARTWOOD) {
await page.locator(`text=${bobRemote}`).click();
await expect(page.getByTitle("Change peer")).toHaveText(
`${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)}`,
);
} else {
await page.locator("text=bob hyyzz9").click();
await expect(page.getByTitle("Change peer")).toHaveText("bob");
}
await expect(page.getByText("Tuesday, December 20, 2022")).toBeVisible();
await expect(
page.locator(".commit-group-headers").first().locator(".commit-teaser"),
).toHaveCount(3);
).toHaveCount(process.env.HEARTWOOD ? 1 : 3);
await expect(page.getByText("Thursday, November 17, 2022")).toBeVisible();
await expect(
@@ -75,8 +86,13 @@ test("peer and branch switching", async ({ page }) => {
await page.pause();
const latestCommit = page.locator(".commit-teaser").first();
await expect(latestCommit).toContainText("Update readme");
await expect(latestCommit).toContainText("2b32f6f");
if (process.env.HEARTWOOD) {
await expect(latestCommit).toContainText("Update readme");
await expect(latestCommit).toContainText("1e0bb83");
} else {
await expect(latestCommit).toContainText("Update readme");
await expect(latestCommit).toContainText("2b32f6f");
}
const earliestCommit = page.locator(".commit-teaser").last();
await expect(earliestCommit).toContainText(
@@ -87,32 +103,30 @@ test("peer and branch switching", async ({ page }) => {
});
test("verified badge", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.goto(projectFixtureUrl);
await page.locator('role=button[name="Commit count"]').click();
await page.getByTitle("Change peer").click();
await page.locator("text=bob hyyzz9").click();
await expect(page.getByTitle("Change peer")).toHaveText("bob");
await page.locator("text=Verified").hover();
await expect(
page.locator(
"text=This commit was signed with the committer's radicle key.",
),
).toBeVisible();
await expect(page.locator(`text=bob committed ${bobRemote}`)).toBeVisible();
if (process.env.HEARTWOOD) {
await page.locator(`text=${bobRemote}`).click();
await expect(page.getByTitle("Change peer")).toHaveText(
`${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)}`,
);
} else {
await page.locator("text=bob hyyzz9").click();
await expect(page.getByTitle("Change peer")).toHaveText("bob");
// not applicable to heartwood?
await page.locator("text=Verified").hover();
await expect(
page.locator(
"text=This commit was signed with the committer's radicle key.",
),
).toBeVisible();
await expect(page.locator(`text=bob committed ${bobRemote}`)).toBeVisible();
}
});
test("relative timestamps", async ({ page }) => {
if (process.env.HEARTWOOD) {
test.skip();
}
await page.addInitScript(() => {
window.initializeTestStubs = () => {
window.e2eTestStubs.FakeTimers.install({
@@ -127,12 +141,21 @@ test("relative timestamps", async ({ page }) => {
await page.locator('role=button[name="Commit count"]').click();
await page.getByTitle("Change peer").click();
await page.locator("text=bob hyyzz9").click();
await expect(page.getByTitle("Change peer")).toHaveText("bob");
const latestCommit = page.locator(".commit-teaser").first();
await expect(latestCommit).toContainText("bob committed 22 hours ago");
await expect(latestCommit).toContainText("2b32f6f");
if (process.env.HEARTWOOD) {
await page.locator(`text=${bobRemote}`).click();
await expect(page.getByTitle("Change peer")).toHaveText(
`${bobRemote.substring(0, 6)}…${bobRemote.slice(-6)}`,
);
const latestCommit = page.locator(".commit-teaser").first();
await expect(latestCommit).toContainText("Bob Belcher committed now");
await expect(latestCommit).toContainText("1e0bb83");
} else {
await page.locator("text=bob hyyzz9").click();
await expect(page.getByTitle("Change peer")).toHaveText("bob");
const latestCommit = page.locator(".commit-teaser").first();
await expect(latestCommit).toContainText("bob committed 22 hours ago");
await expect(latestCommit).toContainText("2b32f6f");
}
const earliestCommit = page.locator(".commit").last();
await expect(earliestCommit).toContainText(
Binary file not shown.
+4 -4
View File
@@ -168,9 +168,9 @@ export const aliceMainHead = "fcc929424b82984b7cbff9c01d2e20d9b1249842";
export const aliceRemote = process.env.HEARTWOOD
? "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"
: "hybg18bc4cu8z9xtj44skxperfdpxpp1wp8zygyzti5kfiggdizfxy";
export const bobRemote =
"hyyzz9w4ffg16zftjki3enajm4mkqkayb5ch1p6ns3f83np1hqkrp6";
export const bobRemote = process.env.HEARTWOOD
? "z6MksMTThc1aDU2Ztc43jJUivuyBLNWiLsDf4X65rABe7HbA"
: "hyyzz9w4ffg16zftjki3enajm4mkqkayb5ch1p6ns3f83np1hqkrp6";
export const rid = process.env.HEARTWOOD
? "zKtT7DmF9H34KkvcKj9PHW19WzjT"
: "hnrkdi8be7n4hhqoz9rpzrgd68u9dr3zsxgmy";
@@ -179,5 +179,5 @@ export const projectFixtureUrl = `/seeds/0.0.0.0/${ridPrefix}${rid}`;
export const seedPort = process.env.HEARTWOOD ? 8080 : "8777";
export const seedVersion = process.env.HEARTWOOD ? "0.1.0" : "0.2.0";
export const seedRemote = process.env.HEARTWOOD
? "z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi"
? "z6Mkk7oqY4pPxhMmGEotDYsFo97vhCj85BLY1H256HrJmjN8"
: "hybuytx44z9cfsm5739wecia9j4b7expgc15qkazph59szp57m4d3o";