-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #496 from yast/playwright_fixes
Test fixes, improved Playwright tests
- Loading branch information
Showing
6 changed files
with
131 additions
and
9 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
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
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
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,15 @@ | ||
// shared functions | ||
|
||
// return the URL path to the installer plugin | ||
function mainPagePath():string { | ||
let baseURL = new URL(process.env.BASE_URL || "http://localhost:9090"); | ||
|
||
// when running at the default cockpit port use the full cockpit path, | ||
// otherwise expect the webpack development server where the installer | ||
// is available at the root path | ||
return (baseURL.port == "9090") ? "/cockpit/@localhost/d-installer/index.html" : "/"; | ||
} | ||
|
||
export { | ||
mainPagePath | ||
}; |
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
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 |
---|---|---|
@@ -1,24 +1,38 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { mainPagePath } from "../lib/installer"; | ||
|
||
test.describe('The user section', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await page.goto('/cockpit/@localhost/d-installer/index.html'); | ||
await page.goto(mainPagePath()); | ||
}); | ||
|
||
test('can set the root password', async ({ page }) => { | ||
// See https://playwright.dev/docs/selectors#text-selector | ||
// click the button | ||
await page.locator('text=Root password is not set').locator('button').click(); | ||
// See https://playwright.dev/docs/api/class-locator | ||
|
||
// initial expectation - the root password is not configured yet | ||
await expect(page.getByText("None authentication method defined for root user")).toBeVisible(); | ||
|
||
// click the "Users" header | ||
await page.locator("a[href='#/users']").click(); | ||
|
||
// display the actions menu for the root password | ||
await page.locator("#actions-for-root-password").click(); | ||
|
||
// click the "Set" item | ||
await page.getByRole("menuitem", { name: "Set" }).click(); | ||
|
||
// fill a new password | ||
await page.locator('#password').fill('d-installer'); | ||
await page.locator('#passwordConfirmation').fill('d-installer'); | ||
await page.locator('button[type="submit"]').click(); | ||
|
||
// wait until the dialog is closed | ||
await expect(page.locator('[role="dialog"]')).toHaveCount(0); | ||
// wait until the popup is closed | ||
await expect(page.locator('[role="dialog"]')).not.toBeVisible(); | ||
|
||
// go back to the main page | ||
await page.getByText('Back').click(); | ||
|
||
// check the summary text | ||
await expect(page.locator('text=Root password is set')).toHaveCount(1); | ||
await expect(page.getByText("Root authentication set")).toBeVisible(); | ||
}); | ||
}) |