Add Capacitor support (#483)
Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
34
e2e-tests/capacitor.spec.ts
Normal file
34
e2e-tests/capacitor.spec.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { testSkipIfWindows, Timeout } from "./helpers/test_helper";
|
||||
|
||||
testSkipIfWindows("capacitor upgrade and sync works", async ({ po }) => {
|
||||
await po.setUp();
|
||||
await po.sendPrompt("hi");
|
||||
await po.getTitleBarAppNameButton().click();
|
||||
await po.clickAppUpgradeButton({ upgradeId: "capacitor" });
|
||||
await po.expectNoAppUpgrades();
|
||||
await po.snapshotAppFiles({ name: "upgraded-capacitor" });
|
||||
|
||||
await po.page.getByTestId("capacitor-controls").waitFor({ state: "visible" });
|
||||
|
||||
// Test sync & open iOS functionality - the button contains "Sync & Open iOS"
|
||||
const iosButton = po.page.getByRole("button", { name: /Sync & Open iOS/i });
|
||||
await iosButton.click();
|
||||
|
||||
// In test mode, this should complete without error and return to idle state
|
||||
// Wait for the button to be enabled again (not in loading state)
|
||||
await po.page
|
||||
.getByText("Sync & Open iOS")
|
||||
.waitFor({ state: "visible", timeout: Timeout.LONG });
|
||||
|
||||
// Test sync & open Android functionality - the button contains "Sync & Open Android"
|
||||
const androidButton = po.page.getByRole("button", {
|
||||
name: /Sync & Open Android/i,
|
||||
});
|
||||
await androidButton.click();
|
||||
|
||||
// In test mode, this should complete without error and return to idle state
|
||||
// Wait for the button to be enabled again (not in loading state)
|
||||
await po.page
|
||||
.getByText("Sync & Open Android")
|
||||
.waitFor({ state: "visible", timeout: Timeout.LONG });
|
||||
});
|
||||
@@ -286,6 +286,11 @@ export class PageObject {
|
||||
}
|
||||
|
||||
async snapshotAppFiles({ name }: { name?: string } = {}) {
|
||||
const currentAppName = await this.getCurrentAppName();
|
||||
if (!currentAppName) {
|
||||
throw new Error("No app selected");
|
||||
}
|
||||
const normalizedAppName = currentAppName.toLowerCase().replace(/-/g, "");
|
||||
const appPath = await this.getCurrentAppPath();
|
||||
if (!appPath || !fs.existsSync(appPath)) {
|
||||
throw new Error(`App path does not exist: ${appPath}`);
|
||||
@@ -298,7 +303,14 @@ export class PageObject {
|
||||
filesData.sort((a, b) => a.relativePath.localeCompare(b.relativePath));
|
||||
|
||||
const snapshotContent = filesData
|
||||
.map((file) => `=== ${file.relativePath} ===\n${file.content}`)
|
||||
.map(
|
||||
(file) =>
|
||||
`=== ${file.relativePath.replace(normalizedAppName, "[[normalizedAppName]]")} ===\n${file.content
|
||||
.split(normalizedAppName)
|
||||
.join("[[normalizedAppName]]")
|
||||
.split(currentAppName)
|
||||
.join("[[appName]]")}`,
|
||||
)
|
||||
.join("\n\n");
|
||||
|
||||
if (name) {
|
||||
@@ -643,7 +655,7 @@ export class PageObject {
|
||||
|
||||
async expectNoAppUpgrades() {
|
||||
await expect(this.page.getByTestId("no-app-upgrades-needed")).toBeVisible({
|
||||
timeout: Timeout.MEDIUM,
|
||||
timeout: Timeout.LONG,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
7821
e2e-tests/snapshots/capacitor.spec.ts_upgraded-capacitor.txt
Normal file
7821
e2e-tests/snapshots/capacitor.spec.ts_upgraded-capacitor.txt
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user