-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Nkeiruka <[email protected]>
- Loading branch information
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Page } from "@playwright/test"; | ||
import { expect } from "../fixtures/lxd-test"; | ||
|
||
export const validateOperation = async ( | ||
page: Page, | ||
title: string, | ||
instance: string, | ||
) => { | ||
await expect( | ||
page.getByLabel("Action", { exact: true }).getByText(title + instance), | ||
).toBeVisible(); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { test } from "./fixtures/lxd-test"; | ||
import { | ||
createInstance, | ||
deleteInstance, | ||
randomInstanceName, | ||
visitAndStartInstance, | ||
visitAndStopInstance, | ||
} from "./helpers/instances"; | ||
import { assertTextVisible } from "./helpers/permissions"; | ||
import { | ||
checkNotificationExists, | ||
dismissNotification, | ||
} from "./helpers/notification"; | ||
import { validateOperation } from "./helpers/operations"; | ||
|
||
test("instance operations are recognised on the Operations page", async ({ | ||
page, | ||
}) => { | ||
const instance = randomInstanceName(); | ||
await createInstance(page, instance); | ||
|
||
// validate create operation is in operation list | ||
await page.goto("/ui/operations"); | ||
await validateOperation(page, "Creating Instance", instance); | ||
|
||
// start instance and wait for the notification instance was started | ||
await visitAndStartInstance(page, instance); | ||
await checkNotificationExists(page); | ||
await assertTextVisible(page, "Instance " + instance + " started"); | ||
|
||
// click on the “x operations” link in the status bar | ||
await dismissNotification(page); | ||
|
||
// validate the operation to start the instance is in the operation list | ||
await page.goto("/ui/operations"); | ||
await validateOperation(page, "Starting Instance", instance); | ||
|
||
// stop instance and validate stop operation is in operation list | ||
await visitAndStopInstance(page, instance); | ||
await page.goto("/ui/operations"); | ||
await validateOperation(page, "Stopping Instance", instance); | ||
|
||
// delete instance and validate delete operation is in operation list | ||
await deleteInstance(page, instance); | ||
await page.goto("/ui/operations"); | ||
await validateOperation(page, "Deleting Instance", instance); | ||
}); |