* Refactor: Rose::Page::Layout - header, actions and breadcrumbs (#2813) * refactor: 💡 page::layout- header,breadcrumb and actions * refactor: 💡 added new class for the page layout, fixed a11y * refactor: 💡 addressed comments * refactor: 💡 moved copy snippet to PH.Generic * refactor: 💡 addressed comments * Refactor: Rose::Page::Layout - header, actions and breadcrumbs Part 2 (#2825) * refactor: 💡 rose page layout header * refactor: 💡 removed extra classes * Refactor: Rose::Page::Layout - header, actions and breadcrumbs Final Part (#2840) * refactor: 💡 rose page layout header * Refactor: Rose::Page::Layout - header, actions and breadcrumbs (#2813) * refactor: 💡 page::layout- header,breadcrumb and actions * refactor: 💡 added new class for the page layout, fixed a11y * refactor: 💡 addressed comments * refactor: 💡 moved copy snippet to PH.Generic * refactor: 💡 addressed comments * Refactor: Rose::Page::Layout - header, actions and breadcrumbs Part 2 (#2825) * refactor: 💡 rose page layout header * refactor: 💡 removed extra classes * refactor: 💡 fixed a11y heading, actions dropdown * refactor: 💡 fixed page header * refactor: 💡 fix heading margin and failing tests * refactor: 💡 add back margin for hds header tags * refactor: 💡 fix style
82 lines
2.5 KiB
JavaScript
82 lines
2.5 KiB
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { expect, test } from '../fixtures/baseTest.js';
|
|
import LoginPage from '../pages/loginPage.js';
|
|
|
|
test.describe('user/password authentication tests', () => {
|
|
test('Authenticates and signs out', async ({
|
|
electronPage,
|
|
clusterUrl,
|
|
username,
|
|
password,
|
|
}) => {
|
|
const loginPage = new LoginPage(electronPage);
|
|
await loginPage.setClusterUrl(clusterUrl);
|
|
await loginPage.logInWithPassword(username, password);
|
|
|
|
await expect(electronPage).toHaveURL(
|
|
/.*\/scopes\/global\/projects\/targets$/,
|
|
);
|
|
|
|
// click dropdown
|
|
await electronPage.getByRole('button', { name: 'admin' }).click();
|
|
|
|
await electronPage.getByRole('button', { name: 'Sign Out' }).click();
|
|
await expect(electronPage).toHaveURL(/.*\/scopes\/global\/authenticate\//);
|
|
});
|
|
test('Fails to authenticate with wrong password', async ({
|
|
electronPage,
|
|
clusterUrl,
|
|
username,
|
|
}) => {
|
|
const loginPage = new LoginPage(electronPage);
|
|
await loginPage.setClusterUrl(clusterUrl);
|
|
await loginPage.logInWithPassword(username, 'wrong password!!');
|
|
|
|
await expect(electronPage).toHaveURL(/.*\/scopes\/global\/authenticate\//);
|
|
await expect(electronPage.getByText('Authentication Failed')).toBeVisible();
|
|
});
|
|
});
|
|
|
|
// Setup an LDAP server for these tests
|
|
test.fixme('LDAP authentication tests', async () => {
|
|
test('Authenticates and signs out', async ({
|
|
electronPage,
|
|
clusterUrl,
|
|
username,
|
|
password,
|
|
}) => {
|
|
const loginPage = new LoginPage(electronPage);
|
|
await loginPage.setClusterUrl(clusterUrl);
|
|
await loginPage.logInWithLDAP(username, password);
|
|
|
|
await expect(electronPage).toHaveURL(
|
|
/.*\/scopes\/global\/projects\/targets$/,
|
|
);
|
|
|
|
await electronPage
|
|
.locator('details')
|
|
.filter({ hasText: 'Sign Out' })
|
|
.click();
|
|
|
|
await electronPage.getByRole('button', { name: 'Sign Out' }).click();
|
|
await expect(electronPage).toHaveURL(/.*\/scopes\/global\/authenticate\//);
|
|
});
|
|
|
|
test('Fails to authenticate with wrong password', async ({
|
|
electronPage,
|
|
clusterUrl,
|
|
username,
|
|
}) => {
|
|
const loginPage = new LoginPage(electronPage);
|
|
await loginPage.setClusterUrl(clusterUrl);
|
|
await loginPage.logInWithLDAP(username, 'wrong password!!');
|
|
|
|
await expect(electronPage).toHaveURL(/.*\/scopes\/global\/authenticate\//);
|
|
await expect(electronPage.getByText('Authentication Failed')).toBeVisible();
|
|
});
|
|
});
|