From d66a09c5830842736f4df9479a9792321c884d89 Mon Sep 17 00:00:00 2001 From: Jason Thomas Date: Thu, 19 Dec 2024 11:57:01 -0700 Subject: [PATCH 1/2] Fix display_screen and GraphEditItemDialog --- .../src/tools/ScriptRunner/ScriptRunner.vue | 26 +++++----- .../src/components/GraphEditItemDialog.vue | 16 +++---- playwright/tests/script-runner/api.spec.ts | 47 +++++++++++++++++++ 3 files changed, 69 insertions(+), 20 deletions(-) diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/ScriptRunner.vue b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/ScriptRunner.vue index 405a0b881..b40821de8 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/ScriptRunner.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/ScriptRunner.vue @@ -1706,25 +1706,25 @@ export default { } index += 1 } - this.$set(definition, 'target', data.target_name) - this.$set(definition, 'screen', data.screen_name) - this.$set(definition, 'definition', data.definition) + definition.target = data.target_name + definition.screen = data.screen_name + definition.definition = data.definition if (data.x) { - this.$set(definition, 'left', data.x) + definition.left = data.x } else { - this.$set(definition, 'left', 0) + definition.left = 0 } if (data.y) { - this.$set(definition, 'top', data.y) + definition.top = data.y } else { - this.$set(definition, 'top', 0) + definition.top = 0 } - this.$set(definition, 'count', this.updateCounter++) + definition.count = this.updateCounter++ if (!found) { - this.$set(definition, 'id', this.idCounter++) - this.$set(this.screens, this.screens.length, definition) + definition.id = this.idCounter++ + this.screens[this.screens.length] = definition } else { - this.$set(this.screens, index, definition) + this.screens[index] = definition } break case 'clearscreen': @@ -2593,6 +2593,10 @@ class TestSuite(Suite): z-index: 20; opacity: 0.35; } +.ace_gutter { + /* Screens have a default z-index of 3 so get below that */ + z-index: 2; +} .ace_gutter-cell.ace_breakpoint { border-radius: 20px 0px 0px 20px; box-shadow: 0px 0px 1px 1px red inset; diff --git a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/GraphEditItemDialog.vue b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/GraphEditItemDialog.vue index e1a27d0fb..d7a7265c1 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/GraphEditItemDialog.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-vue-common/src/components/GraphEditItemDialog.vue @@ -47,7 +47,7 @@ hide-details label="Reduced Type" :items="reducedTypes" - :disabled="currentReduced === 'DECOM'" + :disabled="editItem.reduced === 'DECOM'" v-model="editItem.reducedType" class="mb-2" /> @@ -104,10 +104,10 @@ export default { valueTypes: ['CONVERTED', 'RAW'], reduction: [ // Map NONE to DECOM for clarity - { text: 'NONE', value: 'DECOM' }, - { text: 'REDUCED_MINUTE', value: 'REDUCED_MINUTE' }, - { text: 'REDUCED_HOUR', value: 'REDUCED_HOUR' }, - { text: 'REDUCED_DAY', value: 'REDUCED_DAY' }, + { title: 'NONE', value: 'DECOM' }, + { title: 'REDUCED_MINUTE', value: 'REDUCED_MINUTE' }, + { title: 'REDUCED_HOUR', value: 'REDUCED_HOUR' }, + { title: 'REDUCED_DAY', value: 'REDUCED_DAY' }, ], reducedTypes: ['MIN', 'MAX', 'AVG', 'STDDEV'], } @@ -127,14 +127,12 @@ export default { }, async created() { this.editItem = { ...this.item } - await this.api - this.api = new OpenC3Api() + new OpenC3Api() .get_item(this.item.targetName, this.item.packetName, this.item.itemName) .then((details) => { for (const [key, value] of Object.entries(details.limits)) { if (Object.keys(value).includes('red_low')) { - // Must call this.$set to allow Vue to make the limits object reactive - this.$set(this.limits, key, Object.values(value)) + this.limits[key] = Object.values(value) } } // Locate the key for the value array that we pass in diff --git a/playwright/tests/script-runner/api.spec.ts b/playwright/tests/script-runner/api.spec.ts index c9fbd52c3..0c05b5219 100644 --- a/playwright/tests/script-runner/api.spec.ts +++ b/playwright/tests/script-runner/api.spec.ts @@ -257,6 +257,53 @@ test('test python metadata apis', async ({ page, utils }) => { ) }) +async function testScreenApis(page, utils, filename) { + await openFile(page, utils, filename) + await page.locator('[data-test=start-button]').click() + await expect(page.locator('[data-test=state] input')).toHaveValue( + 'Connecting...', + { + timeout: 5000, + }, + ) + await expect(page.locator('[data-test=state] input')).toHaveValue('running') + // script displays INST ADCS + await page.getByText('INST ADCS', { exact: true }).toBeVisible() + // script displays INST HS + await page.getByText('INST HS', { exact: true }).toBeVisible() + // script calls clear_screen("INST", "ADCS") + await page.getByText('INST ADCS', { exact: true }).not.toBeVisible() + // script displays INST IMAGE + await page.getByText('INST IMAGE', { exact: true }).toBeVisible() + // script calls clear_all_screens() + await page.getByText('INST HS', { exact: true }).not.toBeVisible() + await page.getByText('INST IMAGE', { exact: true }).not.toBeVisible() + // script creates local screen "TEST" + await page.getByText('LOCAL TEST', { exact: true }).toBeVisible() + // script calls clear_all_screens() + await page.getByText('LOCAL TEST', { exact: true }).not.toBeVisible() + // script creates local screen "INST TEST" + await page.getByText('INST TEST', { exact: true }).toBeVisible() + // script calls clear_all_screens() + await page.getByText('INST TEST', { exact: true }).not.toBeVisible() + // script deletes INST TEST and tries to display it which results in error + await expect(page.locator('[data-test=state] input')).toHaveValue('error', { + timeout: 20000, + }) + await page.locator('[data-test=go-button]').click() + await expect(page.locator('[data-test=state] input')).toHaveValue('stopped', { + timeout: 20000, + }) +} + +test.only('test ruby screen apis', async ({ page, utils }) => { + await testScreenApis(page, utils, 'screens.rb') +}) + +test('test python screen apis', async ({ page, utils }) => { + await testScreenApis(page, utils, 'screens.py') +}) + test('test python numpy import', async ({ page, utils }) => { await openFile(page, utils, 'numpy.py') await page.locator('[data-test=start-button]').click() From a93988523ea442e14e792f0c909bcf796f3aa998 Mon Sep 17 00:00:00 2001 From: Jason Thomas Date: Thu, 19 Dec 2024 14:11:19 -0700 Subject: [PATCH 2/2] Fix playwright test --- .../targets/INST/procedures/screens.rb | 14 ++++---- .../targets/INST2/procedures/screens.py | 14 ++++---- playwright/tests/script-runner/api.spec.ts | 36 +++++++++++-------- 3 files changed, 36 insertions(+), 28 deletions(-) diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST/procedures/screens.rb b/openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST/procedures/screens.rb index cf120f99d..bd7fbee84 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST/procedures/screens.rb +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST/procedures/screens.rb @@ -5,15 +5,15 @@ puts definition wait(1) display_screen("INST", "ADCS") -wait(3) +wait(2) display_screen("INST", "HS", 400, 0) -wait(3) +wait(2) clear_screen("INST", "ADCS") -wait(3) +wait(2) display_screen("INST", "IMAGE") -wait(3) +wait(2) clear_all_screens() -wait(3) +wait(2) definition = ' SCREEN AUTO AUTO 1.0 @@ -23,11 +23,11 @@ END ' local_screen("TEST", definition) -wait(3) +wait(2) clear_all_screens() create_screen("INST", "TEST", definition) display_screen("INST", "TEST") -wait(3) +wait(2) clear_all_screens() delete_screen("INST", "TEST") display_screen("INST", "TEST") # Expected to fail because new screen was deleted diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST2/procedures/screens.py b/openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST2/procedures/screens.py index bddc10a8e..02fd24441 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST2/procedures/screens.py +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-demo/targets/INST2/procedures/screens.py @@ -5,15 +5,15 @@ print(definition) wait(1) display_screen("INST2", "ADCS") -wait(3) +wait(2) display_screen("INST2", "HS", 400, 0) -wait(3) +wait(2) clear_screen("INST2", "ADCS") -wait(3) +wait(2) display_screen("INST2", "IMAGE") -wait(3) +wait(2) clear_all_screens() -wait(3) +wait(2) definition = """ SCREEN AUTO AUTO 1.0 @@ -23,11 +23,11 @@ END """ local_screen("TEST", definition) -wait(3) +wait(2) clear_all_screens() create_screen("INST2", "TEST", definition) display_screen("INST2", "TEST") -wait(3) +wait(2) clear_all_screens() delete_screen("INST2", "TEST") display_screen("INST2", "TEST") # Expected to fail because new screen was deleted diff --git a/playwright/tests/script-runner/api.spec.ts b/playwright/tests/script-runner/api.spec.ts index 0c05b5219..a67c26a72 100644 --- a/playwright/tests/script-runner/api.spec.ts +++ b/playwright/tests/script-runner/api.spec.ts @@ -257,7 +257,7 @@ test('test python metadata apis', async ({ page, utils }) => { ) }) -async function testScreenApis(page, utils, filename) { +async function testScreenApis(page, utils, filename, target) { await openFile(page, utils, filename) await page.locator('[data-test=start-button]').click() await expect(page.locator('[data-test=state] input')).toHaveValue( @@ -268,24 +268,32 @@ async function testScreenApis(page, utils, filename) { ) await expect(page.locator('[data-test=state] input')).toHaveValue('running') // script displays INST ADCS - await page.getByText('INST ADCS', { exact: true }).toBeVisible() + await expect(page.getByText(`${target} ADCS`, { exact: true })).toBeVisible() // script displays INST HS - await page.getByText('INST HS', { exact: true }).toBeVisible() + await expect(page.getByText(`${target} HS`, { exact: true })).toBeVisible() // script calls clear_screen("INST", "ADCS") - await page.getByText('INST ADCS', { exact: true }).not.toBeVisible() + await expect( + page.getByText(`${target} ADCS`, { exact: true }), + ).not.toBeVisible() // script displays INST IMAGE - await page.getByText('INST IMAGE', { exact: true }).toBeVisible() + await expect(page.getByText(`${target} IMAGE`, { exact: true })).toBeVisible() // script calls clear_all_screens() - await page.getByText('INST HS', { exact: true }).not.toBeVisible() - await page.getByText('INST IMAGE', { exact: true }).not.toBeVisible() + await expect( + page.getByText(`${target} HS`, { exact: true }), + ).not.toBeVisible() + await expect( + page.getByText(`${target} IMAGE`, { exact: true }), + ).not.toBeVisible() // script creates local screen "TEST" - await page.getByText('LOCAL TEST', { exact: true }).toBeVisible() + await expect(page.getByText('LOCAL TEST', { exact: true })).toBeVisible() // script calls clear_all_screens() - await page.getByText('LOCAL TEST', { exact: true }).not.toBeVisible() + await expect(page.getByText('LOCAL TEST', { exact: true })).not.toBeVisible() // script creates local screen "INST TEST" - await page.getByText('INST TEST', { exact: true }).toBeVisible() + await expect(page.getByText(`${target} TEST`, { exact: true })).toBeVisible() // script calls clear_all_screens() - await page.getByText('INST TEST', { exact: true }).not.toBeVisible() + await expect( + page.getByText(`${target} TEST`, { exact: true }), + ).not.toBeVisible() // script deletes INST TEST and tries to display it which results in error await expect(page.locator('[data-test=state] input')).toHaveValue('error', { timeout: 20000, @@ -296,12 +304,12 @@ async function testScreenApis(page, utils, filename) { }) } -test.only('test ruby screen apis', async ({ page, utils }) => { - await testScreenApis(page, utils, 'screens.rb') +test('test ruby screen apis', async ({ page, utils }) => { + await testScreenApis(page, utils, 'screens.rb', 'INST') }) test('test python screen apis', async ({ page, utils }) => { - await testScreenApis(page, utils, 'screens.py') + await testScreenApis(page, utils, 'screens.py', 'INST2') }) test('test python numpy import', async ({ page, utils }) => {