From 5f892e0550263c32abac30f9e7de758c543bc4cc Mon Sep 17 00:00:00 2001
From: "Anna (Anya) Parker" <50943381+anna-parker@users.noreply.github.com>
Date: Fri, 26 Apr 2024 17:11:33 +0200
Subject: [PATCH] Remove unused substitutionsToCommaSeparatedString function,
additionally increase timeout.
---
website/playwright.config.ts | 1 +
.../SequenceDetailsPage/DataTable.astro | 11 ++--
.../SequenceDetailsPage/MutationBadge.tsx | 52 ++++++++-----------
.../SequenceDetailsPage/getTableData.spec.ts | 6 ++-
.../SequenceDetailsPage/getTableData.ts | 11 +---
.../tests/pages/sequences/sequences.page.ts | 2 +-
6 files changed, 38 insertions(+), 45 deletions(-)
diff --git a/website/playwright.config.ts b/website/playwright.config.ts
index c9c5e8098d..bde2410cc5 100644
--- a/website/playwright.config.ts
+++ b/website/playwright.config.ts
@@ -19,6 +19,7 @@ export default defineConfig({
screenshot: 'only-on-failure',
},
globalSetup: './tests/playwrightSetup.ts',
+ timeout: 2 * 60 * 1000, // Extend further if we get timeouts in CI
projects: [
{
diff --git a/website/src/components/SequenceDetailsPage/DataTable.astro b/website/src/components/SequenceDetailsPage/DataTable.astro
index dc8ab9cbfb..dbfd3475da 100644
--- a/website/src/components/SequenceDetailsPage/DataTable.astro
+++ b/website/src/components/SequenceDetailsPage/DataTable.astro
@@ -25,12 +25,15 @@ const headerMap = toHeaderMap(tableData);
{label} |
-
+
{customDisplay === undefined && value}
{customDisplay !== undefined &&
- customDisplay.type === 'badge' &&
- (customDisplay.value === undefined ? '' : )
- }
+ customDisplay.type === 'badge' &&
+ (customDisplay.value === undefined ? (
+ ''
+ ) : (
+
+ ))}
{customDisplay !== undefined &&
customDisplay.type === 'link' &&
customDisplay.url !== undefined && (
diff --git a/website/src/components/SequenceDetailsPage/MutationBadge.tsx b/website/src/components/SequenceDetailsPage/MutationBadge.tsx
index 50106e2882..748465403e 100644
--- a/website/src/components/SequenceDetailsPage/MutationBadge.tsx
+++ b/website/src/components/SequenceDetailsPage/MutationBadge.tsx
@@ -1,4 +1,5 @@
import { type FC } from 'react';
+
import type { MutationProportionCount } from '../../types/lapis';
type NucSubProps = {
@@ -16,42 +17,35 @@ export type AaSub = {
export const NucSubBadge: FC = ({ pos, mutationTo, mutationFrom }) => {
return (
-
-
- {', '}
+
+
);
};
export const AaSubBadge: FC = ({ pos, mutationTo, mutationFrom, gene }) => {
return (
-
-
- {', '}
+
+
);
};
@@ -114,7 +108,7 @@ export function getAaColor(aa: string): string {
export const SubstitutionsContainer = ({ values }: { values: MutationProportionCount[] }) => {
return values.map(({ mutationFrom, mutationTo, position, sequenceName }) =>
- sequenceName === undefined ? (
+ sequenceName === null ? (
) : (
diff --git a/website/src/components/SequenceDetailsPage/getTableData.spec.ts b/website/src/components/SequenceDetailsPage/getTableData.spec.ts
index e18ae4ab82..a349bd6cbf 100644
--- a/website/src/components/SequenceDetailsPage/getTableData.spec.ts
+++ b/website/src/components/SequenceDetailsPage/getTableData.spec.ts
@@ -151,7 +151,7 @@ describe('getTableData', () => {
expect(data).toContainEqual({
label: 'Nucleotide substitutions',
name: 'nucleotideSubstitutions',
- value: 'T10A, C30G',
+ value: '',
header: 'Mutations, insertions, deletions',
customDisplay: {
type: 'badge',
@@ -163,6 +163,7 @@ describe('getTableData', () => {
mutationTo: 'A',
position: 10,
proportion: 0,
+ sequenceName: null,
},
{
count: 0,
@@ -171,6 +172,7 @@ describe('getTableData', () => {
mutationTo: 'G',
position: 30,
proportion: 0,
+ sequenceName: null,
},
],
},
@@ -184,7 +186,7 @@ describe('getTableData', () => {
expect(data).toContainEqual({
label: 'Amino acid substitutions',
name: 'aminoAcidSubstitutions',
- value: 'gene1:N10Y, gene1:T30N',
+ value: '',
header: 'Mutations, insertions, deletions',
customDisplay: {
type: 'badge',
diff --git a/website/src/components/SequenceDetailsPage/getTableData.ts b/website/src/components/SequenceDetailsPage/getTableData.ts
index 18a3d3872c..1adff2ebec 100644
--- a/website/src/components/SequenceDetailsPage/getTableData.ts
+++ b/website/src/components/SequenceDetailsPage/getTableData.ts
@@ -124,7 +124,7 @@ function toTableData(config: Schema) {
{
label: 'Nucleotide substitutions',
name: 'nucleotideSubstitutions',
- value: substitutionsToCommaSeparatedString(nucleotideMutations),
+ value: '',
header: 'Mutations, insertions, deletions',
customDisplay: { type: 'badge', value: substitutionsList(nucleotideMutations) },
},
@@ -143,7 +143,7 @@ function toTableData(config: Schema) {
{
label: 'Amino acid substitutions',
name: 'aminoAcidSubstitutions',
- value: substitutionsToCommaSeparatedString(aminoAcidMutations),
+ value: '',
header: 'Mutations, insertions, deletions',
customDisplay: { type: 'badge', value: substitutionsList(aminoAcidMutations) },
},
@@ -177,13 +177,6 @@ function mapValueToDisplayedValue(value: undefined | null | string | number, met
return value;
}
-function substitutionsToCommaSeparatedString(mutationData: MutationProportionCount[]) {
- return mutationData
- .filter((m) => m.mutationTo !== '-')
- .map((m) => m.mutation)
- .join(', ');
-}
-
function substitutionsList(mutationData: MutationProportionCount[]) {
return mutationData.filter((m) => m.mutationTo !== '-');
}
diff --git a/website/tests/pages/sequences/sequences.page.ts b/website/tests/pages/sequences/sequences.page.ts
index 3ef7d3de91..025aa203d5 100644
--- a/website/tests/pages/sequences/sequences.page.ts
+++ b/website/tests/pages/sequences/sequences.page.ts
@@ -36,7 +36,7 @@ export class SequencePage {
}
public async loadSequences() {
- await expect(this.loadButton).toBeVisible();
+ await expect(this.loadButton).toBeVisible({ timeout: 60000 });
await this.loadButton.click();
}
|