mirror of
https://github.com/ivabus/gui
synced 2025-04-23 14:07:14 +03:00
e2e: install specific version and update to latest (#611)
* e2e: install specific version and update to latest * bump v0.2.14 --------- Co-authored-by: neil molina <neil@neils-MacBook-Pro.local>
This commit is contained in:
parent
ce05f68e20
commit
33d7bc3758
4 changed files with 81 additions and 22 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "tea",
|
"name": "tea",
|
||||||
"version": "0.2.13",
|
"version": "0.2.14",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "tea gui app",
|
"description": "tea gui app",
|
||||||
"author": "tea.xyz",
|
"author": "tea.xyz",
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
data-testid="menu-button-{label.replaceAll(' ', '-').toLowerCase()}"
|
||||||
on:click
|
on:click
|
||||||
class="box-border flex w-full items-center gap-2 rounded-sm px-1 text-left align-middle text-xs outline-1 outline-gray transition-all hover:bg-gray hover:bg-opacity-25 hover:outline"
|
class="box-border flex w-full items-center gap-2 rounded-sm px-1 text-left align-middle text-xs outline-1 outline-gray transition-all hover:bg-gray hover:bg-opacity-25 hover:outline"
|
||||||
class:active
|
class:active
|
||||||
|
|
|
@ -42,22 +42,12 @@ describe("basic smoke test", () => {
|
||||||
).toExist();
|
).toExist();
|
||||||
await expect(await screen.findByRole("button", { name: "OPEN IN TERMINAL" })).toExist();
|
await expect(await screen.findByRole("button", { name: "OPEN IN TERMINAL" })).toExist();
|
||||||
|
|
||||||
const closeNotificationBtn = $(".close-notification");
|
await utils.closeNotification();
|
||||||
await expect(closeNotificationBtn).toExist();
|
|
||||||
await closeNotificationBtn.click();
|
|
||||||
await expect(closeNotificationBtn).not.toExist();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("search and install create-dmg", async () => {
|
it("search and install create-dmg", async () => {
|
||||||
const { screen } = utils!;
|
const { screen, searchTerm } = utils!;
|
||||||
|
await searchTerm("create-dmg");
|
||||||
const fakeInput = await screen.findByTestId("topbar-search-input");
|
|
||||||
await fakeInput.click();
|
|
||||||
|
|
||||||
await (await screen.findByTestId("search-popup")).waitForExist();
|
|
||||||
|
|
||||||
const searchInput = await screen.findByTestId("search-input-popup");
|
|
||||||
await searchInput.setValue("create-dmg");
|
|
||||||
|
|
||||||
const packageFullname = "github.com/create-dmg/create-dmg";
|
const packageFullname = "github.com/create-dmg/create-dmg";
|
||||||
const createDmgSlug = packageFullname.replace(/[^\w\s]/gi, "_").toLocaleLowerCase();
|
const createDmgSlug = packageFullname.replace(/[^\w\s]/gi, "_").toLocaleLowerCase();
|
||||||
|
@ -78,9 +68,53 @@ describe("basic smoke test", () => {
|
||||||
)
|
)
|
||||||
).toExist();
|
).toExist();
|
||||||
|
|
||||||
const closeNotificationBtn = $(".close-notification");
|
await utils.closeNotification();
|
||||||
await expect(closeNotificationBtn).toExist();
|
});
|
||||||
await closeNotificationBtn.click();
|
|
||||||
await expect(closeNotificationBtn).not.toExist();
|
it("should be able to install specific version", async () => {
|
||||||
|
const { screen, searchTerm } = utils!;
|
||||||
|
await searchTerm("pnpm.io");
|
||||||
|
const pnpmCard = await utils.findSearchPackageCardBySlug("pnpm_io");
|
||||||
|
await expect(pnpmCard).toExist();
|
||||||
|
pnpmCard.click();
|
||||||
|
|
||||||
|
await utils.uninstallPackageIfNeeded();
|
||||||
|
|
||||||
|
await utils.installSpecificVersion("8.0.0");
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
await screen.findByText(
|
||||||
|
/^Package pnpm.io .* has been installed./,
|
||||||
|
{},
|
||||||
|
{ timeout: 60000, interval: 1000 }
|
||||||
|
)
|
||||||
|
).toExist();
|
||||||
|
|
||||||
|
await utils.closeNotification();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should be able to update a package", async () => {
|
||||||
|
// this requires ^ to succeed first
|
||||||
|
const { screen } = utils!;
|
||||||
|
const menuBtn = await screen.findByTestId("menu-button-updates-available");
|
||||||
|
menuBtn.click();
|
||||||
|
|
||||||
|
const header = await screen.findByText("available updates");
|
||||||
|
await expect(header).toExist();
|
||||||
|
|
||||||
|
const updateBtn = await screen.findByTestId("install-button-pnpm_io");
|
||||||
|
await expect(updateBtn).toExist();
|
||||||
|
|
||||||
|
updateBtn.click();
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
await screen.findByText(
|
||||||
|
/^Package pnpm.io .* has been installed./,
|
||||||
|
{},
|
||||||
|
{ timeout: 60000, interval: 1000 }
|
||||||
|
)
|
||||||
|
).toExist();
|
||||||
|
|
||||||
|
await utils.closeNotification();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -51,12 +51,16 @@ export function setupUtils(browser: WebdriverIO.Browser) {
|
||||||
};
|
};
|
||||||
|
|
||||||
const installLatestVersion = async () => {
|
const installLatestVersion = async () => {
|
||||||
|
await installSpecificVersion("latest");
|
||||||
|
};
|
||||||
|
|
||||||
|
const installSpecificVersion = async (version: string) => {
|
||||||
const installButton = await findButton(/^INSTALL |^UPDATE/);
|
const installButton = await findButton(/^INSTALL |^UPDATE/);
|
||||||
installButton.click();
|
installButton.click();
|
||||||
|
|
||||||
const latestButton = await screen.findByTestId("install-latest");
|
const versionButton = await screen.findByTestId(`install-${version}`);
|
||||||
await latestButton.waitForExist();
|
await versionButton.waitForExist();
|
||||||
latestButton.click();
|
versionButton.click();
|
||||||
};
|
};
|
||||||
|
|
||||||
const goHome = async () => {
|
const goHome = async () => {
|
||||||
|
@ -67,15 +71,35 @@ export function setupUtils(browser: WebdriverIO.Browser) {
|
||||||
await homeMenu.waitForExist();
|
await homeMenu.waitForExist();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const searchTerm = async (term: string) => {
|
||||||
|
const fakeInput = await screen.findByTestId("topbar-search-input");
|
||||||
|
await fakeInput.click();
|
||||||
|
|
||||||
|
await (await screen.findByTestId("search-popup")).waitForExist();
|
||||||
|
|
||||||
|
const searchInput = await screen.findByTestId("search-input-popup");
|
||||||
|
await searchInput.setValue(term);
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeNotification = async () => {
|
||||||
|
const closeNotificationBtn = $(".close-notification");
|
||||||
|
await expect(closeNotificationBtn).toExist();
|
||||||
|
await closeNotificationBtn.click();
|
||||||
|
await expect(closeNotificationBtn).not.toExist();
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
screen,
|
screen,
|
||||||
|
searchTerm,
|
||||||
goHome,
|
goHome,
|
||||||
findButton,
|
findButton,
|
||||||
findPackageCardBySlug,
|
findPackageCardBySlug,
|
||||||
findSearchPackageCardBySlug,
|
findSearchPackageCardBySlug,
|
||||||
packageDetailsLoaded,
|
packageDetailsLoaded,
|
||||||
uninstallPackageIfNeeded,
|
uninstallPackageIfNeeded,
|
||||||
installLatestVersion
|
installLatestVersion,
|
||||||
|
installSpecificVersion,
|
||||||
|
closeNotification
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue