From 9d667a4888362e7493855af08ad436f172aebe13 Mon Sep 17 00:00:00 2001 From: Ryan Pratt Date: Thu, 21 Nov 2024 13:24:34 -0700 Subject: [PATCH] Fix tests for enterprise --- .../src/tools/ScriptRunner/RunningScripts.vue | 19 +++++++++---------- playwright/tests/bucket-explorer.spec.ts | 2 +- playwright/tests/global.setup.ts | 4 ++-- .../tests/script-runner/script-menu.spec.ts | 6 ++---- playwright/tests/utc-time.spec.ts | 5 +++++ 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/RunningScripts.vue b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/RunningScripts.vue index 57e2131cf..93ab0fca6 100644 --- a/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/RunningScripts.vue +++ b/openc3-cosmos-init/plugins/packages/openc3-cosmos-tool-scriptrunner/src/tools/ScriptRunner/RunningScripts.vue @@ -103,27 +103,26 @@ > diff --git a/playwright/tests/bucket-explorer.spec.ts b/playwright/tests/bucket-explorer.spec.ts index 952f905e9..e62bd796c 100644 --- a/playwright/tests/bucket-explorer.spec.ts +++ b/playwright/tests/bucket-explorer.spec.ts @@ -145,7 +145,7 @@ test('direct URLs', async ({ page }) => { test('view file', async ({ page, utils }) => { await page.getByText('config').click() await page.getByRole('cell', { name: 'DEFAULT' }).click() - await page.getByRole('cell', { name: 'targets' }).click() + await page.getByRole('cell', { name: 'targets', exact: true }).click() await page.getByRole('cell', { name: 'INST', exact: true }).click() await page.getByRole('cell', { name: 'procedures' }).click() await page.locator('[data-test="search-input"] input').fill('calendar') diff --git a/playwright/tests/global.setup.ts b/playwright/tests/global.setup.ts index 704da6c49..90526cd71 100644 --- a/playwright/tests/global.setup.ts +++ b/playwright/tests/global.setup.ts @@ -34,8 +34,8 @@ setup('global setup', async ({ page }) => { } // Logout and log back in as admin - await page.getByText('The Operator').click() - await page.locator('button:has-text("Logout")').click() + await page.getByText('The Operator', { exact: true }).click() + await page.getByRole('button', { name: 'Logout' }).click() await page.waitForURL('**/auth/**') await page.getByLabel('Username or email').fill('admin') await page.getByLabel('Password', { exact: true }).fill('admin') diff --git a/playwright/tests/script-runner/script-menu.spec.ts b/playwright/tests/script-runner/script-menu.spec.ts index 9e9dd3d4e..00faed69f 100644 --- a/playwright/tests/script-runner/script-menu.spec.ts +++ b/playwright/tests/script-runner/script-menu.spec.ts @@ -51,15 +51,13 @@ test('show started scripts', async ({ page, utils }) => { await page.locator('text="Execution Status"').click() await utils.sleep(1000) // Each section has a Refresh button so click the first one - await page.locator('button:has-text("Refresh")').first().click() + await page.getByRole('button', { name: 'Refresh' }).first().click() await expect(page.locator('[data-test=running-scripts]')).toContainText( format(new Date(), 'yyyy_MM_dd'), ) // Get out of the Running Scripts sheet - await page - .locator('#openc3-menu >> text=Script Runner') - .click({ force: true }) + await page.keyboard.press('Escape') await page.locator('[data-test=go-button]').click() await expect(page.locator('[data-test=state] input')).toHaveValue('stopped') await page.locator('[data-test=script-runner-script]').click() diff --git a/playwright/tests/utc-time.spec.ts b/playwright/tests/utc-time.spec.ts index 80c7753ac..c6f33d6cb 100644 --- a/playwright/tests/utc-time.spec.ts +++ b/playwright/tests/utc-time.spec.ts @@ -47,6 +47,7 @@ test.describe('CmdTlmServer', () => { test.use({ toolPath: '/tools/cmdtlmserver', toolName: 'CmdTlmServer', + storageState: 'adminStorageState.json', }) test('displays in local or UTC time', async ({ page, utils }) => { // Allow the table to populate @@ -111,6 +112,7 @@ test.describe('Data Extractor', () => { test.use({ toolPath: '/tools/dataextractor', toolName: 'Data Extractor', + storageState: 'adminStorageState.json', }) test('displays in local or UTC time', async ({ page, utils }) => { @@ -210,6 +212,7 @@ test.describe('Data Viewer', () => { test.use({ toolPath: '/tools/dataviewer', toolName: 'Data Viewer', + storageState: 'adminStorageState.json', }) test('displays in local or UTC time', async ({ page, utils }) => { @@ -285,6 +288,7 @@ test.describe('Packet Viewer', () => { test.use({ toolPath: '/tools/packetviewer', toolName: 'Packet Viewer', + storageState: 'adminStorageState.json', }) test('displays in local or UTC time', async ({ page, utils }) => { @@ -367,6 +371,7 @@ test.describe('Telemetry Grapher', () => { test.use({ toolPath: '/tools/tlmgrapher', toolName: 'Telemetry Grapher', + storageState: 'adminStorageState.json', }) test('displays in local or UTC time', async ({ page, utils }) => {