Files
threshold-ui/e2e-tests/desktop/tests/targets.spec.js
T
Zhihe Li 7c1814118d refactor: 💡 Move e2e tests to new folder (#2546)
* refactor: 💡 Move e2e tests to new folder

* refactor: 💡 Convert desktop tests to mjs and use es6 imports

* refactor: 💡 Use module setting for e2e directory and remove mjs

* refactor: 💡 Remove "e2e" in all scripts in package.json
2024-11-12 11:21:37 -05:00

37 lines
1.1 KiB
JavaScript

/**
* Copyright (c) HashiCorp, Inc.
* SPDX-License-Identifier: BUSL-1.1
*/
import { expect, test } from '../fixtures/baseTest.js';
test.describe('Targets test', async () => {
test('Connects to a target and ends session', async ({ authedPage }) => {
await authedPage
.getByRole('link', { name: 'Generated target with a direct address' })
.click();
await authedPage.getByRole('button', { name: 'Connect' }).click();
await expect(authedPage).toHaveURL(
/.*\/scopes\/global\/projects\/sessions/,
);
await authedPage.getByRole('button', { name: 'End Session' }).click();
await expect(authedPage.getByText('Canceled successfully.')).toBeVisible();
await expect(authedPage).toHaveURL(
/.*\/scopes\/global\/projects\/targets$/,
);
});
test('Searches targets correctly', async ({ authedPage }) => {
await authedPage.getByLabel('Search').fill('hashicorp');
// One row is the header
await expect(authedPage.getByRole('row')).toHaveCount(2);
await expect(
authedPage.getByRole('link', { name: 'www.hashicorp.com' }),
).toBeVisible();
});
});