Skip to content

Commit 3bc197a

Browse files
committed
fix: test caching
1 parent 5d560e2 commit 3bc197a

5 files changed

Lines changed: 32 additions & 91 deletions

File tree

.github/workflows/e2e.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ jobs:
3939
- name: Install dependencies
4040
run: npm install
4141

42-
- name: Build
43-
run: npm run build
42+
- name: Build (dev)
43+
run: npm run build:dev
4444

4545
- name: Cache Obsidian
4646
uses: actions/cache@v5

test/e2e/quartz-build/quartz-setup.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,13 @@ function ensureQuartzUtilsCompatibility(): void {
4747
if (hasNormalizeHastElement()) {
4848
return;
4949
}
50-
execSync("npm install @quartz-community/utils@latest", {
51-
cwd: QUARTZ_CACHE_DIR,
52-
stdio: "inherit",
53-
});
50+
execSync(
51+
"npm install --ignore-scripts=false @quartz-community/utils@latest",
52+
{
53+
cwd: QUARTZ_CACHE_DIR,
54+
stdio: "inherit",
55+
},
56+
);
5457
}
5558

5659
export function ensureQuartzCache(): void {
@@ -74,7 +77,10 @@ export function ensureQuartzCache(): void {
7477
`git clone --branch ${QUARTZ_TAG} --depth 1 ${QUARTZ_REPO} ${QUARTZ_CACHE_DIR}`,
7578
{ stdio: "inherit" },
7679
);
77-
execSync("npm install", { cwd: QUARTZ_CACHE_DIR, stdio: "inherit" });
80+
execSync("npm install --ignore-scripts=false", {
81+
cwd: QUARTZ_CACHE_DIR,
82+
stdio: "inherit",
83+
});
7884
cpSync(
7985
join(QUARTZ_CACHE_DIR, QUARTZ_SOURCE_DIR),
8086
join(QUARTZ_CACHE_DIR, QUARTZ_ENGINE_DIR),

test/specs/dom-contract.e2e.ts

Lines changed: 15 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -75,83 +75,29 @@ describe("DOM contract", function () {
7575
expect(count).toBe(1);
7676
});
7777

78-
it("has pub-tab data-qs when configured", async function () {
79-
const result = await browser.executeObsidian(() => {
80-
const tabs = document.querySelectorAll('[data-qs="pub-tab"]');
81-
const configured = Boolean(
82-
(
83-
app as unknown as {
84-
plugins: {
85-
plugins: Record<
86-
string,
87-
{ settings?: { gitRemoteUrl?: string } }
88-
>;
89-
};
90-
}
91-
).plugins.plugins["quartz-syncer"]?.settings?.gitRemoteUrl,
92-
);
93-
return { count: tabs.length, configured };
78+
it("has pub-tab data-qs", async function () {
79+
const count = await browser.executeObsidian(() => {
80+
return document.querySelectorAll('[data-qs="pub-tab"]').length;
9481
});
95-
if (result.configured) {
96-
expect(result.count).toBe(2);
97-
} else {
98-
expect(result.count).toBe(0);
99-
}
82+
expect(count).toBe(2);
10083
});
10184

102-
it("has pub-publish-btn when configured", async function () {
103-
const result = await browser.executeObsidian(() => {
104-
const publish = document.querySelector(
105-
'[data-qs="pub-publish-btn"]',
85+
it("has pub-publish-btn", async function () {
86+
const hasPublish = await browser.executeObsidian(() => {
87+
return (
88+
document.querySelector('[data-qs="pub-publish-btn"]') !==
89+
null
10690
);
107-
const configured = Boolean(
108-
(
109-
app as unknown as {
110-
plugins: {
111-
plugins: Record<
112-
string,
113-
{ settings?: { gitRemoteUrl?: string } }
114-
>;
115-
};
116-
}
117-
).plugins.plugins["quartz-syncer"]?.settings?.gitRemoteUrl,
118-
);
119-
return {
120-
hasPublish: publish !== null,
121-
configured,
122-
};
12391
});
124-
if (result.configured) {
125-
expect(result.hasPublish).toBe(true);
126-
} else {
127-
expect(result.hasPublish).toBe(false);
128-
}
92+
expect(hasPublish).toBe(true);
12993
});
13094

131-
it("has pub-search when configured", async function () {
132-
const result = await browser.executeObsidian(() => {
133-
const search = document.querySelectorAll(
134-
'[data-qs="pub-search"]',
135-
);
136-
const configured = Boolean(
137-
(
138-
app as unknown as {
139-
plugins: {
140-
plugins: Record<
141-
string,
142-
{ settings?: { gitRemoteUrl?: string } }
143-
>;
144-
};
145-
}
146-
).plugins.plugins["quartz-syncer"]?.settings?.gitRemoteUrl,
147-
);
148-
return { count: search.length, configured };
95+
it("has pub-search", async function () {
96+
const count = await browser.executeObsidian(() => {
97+
return document.querySelectorAll('[data-qs="pub-search"]')
98+
.length;
14999
});
150-
if (result.configured) {
151-
expect(result.count).toBe(1);
152-
} else {
153-
expect(result.count).toBe(0);
154-
}
100+
expect(count).toBe(1);
155101
});
156102
});
157103
});

test/specs/onboarding.e2e.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,21 @@ describe("Onboarding wizard", function () {
2727
await new Promise((resolve) => setTimeout(resolve, 300));
2828
};
2929

30-
it("renders the token step and closes", async function () {
30+
it("renders the method step and closes", async function () {
3131
await openWizard();
3232

3333
const wizardState = await browser.executeObsidian(() => {
3434
const wizard = document.querySelector(
3535
".quartz-syncer-onboarding-wizard",
3636
);
37-
const tokenInput = wizard?.querySelector(
38-
".qs-onboarding-token-input",
39-
) as HTMLInputElement | null;
40-
const validateButton = wizard?.querySelector(
41-
".qs-onboarding-validate",
42-
);
4337
return {
4438
hasWizard: wizard !== null,
4539
stepText: wizard?.textContent ?? "",
46-
tokenType: tokenInput?.type ?? "",
47-
hasValidate: validateButton !== null,
4840
};
4941
});
5042
expect(wizardState.hasWizard).toBe(true);
51-
expect(wizardState.stepText).toContain(
52-
"Enter your GitHub token to continue.",
53-
);
54-
expect(wizardState.tokenType).toBe("password");
55-
expect(wizardState.hasValidate).toBe(true);
43+
expect(wizardState.stepText).toContain("Create new Quartz site");
44+
expect(wizardState.stepText).toContain("Connect existing repository");
5645

5746
await browser.executeObsidian(() => {
5847
const wizard = document.querySelector(

test/specs/publication-center.e2e.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ describe("Publication Center", function () {
4949
};
5050
});
5151
expect(modalState.hasModal).toBe(true);
52-
expect(modalState.title).toBe("Publication center");
52+
expect(modalState.title).toBe("Publication Center");
5353
expect(modalState.hasHeader).toBe(true);
5454
expect(modalState.hasTree).toBe(true);
5555
expect(modalState.message).toContain(

0 commit comments

Comments
 (0)