diff --git a/e2e-tests/fixtures/ExternalSources.ts b/e2e-tests/fixtures/ExternalSources.ts index a7e56a5d84..0401b7c19b 100644 --- a/e2e-tests/fixtures/ExternalSources.ts +++ b/e2e-tests/fixtures/ExternalSources.ts @@ -74,27 +74,30 @@ export class ExternalSources { await expect(this.page.getByRole('row', { name: typeName })).toBeVisible(); } async deleteDerivationGroup(derivationGroupName: string) { - await this.page.getByRole('button', { exact: true, name: 'Derivation Group' }).click(); - await this.page.getByRole('row', { name: derivationGroupName }).hover(); - await this.page.getByRole('row', { name: derivationGroupName }).getByLabel('Delete Derivation Group').click(); - await this.page.getByRole('button', { exact: true, name: 'Delete' }).click(); - await expect(this.page.getByRole('row', { name: derivationGroupName })).not.toBeVisible(); + if (await this.page.getByRole('row', { name: derivationGroupName }).isVisible()) { + await this.page.getByRole('row', { name: derivationGroupName }).hover(); + await this.page.getByRole('row', { name: derivationGroupName }).getByLabel('Delete Derivation Group').click(); + await this.page.getByRole('button', { exact: true, name: 'Delete' }).click(); + await expect(this.page.getByRole('row', { name: derivationGroupName })).not.toBeVisible(); + } } async deleteExternalEventType(eventTypeName: string) { - await this.page.getByRole('button', { exact: true, name: 'External Event Type' }).click(); - await this.page.getByRole('row', { name: eventTypeName }).hover(); - await this.page.getByRole('row', { name: eventTypeName }).getByLabel('Delete External Event Type').click(); - await this.page.getByRole('button', { exact: true, name: 'Delete' }).click(); - await expect(this.page.getByRole('row', { name: eventTypeName })).not.toBeVisible(); + if (await this.page.getByRole('row', { name: eventTypeName }).isVisible()) { + await this.page.getByRole('row', { name: eventTypeName }).hover(); + await this.page.getByRole('row', { name: eventTypeName }).getByLabel('Delete External Event Type').click(); + await this.page.getByRole('button', { exact: true, name: 'Delete' }).click(); + await expect(this.page.getByRole('row', { name: eventTypeName })).not.toBeVisible(); + } } async deleteExternalSourceType(sourceTypeName: string) { - await this.page.getByRole('button', { exact: true, name: 'External Source Type' }).click(); - await this.page.getByRole('row', { name: sourceTypeName }).hover(); - await this.page.getByRole('row', { name: sourceTypeName }).getByLabel('Delete External Source Type').click(); - await this.page.getByRole('button', { exact: true, name: 'Delete' }).click(); - await expect(this.page.getByRole('row', { name: sourceTypeName })).not.toBeVisible(); + if (await this.page.getByRole('row', { name: sourceTypeName }).isVisible()) { + await this.page.getByRole('row', { name: sourceTypeName }).hover(); + await this.page.getByRole('row', { name: sourceTypeName }).getByLabel('Delete External Source Type').click(); + await this.page.getByRole('button', { exact: true, name: 'Delete' }).click(); + await expect(this.page.getByRole('row', { name: sourceTypeName })).not.toBeVisible(); + } } async deleteSource(sourceName: string) { diff --git a/src/components/external-source/ExternalTypeManager.svelte b/src/components/external-source/ExternalTypeManager.svelte index 9b63d79012..827e3c9d6f 100644 --- a/src/components/external-source/ExternalTypeManager.svelte +++ b/src/components/external-source/ExternalTypeManager.svelte @@ -26,7 +26,11 @@ import type { ParametersMap } from '../../types/parameter'; import type { ValueSchema } from '../../types/schema'; import effects from '../../utilities/effects'; - import { getDerivationGroupRowId, getExternalEventTypeRowId, getExternalSourceTypeRowId } from '../../utilities/externalEvents'; + import { + getDerivationGroupRowId, + getExternalEventTypeRowId, + getExternalSourceTypeRowId, + } from '../../utilities/externalEvents'; import { parseJSONStream } from '../../utilities/generic'; import { showDeleteDerivationGroupModal, showDeleteExternalEventSourceTypeModal } from '../../utilities/modal'; import { getFormParameters, translateJsonSchemaToValueSchema } from '../../utilities/parameters'; @@ -476,11 +480,7 @@ if (file !== undefined && /\.json$/.test(file.name)) { uploadResponseErrors = []; const combinedSchema = await parseJSONStream<{ event_types: object; source_types: object }>(file.stream()); - await effects.createExternalSourceEventTypes( - combinedSchema.event_types, - combinedSchema.source_types, - user, - ); + await effects.createExternalSourceEventTypes(combinedSchema.event_types, combinedSchema.source_types, user); files = undefined; file = undefined; if (fileInput != null) {