Skip to content

Commit

Permalink
Fix playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
jmthomas committed Nov 2, 2024
1 parent c937f9a commit afbb55e
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 54 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
# This file may also be used under the terms of a commercial license
# if purchased from OpenC3, Inc.

require 'openc3/topics/autonomic_topic'
require 'openc3/models/activity_model'
require 'openc3/models/trigger_group_model'

class TriggerGroupController < ApplicationController
def initialize
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,7 +603,7 @@ export default {
this.screenName = 'CMDSENDER'
let screenDefinition = 'SCREEN AUTO AUTO 1.0\n'
for (const item of command.related_items) {
screenDefinition += `LABELVALUE '${command.related_items[i][0]}' '${command.related_items[i][1]}' '${command.related_items[i][2]}' WITH_UNITS 20\n`
screenDefinition += `LABELVALUE '${item[0]}' '${item[1]}' '${item[2]}' WITH_UNITS 20\n`
}
this.screenDefinition = screenDefinition
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1004,31 +1004,8 @@ export default {
mounted: async function () {
this.editor = ace.edit(this.$refs.editor)
this.editor.setTheme('ace/theme/twilight')
// Public apis in api_shared but not in OpenC3Api
const api_shared = [
'check',
'check_raw',
'check_formatted',
'check_with_units',
'check_exception',
'check_tolerance',
'check_expression',
'wait',
'wait_tolerance',
'wait_expression',
'wait_check',
'wait_check_tolerance',
'wait_check_expression',
'wait_packet',
'wait_check_packet',
'disable_instrumentation',
'set_line_delay',
'get_line_delay',
'set_max_output',
'get_max_output',
]
const openC3RubyMode = this.buildOpenC3RubyMode(api_shared)
const openC3PythonMode = this.buildOpenC3PythonMode(api_shared)
const openC3RubyMode = this.buildOpenC3RubyMode()
const openC3PythonMode = this.buildOpenC3PythonMode()
this.openC3RubyMode = new openC3RubyMode()
this.openC3PythonMode = new openC3PythonMode()
this.editor.session.setMode(this.openC3RubyMode)
Expand Down Expand Up @@ -1184,7 +1161,29 @@ export default {
let apis = Object.getOwnPropertyNames(OpenC3Api.prototype)
.filter((a) => a !== 'constructor')
.filter((a) => a !== 'exec')
.concat(api_shared)
// Add the Public apis in api_shared but not in OpenC3Api
.concat([
'check',
'check_raw',
'check_formatted',
'check_with_units',
'check_exception',
'check_tolerance',
'check_expression',
'wait',
'wait_tolerance',
'wait_expression',
'wait_check',
'wait_check_tolerance',
'wait_check_expression',
'wait_packet',
'wait_check_packet',
'disable_instrumentation',
'set_line_delay',
'get_line_delay',
'set_max_output',
'get_max_output',
])
let regex = new RegExp(`(\\b${apis.join('\\b|\\b')}\\b)`)
let OpenC3HighlightRules = function () {
HighlightRules.call(this)
Expand All @@ -1211,10 +1210,10 @@ export default {
this.foldingRules = new FoldMode()
this.indentKeywords = this.foldingRules.indentKeywords
}
return Mode
return [oop, Mode]
},
buildOpenC3RubyMode(api_shared) {
let Mode = this.buildLanguageMode(
buildOpenC3RubyMode() {
const [oop, Mode] = this.buildLanguageMode(
ace.require('ace/mode/ruby_highlight_rules').RubyHighlightRules,
ace.require('ace/mode/folding/ruby').FoldMode,
)
Expand All @@ -1225,8 +1224,8 @@ export default {
}).call(Mode.prototype)
return Mode
},
buildOpenC3PythonMode(api_shared) {
let Mode = this.buildLanguageMode(
buildOpenC3PythonMode() {
const [oop, Mode] = this.buildLanguageMode(
ace.require('ace/mode/python_highlight_rules').PythonHighlightRules,
ace.require('ace/mode/folding/pythonic').FoldMode,
)
Expand Down
30 changes: 20 additions & 10 deletions playwright/tests/admin/microservices.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
# Copyright 2023 OpenC3, Inc
# Copyright 2024 OpenC3, Inc
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
Expand All @@ -24,23 +24,33 @@ test.use({

test('displays microservice names', async ({ page, utils }) => {
// There are 9 microservices per target so look for the INST2 list
expect(await page.getByRole('list')).toContainText('DEFAULT__CLEANUP__INST2')
expect(await page.getByRole('list')).toContainText(
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__CLEANUP__INST2',
)
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__COMMANDLOG__INST2',
)
expect(await page.getByRole('list')).toContainText(
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__DECOMCMDLOG__INST2',
)
expect(await page.getByRole('list')).toContainText('DEFAULT__DECOMLOG__INST2')
expect(await page.getByRole('list')).toContainText('DEFAULT__DECOM__INST2')
expect(await page.getByRole('list')).toContainText(
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__DECOMLOG__INST2',
)
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__DECOM__INST2',
)
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__INTERFACE__INST2_INT',
)
expect(await page.getByRole('list')).toContainText('DEFAULT__MULTI__INST2')
expect(await page.getByRole('list')).toContainText(
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__MULTI__INST2',
)
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__PACKETLOG__INST2',
)
expect(await page.getByRole('list')).toContainText('DEFAULT__REDUCER__INST2')
await expect(page.locator('[data-test="microserviceList"]')).toContainText(
'DEFAULT__REDUCER__INST2',
)
})

test('displays microservice details', async ({ page, utils }) => {
Expand Down
6 changes: 3 additions & 3 deletions playwright/tests/admin/plugins.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -538,14 +538,14 @@ test.describe(() => {
await page.goto('/tools/tlmviewer')
await expect(page.locator('.v-app-bar')).toContainText('Telemetry Viewer')
await page.locator('rux-icon-apps').getByRole('img').click()
await page.locator('div[role="button"]:has-text("Select Target")').click()
await page.locator(`.v-list-item__title:text-is("NEW_TGT")`).click()
await page.locator('[data-test=select-target] i').click()
await page.getByRole('option', { name: 'NEW_TGT', exact: true }).click()
await utils.sleep(500)
await page.locator('[data-test=new-screen]').click()
await expect(
page.locator(`.v-toolbar:has-text("New Screen")`),
).toBeVisible()
await page.locator('[data-test=new-screen-name]').fill('NEW_SCREEN')
await page.locator('[data-test=new-screen-name] input').fill('NEW_SCREEN')
await page.getByRole('button', { name: 'Save' }).click()
await expect(
page.locator(`.v-toolbar:has-text("NEW_TGT NEW_SCREEN")`),
Expand Down
16 changes: 10 additions & 6 deletions playwright/tests/admin/targets.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,16 @@ test.use({
})

test('displays target names and associated plugin', async ({ page, utils }) => {
expect(await page.getByRole('list')).toContainText('INST')
expect(await page.getByRole('list')).toContainText('INST2')
expect(await page.getByRole('list')).toContainText('SYSTEM')
expect(await page.getByRole('list')).toContainText('EXAMPLE')
expect(await page.getByRole('list')).toContainText('TEMPLATED')
expect(await page.getByRole('list')).toContainText(
await expect(page.locator('[data-test="targetList"]')).toContainText('INST')
await expect(page.locator('[data-test="targetList"]')).toContainText('INST2')
await expect(page.locator('[data-test="targetList"]')).toContainText('SYSTEM')
await expect(page.locator('[data-test="targetList"]')).toContainText(
'EXAMPLE',
)
await expect(page.locator('[data-test="targetList"]')).toContainText(
'TEMPLATED',
)
await expect(page.locator('[data-test="targetList"]')).toContainText(
/Plugin: openc3-cosmos-demo-\d{1,2}\.\d{1,2}\.\d{1,2}/,
)
})
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/command-sender.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ test('shows ignored parameters', async ({ page, utils }) => {
// Thus we send the INST SET PARAMS command which has a parameter conversion,
// check the raw buffer, then send it with parameter conversions disabled,
// and re-check the raw buffer for a change.
test('disable parameter conversions', async ({ page, utils }) => {
test.only('disable parameter conversions', async ({ page, utils }) => {
await page.locator('[data-test="clear-history"]').click()
await utils.selectTargetPacketItem('INST', 'SETPARAMS')
await page.locator('[data-test="select-send"]').click()
Expand Down

0 comments on commit afbb55e

Please sign in to comment.