mirror of
https://github.com/ivabus/gui
synced 2025-04-23 05:57:11 +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",
|
||||
"version": "0.2.13",
|
||||
"version": "0.2.14",
|
||||
"private": true,
|
||||
"description": "tea gui app",
|
||||
"author": "tea.xyz",
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
</script>
|
||||
|
||||
<button
|
||||
data-testid="menu-button-{label.replaceAll(' ', '-').toLowerCase()}"
|
||||
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:active
|
||||
|
|
|
@ -42,22 +42,12 @@ describe("basic smoke test", () => {
|
|||
).toExist();
|
||||
await expect(await screen.findByRole("button", { name: "OPEN IN TERMINAL" })).toExist();
|
||||
|
||||
const closeNotificationBtn = $(".close-notification");
|
||||
await expect(closeNotificationBtn).toExist();
|
||||
await closeNotificationBtn.click();
|
||||
await expect(closeNotificationBtn).not.toExist();
|
||||
await utils.closeNotification();
|
||||
});
|
||||
|
||||
it("search and install create-dmg", async () => {
|
||||
const { screen } = utils!;
|
||||
|
||||
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 { screen, searchTerm } = utils!;
|
||||
await searchTerm("create-dmg");
|
||||
|
||||
const packageFullname = "github.com/create-dmg/create-dmg";
|
||||
const createDmgSlug = packageFullname.replace(/[^\w\s]/gi, "_").toLocaleLowerCase();
|
||||
|
@ -78,9 +68,53 @@ describe("basic smoke test", () => {
|
|||
)
|
||||
).toExist();
|
||||
|
||||
const closeNotificationBtn = $(".close-notification");
|
||||
await expect(closeNotificationBtn).toExist();
|
||||
await closeNotificationBtn.click();
|
||||
await expect(closeNotificationBtn).not.toExist();
|
||||
await utils.closeNotification();
|
||||
});
|
||||
|
||||
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 () => {
|
||||
await installSpecificVersion("latest");
|
||||
};
|
||||
|
||||
const installSpecificVersion = async (version: string) => {
|
||||
const installButton = await findButton(/^INSTALL |^UPDATE/);
|
||||
installButton.click();
|
||||
|
||||
const latestButton = await screen.findByTestId("install-latest");
|
||||
await latestButton.waitForExist();
|
||||
latestButton.click();
|
||||
const versionButton = await screen.findByTestId(`install-${version}`);
|
||||
await versionButton.waitForExist();
|
||||
versionButton.click();
|
||||
};
|
||||
|
||||
const goHome = async () => {
|
||||
|
@ -67,15 +71,35 @@ export function setupUtils(browser: WebdriverIO.Browser) {
|
|||
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 {
|
||||
screen,
|
||||
searchTerm,
|
||||
goHome,
|
||||
findButton,
|
||||
findPackageCardBySlug,
|
||||
findSearchPackageCardBySlug,
|
||||
packageDetailsLoaded,
|
||||
uninstallPackageIfNeeded,
|
||||
installLatestVersion
|
||||
installLatestVersion,
|
||||
installSpecificVersion,
|
||||
closeNotification
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue