mirror of
https://github.com/dotnetcore/AgileConfig.git
synced 2026-10-16 20:21:29 +08:00
fix: stabilize browser e2e setup
This commit is contained in:
@@ -29,7 +29,7 @@ jobs:
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- run: npx playwright install --with-deps chromium
|
||||
- run: npm run test:e2e
|
||||
- run: E2E_SKIP_UI_BUILD=true npm run test:e2e
|
||||
build-dotnet:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ jobs:
|
||||
- run: npm install
|
||||
- run: npm run build
|
||||
- run: npx playwright install --with-deps chromium
|
||||
- run: npm run test:e2e
|
||||
- run: E2E_SKIP_UI_BUILD=true npm run test:e2e
|
||||
build-dotnet:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ function run(command, args, cwd) {
|
||||
execFileSync(command, args, { cwd, stdio: 'inherit', shell: process.platform === 'win32' });
|
||||
}
|
||||
|
||||
if (!existsSync(uiSource)) {
|
||||
if (!process.env.E2E_SKIP_UI_BUILD || !existsSync(uiSource)) {
|
||||
run('npm', ['run', 'build'], frontendRoot);
|
||||
}
|
||||
run('dotnet', ['build', apiProject, '-c', 'Release', '--nologo'], repositoryRoot);
|
||||
|
||||
@@ -7,31 +7,41 @@ test('an administrator can publish a configuration from the hosted management UI
|
||||
const key = `e2e.key.${suffix}`;
|
||||
const value = `value-${suffix}`;
|
||||
|
||||
const login = await request.post('/admin/jwt/login', {
|
||||
data: { userName: 'admin', password: 'e2e-admin-password' },
|
||||
});
|
||||
await expect(login).toBeOK();
|
||||
const { token } = await login.json();
|
||||
const addNode = await request.post('/ServerNode/Add', {
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
data: { address: 'http://127.0.0.1:5187', remark: 'E2E local node' },
|
||||
});
|
||||
await expect(addNode).toBeOK();
|
||||
|
||||
await page.goto('/ui#/user/login');
|
||||
await page.getByRole('textbox', { name: 'Username', exact: true }).fill('admin');
|
||||
await page.getByRole('textbox', { name: 'Password', exact: true }).fill('e2e-admin-password');
|
||||
await page.getByRole('button', { name: 'Login', exact: true }).click();
|
||||
await expect(page).toHaveURL(/#\/home$/);
|
||||
await page.getByRole('button', { name: 'Add Now', exact: true }).click();
|
||||
|
||||
await page.goto('/ui#/app');
|
||||
await page.getByRole('button', { name: /Create$/ }).click();
|
||||
await page.getByTestId('app-create').click();
|
||||
const applicationDialog = page.getByRole('dialog');
|
||||
await applicationDialog.getByLabel('Name').fill(appName);
|
||||
await applicationDialog.getByLabel('AppID').fill(appId);
|
||||
await applicationDialog.getByLabel('Secret').fill('e2e-app-secret');
|
||||
await applicationDialog.locator('#app-create-name').fill(appName);
|
||||
await applicationDialog.locator('#app-create-id').fill(appId);
|
||||
await applicationDialog.locator('#app-create-secret').fill('e2e-app-secret');
|
||||
await applicationDialog.getByRole('button', { name: 'Submit', exact: true }).click();
|
||||
await expect(page.getByText(appId, { exact: true })).toBeVisible();
|
||||
|
||||
await page.goto(`/ui#/app/config/${appId}/${encodeURIComponent(appName)}`);
|
||||
await page.getByRole('button', { name: /Add$/ }).click();
|
||||
await page.getByTestId('config-create').click();
|
||||
const configurationDialog = page.getByRole('dialog');
|
||||
await configurationDialog.getByLabel('Key').fill(key);
|
||||
await configurationDialog.getByLabel('Value').fill(value);
|
||||
await configurationDialog.locator('#config-create-key').fill(key);
|
||||
await configurationDialog.locator('#config-create-value').fill(value);
|
||||
await configurationDialog.getByRole('button', { name: 'Submit', exact: true }).click();
|
||||
await expect(page.getByText(key, { exact: true })).toBeVisible();
|
||||
|
||||
await page.getByRole('button', { name: /Publish All$/ }).click();
|
||||
await page.getByTestId('config-publish-all').click();
|
||||
const publishDialog = page.getByRole('dialog');
|
||||
await publishDialog.getByRole('button', { name: 'OK', exact: true }).click();
|
||||
await expect(page.getByText('Publish Success!', { exact: true })).toBeVisible();
|
||||
|
||||
@@ -521,6 +521,7 @@ const appList: React.FC = (props) => {
|
||||
<AuthorizedEle key="0" judgeKey={functionKeys.App_Add}>
|
||||
<Button
|
||||
key="button"
|
||||
data-testid="app-create"
|
||||
icon={<PlusOutlined />}
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
@@ -585,6 +586,7 @@ const appList: React.FC = (props) => {
|
||||
}}
|
||||
>
|
||||
<ProFormText
|
||||
fieldProps={{ id: 'app-create-name' }}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
@@ -596,6 +598,7 @@ const appList: React.FC = (props) => {
|
||||
name="name"
|
||||
/>
|
||||
<ProFormText
|
||||
fieldProps={{ id: 'app-create-id' }}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
@@ -607,6 +610,7 @@ const appList: React.FC = (props) => {
|
||||
name="id"
|
||||
/>
|
||||
<ProFormText.Password
|
||||
fieldProps={{ id: 'app-create-secret' }}
|
||||
rules={[{}]}
|
||||
label={intl.formatMessage({
|
||||
id: 'pages.app.form.secret',
|
||||
|
||||
@@ -511,13 +511,14 @@ const configs: React.FC<ConfigsProps> = (props) => {
|
||||
}
|
||||
toolBarRender={() => [
|
||||
<RequireFunction fn={functionKeys.Config_Add} key="add" fallback={null} appId={appId}>
|
||||
<Button type="primary" icon={<PlusOutlined />} onClick={() => { setCreateModalVisible(true); }}>
|
||||
<Button data-testid="config-create" type="primary" icon={<PlusOutlined />} onClick={() => { setCreateModalVisible(true); }}>
|
||||
{intl.formatMessage({ id: 'pages.configs.table.cols.action.add' })}
|
||||
</Button>
|
||||
</RequireFunction>
|
||||
,
|
||||
<RequireFunction fn={functionKeys.Config_Publish} key="publish" fallback={null} appId={appId}>
|
||||
<Button
|
||||
data-testid="config-publish-all"
|
||||
icon={<VerticalAlignTopOutlined />}
|
||||
type="primary"
|
||||
className="success"
|
||||
@@ -761,6 +762,7 @@ const configs: React.FC<ConfigsProps> = (props) => {
|
||||
name="group"
|
||||
/>
|
||||
<ProFormText
|
||||
fieldProps={{ id: 'config-create-key' }}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
@@ -779,6 +781,7 @@ const configs: React.FC<ConfigsProps> = (props) => {
|
||||
name="value"
|
||||
fieldProps={
|
||||
{
|
||||
id: 'config-create-value',
|
||||
autoSize: {
|
||||
minRows: 3, maxRows: 12
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user