Skip to content

Commit 9f82ec0

Browse files
authored
Merge pull request #7 from net0well/fase-6/correcoes
fix: CI estável e correções do painel pós-fase 6 (spec 008)
2 parents b2e1856 + 19a02f8 commit 9f82ec0

22 files changed

Lines changed: 172 additions & 19 deletions

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ jobs:
6262
# Testcontainers (Docker); GitHub's Windows runners cannot run Linux containers, so Windows runs the Core tests only.
6363
- name: Test
6464
if: runner.os == 'Linux'
65-
run: dotnet test --no-build --configuration Release
65+
run: dotnet test --no-build --configuration Release --solution tests/PythonScriptRunner.SemE2E.slnf
66+
67+
# The panel E2E tests run alone: containers starting or stopping in the other test projects change the host's network
68+
# interfaces, and Chromium then aborts requests in flight with ERR_NETWORK_CHANGED.
69+
- name: Test (panel E2E)
70+
if: runner.os == 'Linux'
71+
run: dotnet test --no-build --configuration Release --project tests/PythonScriptRunner.Panel.E2E.Tests
6672

6773
- name: Upload Playwright traces
6874
if: failure() && runner.os == 'Linux'

‎README.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,13 @@ dotnet test --project tests/PythonScriptRunner.Panel.E2E.Tests --no-build # PS
283283
```
284284

285285
Quando um teste falha, o *trace* do Playwright fica em `TestResults/traces` ao lado do assembly de testes
286-
(`npx playwright show-trace <arquivo>.zip`).
286+
(`npx playwright show-trace <arquivo>.zip`). Rode o E2E sozinho: contêineres subindo ou parando em outros projetos de
287+
teste mudam as interfaces de rede e o Chromium aborta requisições com `ERR_NETWORK_CHANGED`. Para todo o resto de uma vez,
288+
use o filtro de solução sem o E2E (é o que o CI faz):
289+
290+
```bash
291+
dotnet test --solution tests/PythonScriptRunner.SemE2E.slnf
292+
```
287293

288294
O teste de desempenho do painel usa ~200 mil execuções; `PSR_PERF_RUNS_PER_DAY=50000` roda o volume médio completo (90 dias).
289295
O documento OpenAPI do painel é comparado com `tests/PythonScriptRunner.Dashboard.Tests/Snapshots/openapi-v1.verified.json`;

‎panel/scripts/check-bundle.mjs‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Orçamento do bundle inicial (spec 008): ≤ 500 KB gzip para os arquivos que index.html carrega.
22
// Monaco e Vue Flow ficam em chunks carregados sob demanda e não entram na conta.
3-
import { readFile } from 'node:fs/promises'
3+
import { readdir, readFile } from 'node:fs/promises'
44
import { gzipSync } from 'node:zlib'
55
import { fileURLToPath } from 'node:url'
66

@@ -20,3 +20,12 @@ if (total > limit) {
2020
console.error('O bundle inicial passou do orçamento da spec 008.')
2121
process.exit(1)
2222
}
23+
24+
// A CSP do painel só aceita `data:` em imagens: uma fonte embutida seria bloqueada pelo navegador.
25+
const css = (await readdir(`${dist}assets`)).filter((f) => f.endsWith('.css'))
26+
for (const file of css) {
27+
if ((await readFile(`${dist}assets/${file}`, 'utf8')).includes('url(data:font/')) {
28+
console.error(`assets/${file} embute uma fonte como data:, que a CSP do painel bloqueia.`)
29+
process.exit(1)
30+
}
31+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { mount } from '@vue/test-utils'
2+
import { createPinia, setActivePinia } from 'pinia'
3+
import { beforeEach, describe, expect, it } from 'vitest'
4+
import LoginForm from './LoginForm.vue'
5+
6+
describe('Formulário de login fixo', () => {
7+
beforeEach(() => setActivePinia(createPinia()))
8+
9+
it('Spec008_AC17 na página o usuário já recebe o foco ao montar (quem digita logo não perde a senha)', () => {
10+
const wrapper = mount(LoginForm, { attachTo: document.body })
11+
12+
expect(document.activeElement).toBe(wrapper.find('input[name=name]').element)
13+
wrapper.unmount()
14+
})
15+
16+
it('Spec008_AC19 com o usuário travado (sessão expirada) o campo de usuário não toma o foco', () => {
17+
const wrapper = mount(LoginForm, { attachTo: document.body, props: { lockedName: 'ana' } })
18+
19+
expect(document.activeElement).not.toBe(wrapper.find('input[name=name]').element)
20+
expect(wrapper.find('input[name=name]').attributes('readonly')).toBeDefined()
21+
wrapper.unmount()
22+
})
23+
})

‎panel/src/components/auth/LoginForm.vue‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script setup lang="ts">
2-
import { computed, onBeforeUnmount, ref } from 'vue'
2+
import { computed, onBeforeUnmount, onMounted, ref } from 'vue'
33
import { useI18n } from 'vue-i18n'
4+
import type { VTextField } from 'vuetify/components'
45
import { useSession } from '@/stores/session'
56
67
/** Login fixo (D-129): nome + senha; erro genérico (D-135) e contagem regressiva no 429 (D-146). */
@@ -14,6 +15,7 @@ const password = ref('')
1415
const busy = ref(false)
1516
const invalid = ref(false)
1617
const wait = ref(0)
18+
const nameField = ref<VTextField | null>(null)
1719
let timer: ReturnType<typeof setInterval> | null = null
1820
1921
const canSubmit = computed(() => !busy.value && wait.value === 0 && name.value.trim() !== '' && password.value !== '')
@@ -56,6 +58,14 @@ async function submit() {
5658
}
5759
}
5860
61+
// Na página o foco vai ao usuário já ao montar: o autofocus do Vuetify espera ~50 ms e tiraria o foco de quem já começou a
62+
// digitar. No diálogo de sessão expirada (usuário travado) fica o autofocus da senha, que espera a transição do diálogo.
63+
onMounted(() => {
64+
if (!props.lockedName) {
65+
nameField.value?.focus()
66+
}
67+
})
68+
5969
onBeforeUnmount(() => timer && clearInterval(timer))
6070
</script>
6171

@@ -76,13 +86,13 @@ onBeforeUnmount(() => timer && clearInterval(timer))
7686
{{ t('auth.login.throttled', { seconds: wait }) }}
7787
</v-alert>
7888
<v-text-field
89+
ref="nameField"
7990
v-model="name"
8091
:label="t('auth.login.name')"
8192
autocomplete="username"
8293
:readonly="Boolean(lockedName)"
8394
prepend-inner-icon="mdi-account"
8495
name="name"
85-
autofocus
8696
/>
8797
<v-text-field
8898
v-model="password"

‎panel/src/components/fields/FieldBuilder.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ function setColumn(index: number, field: FieldDefinition, column: number, change
132132
</div>
133133
</v-expansion-panel-title>
134134
<v-expansion-panel-text>
135-
<v-row dense>
135+
<v-row density="compact">
136136
<v-col cols="12" md="5">
137137
<v-text-field
138138
:model-value="field.name"

‎panel/src/components/flow/FlowCanvas.vue‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,13 @@ function connectStart(params: { event?: MouseEvent | TouchEvent } & OnConnectSta
6666
}
6767
}
6868
69-
function isValidConnection(connection: Connection): boolean {
69+
function isValidConnection(connection: Connection | Edge): boolean {
70+
// O Vue Flow também valida as arestas recebidas por props (elas têm id); essas vêm do modelo, que já é válido, e
71+
// "ligar numa saída existente" só é proibido para uma conexão nova (sem isso, Organizar sumia com as saídas).
72+
if ('id' in connection) {
73+
return true
74+
}
75+
7076
return (
7177
props.editable &&
7278
Boolean(connection.sourceHandle && connection.targetHandle) &&

‎panel/src/components/flow/flow.css‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,34 @@ button.step-node__port-label {
120120
cursor: not-allowed;
121121
}
122122

123+
/* Controles e minimapa seguem o tema do painel: os estilos do Vue Flow têm cores claras fixas. */
124+
.flow-canvas .vue-flow__controls {
125+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
126+
}
127+
128+
.flow-canvas .vue-flow__controls-button {
129+
background: rgb(var(--v-theme-surface));
130+
color: rgb(var(--v-theme-on-surface));
131+
border-bottom: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
132+
}
133+
134+
.flow-canvas .vue-flow__controls-button:hover {
135+
background: rgba(var(--v-theme-on-surface), 0.08);
136+
}
137+
138+
.flow-canvas .vue-flow__minimap {
139+
background-color: rgb(var(--v-theme-surface));
140+
border: 1px solid rgba(var(--v-border-color), var(--v-border-opacity));
141+
}
142+
143+
.flow-canvas .vue-flow__minimap-mask {
144+
fill: rgba(var(--v-theme-on-surface), 0.08);
145+
}
146+
147+
.flow-canvas .vue-flow__minimap-node {
148+
fill: rgba(var(--v-theme-on-surface), 0.3);
149+
}
150+
123151
.flow-canvas .vue-flow__edge.edge--implicit .vue-flow__edge-path {
124152
stroke-dasharray: 6 4;
125153
opacity: 0.6;

‎panel/src/views/OverviewView.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function runTitle(run: Schemas['RunSummary']) {
4646
<v-btn variant="text" prepend-icon="mdi-refresh" :loading="busy" @click="load">{{ t('common.refresh') }}</v-btn>
4747
</PageHeader>
4848

49-
<v-row dense>
49+
<v-row density="compact">
5050
<v-col v-for="counter in counters" :key="counter.status" cols="6" md="4" lg="2">
5151
<v-card variant="tonal" :color="statusColor(counter.status)" :data-counter="counter.status">
5252
<v-card-text>

‎panel/src/views/audit/AuditView.vue‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ onMounted(() => load(true))
6464
<PageHeader :title="t('audit.title')" :subtitle="t('audit.subtitle')" />
6565
<v-card class="mb-4">
6666
<v-card-text>
67-
<v-row dense>
67+
<v-row density="compact">
6868
<v-col cols="12" md="2"
6969
><v-text-field v-model="filters.actor" :label="t('audit.actor')" hide-details clearable
7070
/></v-col>

0 commit comments

Comments
 (0)