Skip to content

Commit

Permalink
Merge pull request #1787 from OpenC3/display_screen
Browse files Browse the repository at this point in the history
Fix display screen
  • Loading branch information
jmthomas authored Dec 20, 2024
2 parents 34889a4 + a939885 commit 45d4aa5
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
Expand Down Expand Up @@ -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'],
}
Expand All @@ -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
Expand Down
55 changes: 55 additions & 0 deletions playwright/tests/script-runner/api.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,61 @@ test('test python metadata apis', async ({ page, utils }) => {
)
})

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(
'Connecting...',
{
timeout: 5000,
},
)
await expect(page.locator('[data-test=state] input')).toHaveValue('running')

Check failure on line 269 in playwright/tests/script-runner/api.spec.ts

View workflow job for this annotation

GitHub Actions / openc3-build-test

[chromium] › script-runner/api.spec.ts:311:5 › test python screen apis

4) [chromium] › script-runner/api.spec.ts:311:5 › test python screen apis ──────────────────────── Error: Timed out 10000ms waiting for expect(locator).toHaveValue(expected) Locator: locator('[data-test=state] input') Expected string: "running" Received string: "waiting 0s" Call log: - expect.toHaveValue with timeout 10000ms - waiting for locator('[data-test=state] input') 4 × locator resolved to <input readonly size="1" type="text" id="input-13" value="Connecting..." class="v-field__input" aria-describedby="input-13-messages"/> - unexpected value "Connecting..." 2 × locator resolved to <input readonly size="1" type="text" id="input-13" value="waiting 0s" class="v-field__input" aria-describedby="input-13-messages"/> - unexpected value "waiting 0s" - locator resolved to <input readonly size="1" type="text" id="input-13" value="waiting 1s" class="v-field__input" aria-describedby="input-13-messages"/> - unexpected value "waiting 1s" - locator resolved to <input readonly size="1" type="text" id="input-13" value="waiting 0s" class="v-field__input" aria-describedby="input-13-messages"/> - unexpected value "waiting 0s" 2 × locator resolved to <input readonly size="1" type="text" id="input-13" value="waiting 1s" class="v-field__input" aria-describedby="input-13-messages"/> - unexpected value "waiting 1s" - locator resolved to <input readonly size="1" type="text" id="input-13" value="waiting 0s" class="v-field__input" aria-describedby="input-13-messages"/> - unexpected value "waiting 0s" 267 | }, 268 | ) > 269 | await expect(page.locator('[data-test=state] input')).toHaveValue('running') | ^ 270 | // script displays INST ADCS 271 | await expect(page.getByText(`${target} ADCS`, { exact: true })).toBeVisible() 272 | // script displays INST HS at testScreenApis (/home/runner/work/cosmos/cosmos/playwright/tests/script-runner/api.spec.ts:269:57) at /home/runner/work/cosmos/cosmos/playwright/tests/script-runner/api.spec.ts:312:3
// script displays INST ADCS
await expect(page.getByText(`${target} ADCS`, { exact: true })).toBeVisible()
// script displays INST HS
await expect(page.getByText(`${target} HS`, { exact: true })).toBeVisible()
// script calls clear_screen("INST", "ADCS")
await expect(
page.getByText(`${target} ADCS`, { exact: true }),
).not.toBeVisible()
// script displays INST IMAGE
await expect(page.getByText(`${target} IMAGE`, { exact: true })).toBeVisible()
// script calls clear_all_screens()
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 expect(page.getByText('LOCAL TEST', { exact: true })).toBeVisible()
// script calls clear_all_screens()
await expect(page.getByText('LOCAL TEST', { exact: true })).not.toBeVisible()
// script creates local screen "INST TEST"
await expect(page.getByText(`${target} TEST`, { exact: true })).toBeVisible()
// script calls clear_all_screens()
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,
})
await page.locator('[data-test=go-button]').click()
await expect(page.locator('[data-test=state] input')).toHaveValue('stopped', {
timeout: 20000,
})
}

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', 'INST2')
})

test('test python numpy import', async ({ page, utils }) => {
await openFile(page, utils, 'numpy.py')
await page.locator('[data-test=start-button]').click()
Expand Down

0 comments on commit 45d4aa5

Please sign in to comment.