fat: ui
This commit is contained in:
+98
-51
@@ -958,14 +958,6 @@
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.function-content-header {
|
|
||||||
display: flex;
|
|
||||||
gap: 12px;
|
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.test-type-layout {
|
.test-type-layout {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: 18px;
|
gap: 18px;
|
||||||
@@ -1330,7 +1322,7 @@
|
|||||||
</header>
|
</header>
|
||||||
|
|
||||||
<main class="workspace-grid">
|
<main class="workspace-grid">
|
||||||
<q-card flat class="studio-card" v-if="currentFundingSource && currentDataset.analysis">
|
<q-card flat class="studio-card" v-if="currentTestFundingSource && currentDataset.analysis">
|
||||||
<q-card-section>
|
<q-card-section>
|
||||||
<q-tabs
|
<q-tabs
|
||||||
v-if="functionOptions.length"
|
v-if="functionOptions.length"
|
||||||
@@ -1355,16 +1347,6 @@
|
|||||||
|
|
||||||
<div v-if="functionOptions.length">
|
<div v-if="functionOptions.length">
|
||||||
<div class="function-content">
|
<div class="function-content">
|
||||||
<div class="function-content-header" v-if="currentFunction">
|
|
||||||
<q-btn
|
|
||||||
color="primary"
|
|
||||||
outline
|
|
||||||
label="Mocks"
|
|
||||||
:disable="!currentFunction || !currentFundingSource"
|
|
||||||
@click="functionMocksDialog = true"
|
|
||||||
></q-btn>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div v-if="currentFunctionTestTypeGroups.length" class="test-type-layout">
|
<div v-if="currentFunctionTestTypeGroups.length" class="test-type-layout">
|
||||||
<q-tabs
|
<q-tabs
|
||||||
v-model="currentSelectedTestTypeKey"
|
v-model="currentSelectedTestTypeKey"
|
||||||
@@ -1426,7 +1408,7 @@
|
|||||||
{{ testEntry.status.label }}
|
{{ testEntry.status.label }}
|
||||||
</q-chip>
|
</q-chip>
|
||||||
<q-chip dense square color="secondary" text-color="white">
|
<q-chip dense square color="secondary" text-color="white">
|
||||||
{{ currentFundingSource.name }}
|
{{ currentTestFundingSource.name }}
|
||||||
</q-chip>
|
</q-chip>
|
||||||
<q-chip dense square color="primary" text-color="white">
|
<q-chip dense square color="primary" text-color="white">
|
||||||
{{ testEntry.variantCount }} generated variants
|
{{ testEntry.variantCount }} generated variants
|
||||||
@@ -1474,10 +1456,46 @@
|
|||||||
<div v-if="testEntry.expectedError" class="settings-error q-mt-sm">
|
<div v-if="testEntry.expectedError" class="settings-error q-mt-sm">
|
||||||
{{ testEntry.expectedError }}
|
{{ testEntry.expectedError }}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="mock-list q-mt-lg" v-if="testEntry.rawMockSets.length">
|
<div class="q-mt-lg">
|
||||||
|
<label
|
||||||
|
class="field-label"
|
||||||
|
:for="`test-funding-source-${group.key}-${testEntry.index}-${entryIndex}`"
|
||||||
|
>
|
||||||
|
Funding Source
|
||||||
|
</label>
|
||||||
|
<div class="picker-action-row">
|
||||||
|
<q-select
|
||||||
|
:id="`test-funding-source-${group.key}-${testEntry.index}-${entryIndex}`"
|
||||||
|
v-model="selectedTestFundingSourceByDataset[selectedDatasetKey]"
|
||||||
|
:options="fundingSourceOptions"
|
||||||
|
emit-value
|
||||||
|
map-options
|
||||||
|
outlined
|
||||||
|
dense
|
||||||
|
options-dense
|
||||||
|
behavior="menu"
|
||||||
|
hide-dropdown-icon
|
||||||
|
class="fixture-select picker-select"
|
||||||
|
>
|
||||||
|
<template v-slot:append>
|
||||||
|
<span class="fixture-select-icon" aria-hidden="true">expand_more</span>
|
||||||
|
</template>
|
||||||
|
</q-select>
|
||||||
|
|
||||||
|
<q-btn
|
||||||
|
color="primary"
|
||||||
|
outline
|
||||||
|
label="Mocks"
|
||||||
|
:disable="!currentFunction || !currentTestFundingSource"
|
||||||
|
@click="functionMocksDialog = true"
|
||||||
|
></q-btn>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="mock-list q-mt-lg" v-if="testEntry.rawMockSets.length">
|
||||||
<div
|
<div
|
||||||
v-for="(mockSet, mockSetIndex) in testEntry.rawMockSets"
|
v-for="(mockSet, mockSetIndex) in testEntry.rawMockSets"
|
||||||
:key="mockSet.path"
|
:key="mockSet.path"
|
||||||
@@ -1706,7 +1724,7 @@
|
|||||||
|
|
||||||
<div v-else class="empty-state q-mt-lg">
|
<div v-else class="empty-state q-mt-lg">
|
||||||
No wallet-specific mock entry is defined for
|
No wallet-specific mock entry is defined for
|
||||||
<code>{{ currentFundingSource.name }}</code>
|
<code>{{ currentTestFundingSource.name }}</code>
|
||||||
in this test.
|
in this test.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1927,7 +1945,7 @@
|
|||||||
|
|
||||||
<div class="pill-row q-mt-md">
|
<div class="pill-row q-mt-md">
|
||||||
<q-chip
|
<q-chip
|
||||||
v-if="currentFunction && currentFundingSource"
|
v-if="currentFunction && currentTestFundingSource"
|
||||||
dense
|
dense
|
||||||
square
|
square
|
||||||
color="primary"
|
color="primary"
|
||||||
@@ -1949,7 +1967,7 @@
|
|||||||
<q-separator></q-separator>
|
<q-separator></q-separator>
|
||||||
|
|
||||||
<q-card-section class="q-pa-lg">
|
<q-card-section class="q-pa-lg">
|
||||||
<div v-if="currentFunction && currentFundingSource">
|
<div v-if="currentFunction && currentTestFundingSource">
|
||||||
<div class="settings-editor" v-if="currentFunctionMockRows.length">
|
<div class="settings-editor" v-if="currentFunctionMockRows.length">
|
||||||
<div class="function-mocks-table-wrap">
|
<div class="function-mocks-table-wrap">
|
||||||
<div class="function-mocks-table">
|
<div class="function-mocks-table">
|
||||||
@@ -2115,7 +2133,7 @@
|
|||||||
|
|
||||||
<div v-else class="empty-state">
|
<div v-else class="empty-state">
|
||||||
No function-level mocks are defined yet for
|
No function-level mocks are defined yet for
|
||||||
<code>{{ currentFundingSource.name }}</code>
|
<code>{{ currentTestFundingSource.name }}</code>
|
||||||
in
|
in
|
||||||
<code>{{ currentFunction.name }}</code>.
|
<code>{{ currentFunction.name }}</code>.
|
||||||
</div>
|
</div>
|
||||||
@@ -2722,12 +2740,14 @@
|
|||||||
const functionMockDrafts = {}
|
const functionMockDrafts = {}
|
||||||
const selectedFunctionByDataset = {}
|
const selectedFunctionByDataset = {}
|
||||||
const selectedFundingSourceByDataset = {}
|
const selectedFundingSourceByDataset = {}
|
||||||
|
const selectedTestFundingSourceByDataset = {}
|
||||||
const settingsDrafts = {}
|
const settingsDrafts = {}
|
||||||
|
|
||||||
DATASET_DEFS.forEach(def => {
|
DATASET_DEFS.forEach(def => {
|
||||||
datasets[def.key] = createDatasetState(def)
|
datasets[def.key] = createDatasetState(def)
|
||||||
selectedFunctionByDataset[def.key] = ''
|
selectedFunctionByDataset[def.key] = ''
|
||||||
selectedFundingSourceByDataset[def.key] = ''
|
selectedFundingSourceByDataset[def.key] = ''
|
||||||
|
selectedTestFundingSourceByDataset[def.key] = ''
|
||||||
})
|
})
|
||||||
|
|
||||||
return {
|
return {
|
||||||
@@ -2741,6 +2761,7 @@
|
|||||||
settingsDraftRowId: 0,
|
settingsDraftRowId: 0,
|
||||||
settingsDrafts,
|
settingsDrafts,
|
||||||
selectedDatasetKey: 'rest',
|
selectedDatasetKey: 'rest',
|
||||||
|
selectedTestFundingSourceByDataset,
|
||||||
selectedTestTypeByScope: {},
|
selectedTestTypeByScope: {},
|
||||||
selectedFunctionByDataset,
|
selectedFunctionByDataset,
|
||||||
selectedFundingSourceByDataset
|
selectedFundingSourceByDataset
|
||||||
@@ -2778,6 +2799,18 @@
|
|||||||
) || null
|
) || null
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
currentTestFundingSourceName() {
|
||||||
|
return (
|
||||||
|
this.selectedTestFundingSourceByDataset[this.selectedDatasetKey] || ''
|
||||||
|
)
|
||||||
|
},
|
||||||
|
currentTestFundingSource() {
|
||||||
|
return (
|
||||||
|
this.currentFundingSources.find(
|
||||||
|
fs => fs.name === this.currentTestFundingSourceName
|
||||||
|
) || null
|
||||||
|
)
|
||||||
|
},
|
||||||
currentFundingSourceSkip: {
|
currentFundingSourceSkip: {
|
||||||
get() {
|
get() {
|
||||||
return Boolean(this.currentFundingSource?.skip)
|
return Boolean(this.currentFundingSource?.skip)
|
||||||
@@ -2837,24 +2870,24 @@
|
|||||||
return this.currentDataset.rawText !== this.currentDataset.snapshotText
|
return this.currentDataset.rawText !== this.currentDataset.snapshotText
|
||||||
},
|
},
|
||||||
currentFunctionBaseMockPath() {
|
currentFunctionBaseMockPath() {
|
||||||
if (!this.currentFunction || !this.currentFundingSource) {
|
if (!this.currentFunction || !this.currentTestFundingSource) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.baseWalletPath(
|
return this.baseWalletPath(
|
||||||
this.currentFunction.name,
|
this.currentFunction.name,
|
||||||
this.currentFundingSource.name
|
this.currentTestFundingSource.name
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
currentFunctionMockRows() {
|
currentFunctionMockRows() {
|
||||||
if (!this.currentFunctionName || !this.currentFundingSourceName) {
|
if (!this.currentFunctionName || !this.currentTestFundingSourceName) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.getFunctionMockDraftRows(
|
return this.getFunctionMockDraftRows(
|
||||||
this.selectedDatasetKey,
|
this.selectedDatasetKey,
|
||||||
this.currentFunctionName,
|
this.currentFunctionName,
|
||||||
this.currentFundingSourceName
|
this.currentTestFundingSourceName
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
currentFunctionMockNameOptions() {
|
currentFunctionMockNameOptions() {
|
||||||
@@ -2876,7 +2909,7 @@
|
|||||||
}))
|
}))
|
||||||
},
|
},
|
||||||
currentFunctionTestsForFundingSource() {
|
currentFunctionTestsForFundingSource() {
|
||||||
if (!this.currentFunction || !this.currentFundingSource) {
|
if (!this.currentFunction || !this.currentTestFundingSource) {
|
||||||
return []
|
return []
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2889,11 +2922,11 @@
|
|||||||
rawHasMocksBlock &&
|
rawHasMocksBlock &&
|
||||||
Object.prototype.hasOwnProperty.call(
|
Object.prototype.hasOwnProperty.call(
|
||||||
test.raw.mocks || {},
|
test.raw.mocks || {},
|
||||||
this.currentFundingSource.name
|
this.currentTestFundingSource.name
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
const rawWalletMockValue = hasMockEntry
|
const rawWalletMockValue = hasMockEntry
|
||||||
? test.raw.mocks[this.currentFundingSource.name]
|
? test.raw.mocks[this.currentTestFundingSource.name]
|
||||||
: undefined
|
: undefined
|
||||||
const hasExpectField = Object.prototype.hasOwnProperty.call(
|
const hasExpectField = Object.prototype.hasOwnProperty.call(
|
||||||
test.raw || {},
|
test.raw || {},
|
||||||
@@ -2908,7 +2941,7 @@
|
|||||||
? this.testWalletPath(
|
? this.testWalletPath(
|
||||||
this.currentFunction.name,
|
this.currentFunction.name,
|
||||||
test.index,
|
test.index,
|
||||||
this.currentFundingSource.name
|
this.currentTestFundingSource.name
|
||||||
)
|
)
|
||||||
: ''
|
: ''
|
||||||
const walletMockValueIsArray = Array.isArray(rawWalletMockValue)
|
const walletMockValueIsArray = Array.isArray(rawWalletMockValue)
|
||||||
@@ -2943,7 +2976,7 @@
|
|||||||
error: ''
|
error: ''
|
||||||
}))
|
}))
|
||||||
const variants = testsForFundingSource(
|
const variants = testsForFundingSource(
|
||||||
this.currentFundingSource,
|
this.currentTestFundingSource,
|
||||||
this.currentFunction.name,
|
this.currentFunction.name,
|
||||||
this.currentFunction.raw,
|
this.currentFunction.raw,
|
||||||
test.raw,
|
test.raw,
|
||||||
@@ -2956,7 +2989,7 @@
|
|||||||
}
|
}
|
||||||
let note = ''
|
let note = ''
|
||||||
|
|
||||||
if (this.currentFundingSource.skip) {
|
if (this.currentTestFundingSource.skip) {
|
||||||
status = {
|
status = {
|
||||||
label: 'Wallet skipped',
|
label: 'Wallet skipped',
|
||||||
color: 'warning'
|
color: 'warning'
|
||||||
@@ -3008,14 +3041,14 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
currentTestTypeScopeKey() {
|
currentTestTypeScopeKey() {
|
||||||
if (!this.currentFunctionName || !this.currentFundingSourceName) {
|
if (!this.currentFunctionName || !this.currentTestFundingSourceName) {
|
||||||
return ''
|
return ''
|
||||||
}
|
}
|
||||||
|
|
||||||
return [
|
return [
|
||||||
this.selectedDatasetKey,
|
this.selectedDatasetKey,
|
||||||
this.currentFunctionName,
|
this.currentFunctionName,
|
||||||
this.currentFundingSourceName
|
this.currentTestFundingSourceName
|
||||||
].join(':')
|
].join(':')
|
||||||
},
|
},
|
||||||
currentFunctionTestTypeGroups() {
|
currentFunctionTestTypeGroups() {
|
||||||
@@ -3088,6 +3121,8 @@
|
|||||||
},
|
},
|
||||||
currentFundingSourceName() {
|
currentFundingSourceName() {
|
||||||
this.ensureSettingsDraftForCurrent()
|
this.ensureSettingsDraftForCurrent()
|
||||||
|
},
|
||||||
|
currentTestFundingSourceName() {
|
||||||
this.ensureFunctionMockDraftForCurrent()
|
this.ensureFunctionMockDraftForCurrent()
|
||||||
},
|
},
|
||||||
currentFunctionName() {
|
currentFunctionName() {
|
||||||
@@ -3323,14 +3358,14 @@
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
ensureFunctionMockDraftForCurrent(force = false) {
|
ensureFunctionMockDraftForCurrent(force = false) {
|
||||||
if (!this.currentFunctionName || !this.currentFundingSourceName) {
|
if (!this.currentFunctionName || !this.currentTestFundingSourceName) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.ensureFunctionMockDraft(
|
this.ensureFunctionMockDraft(
|
||||||
this.selectedDatasetKey,
|
this.selectedDatasetKey,
|
||||||
this.currentFunctionName,
|
this.currentFunctionName,
|
||||||
this.currentFundingSourceName,
|
this.currentTestFundingSourceName,
|
||||||
force
|
force
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -3504,7 +3539,7 @@
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
persistTestMockSet(testEntry, mockSet) {
|
persistTestMockSet(testEntry, mockSet) {
|
||||||
if (!this.currentFunctionName || !this.currentFundingSourceName) {
|
if (!this.currentFunctionName || !this.currentTestFundingSourceName) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3621,17 +3656,17 @@
|
|||||||
rawTest.mocks = {}
|
rawTest.mocks = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
const walletMockValue = rawTest.mocks[this.currentFundingSourceName]
|
const walletMockValue = rawTest.mocks[this.currentTestFundingSourceName]
|
||||||
|
|
||||||
if (Array.isArray(walletMockValue) || mockSet.walletMockValueIsArray) {
|
if (Array.isArray(walletMockValue) || mockSet.walletMockValueIsArray) {
|
||||||
if (!Array.isArray(rawTest.mocks[this.currentFundingSourceName])) {
|
if (!Array.isArray(rawTest.mocks[this.currentTestFundingSourceName])) {
|
||||||
rawTest.mocks[this.currentFundingSourceName] = []
|
rawTest.mocks[this.currentTestFundingSourceName] = []
|
||||||
}
|
}
|
||||||
|
|
||||||
rawTest.mocks[this.currentFundingSourceName][mockSet.setIndex] =
|
rawTest.mocks[this.currentTestFundingSourceName][mockSet.setIndex] =
|
||||||
nextValue
|
nextValue
|
||||||
} else {
|
} else {
|
||||||
rawTest.mocks[this.currentFundingSourceName] = nextValue
|
rawTest.mocks[this.currentTestFundingSourceName] = nextValue
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3739,14 +3774,14 @@
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
addFunctionMockRow() {
|
addFunctionMockRow() {
|
||||||
if (!this.currentFunctionName || !this.currentFundingSourceName) {
|
if (!this.currentFunctionName || !this.currentTestFundingSourceName) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
const rows = this.ensureFunctionMockDraft(
|
const rows = this.ensureFunctionMockDraft(
|
||||||
this.selectedDatasetKey,
|
this.selectedDatasetKey,
|
||||||
this.currentFunctionName,
|
this.currentFunctionName,
|
||||||
this.currentFundingSourceName
|
this.currentTestFundingSourceName
|
||||||
)
|
)
|
||||||
rows.push(this.createFunctionMockDraftRow('', {}))
|
rows.push(this.createFunctionMockDraftRow('', {}))
|
||||||
},
|
},
|
||||||
@@ -3756,7 +3791,7 @@
|
|||||||
this.persistFunctionMocks()
|
this.persistFunctionMocks()
|
||||||
},
|
},
|
||||||
persistFunctionMocks() {
|
persistFunctionMocks() {
|
||||||
if (!this.currentFunctionName || !this.currentFundingSourceName) {
|
if (!this.currentFunctionName || !this.currentTestFundingSourceName) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3795,7 +3830,7 @@
|
|||||||
data.functions[this.currentFunctionName].mocks = {}
|
data.functions[this.currentFunctionName].mocks = {}
|
||||||
}
|
}
|
||||||
data.functions[this.currentFunctionName].mocks[
|
data.functions[this.currentFunctionName].mocks[
|
||||||
this.currentFundingSourceName
|
this.currentTestFundingSourceName
|
||||||
] = nextMocks
|
] = nextMocks
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -3816,6 +3851,7 @@
|
|||||||
|
|
||||||
if (!fundingSources.length) {
|
if (!fundingSources.length) {
|
||||||
this.selectedFundingSourceByDataset[datasetKey] = ''
|
this.selectedFundingSourceByDataset[datasetKey] = ''
|
||||||
|
this.selectedTestFundingSourceByDataset[datasetKey] = ''
|
||||||
} else {
|
} else {
|
||||||
const currentFundingSourceName =
|
const currentFundingSourceName =
|
||||||
this.selectedFundingSourceByDataset[datasetKey]
|
this.selectedFundingSourceByDataset[datasetKey]
|
||||||
@@ -3827,6 +3863,17 @@
|
|||||||
this.selectedFundingSourceByDataset[datasetKey] =
|
this.selectedFundingSourceByDataset[datasetKey] =
|
||||||
fundingSources[0].name
|
fundingSources[0].name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const currentTestFundingSourceName =
|
||||||
|
this.selectedTestFundingSourceByDataset[datasetKey]
|
||||||
|
const selectedTestFundingSource = fundingSources.find(
|
||||||
|
fs => fs.name === currentTestFundingSourceName
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!selectedTestFundingSource) {
|
||||||
|
this.selectedTestFundingSourceByDataset[datasetKey] =
|
||||||
|
fundingSources[0].name
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!functions.length) {
|
if (!functions.length) {
|
||||||
@@ -3892,7 +3939,7 @@
|
|||||||
this.ensureFunctionMockDraft(
|
this.ensureFunctionMockDraft(
|
||||||
datasetKey,
|
datasetKey,
|
||||||
this.selectedFunctionByDataset[datasetKey],
|
this.selectedFunctionByDataset[datasetKey],
|
||||||
this.selectedFundingSourceByDataset[datasetKey],
|
this.selectedTestFundingSourceByDataset[datasetKey],
|
||||||
options.preserveFunctionMockDrafts !== true
|
options.preserveFunctionMockDrafts !== true
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user