-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#4146 - Macro: UI for Open/Save As FASTA
- Loading branch information
1 parent
2beffca
commit eebc37b
Showing
256 changed files
with
2,321 additions
and
596 deletions.
There are no files selected for viewing
Binary file modified
BIN
-142 Bytes
(99%)
...A-and--a69f4-is-counted-separately-when-they-are-connected-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-127 Bytes
(99%)
...onnect-f19ed-y-that-they-are-considered-as-separate-chains-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+115 Bytes
(100%)
...in-tha-632e4--and-ensure-proper-renumbering-in-both-chains-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+92 Bytes
(100%)
...in-tha-76da7--and-ensure-proper-renumbering-in-both-chains-2-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-151 Bytes
(98%)
...-phosp-246e2--from-R2-to-R1-until-it-meets-sugar-with-base-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
187 changes: 187 additions & 0 deletions
187
ketcher-autotests/tests/Macromolecule-editor/Import-Saving-Files/import-saving-fasta.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { | ||
TopPanelButton, | ||
openFileAndAddToCanvas, | ||
selectTopPanelButton, | ||
takeEditorScreenshot, | ||
waitForPageInit, | ||
saveToFile, | ||
openFile, | ||
receiveFileComparisonData, | ||
selectOptionInDropdown, | ||
pressButton, | ||
selectSnakeLayoutModeTool, | ||
chooseFileFormat, | ||
readFileContents, | ||
getFasta, | ||
moveMouseAway, | ||
} from '@utils'; | ||
import { turnOnMacromoleculesEditor } from '@utils/macromolecules'; | ||
|
||
function removeNotComparableData(file: string) { | ||
return file.replaceAll('\r', ''); | ||
} | ||
test.describe('Import-Saving .fasta Files', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await waitForPageInit(page); | ||
await turnOnMacromoleculesEditor(page); | ||
}); | ||
|
||
const fastaFileTypes = ['DNA', 'RNA', 'Peptide'] as const; | ||
|
||
for (const fileType of fastaFileTypes) { | ||
test(`Import .fasta ${fileType} file`, async ({ page }) => { | ||
await openFileAndAddToCanvas( | ||
`FASTA/fasta-${fileType.toLowerCase()}.fasta`, | ||
page, | ||
undefined, | ||
undefined, | ||
fileType, | ||
); | ||
await moveMouseAway(page); | ||
await takeEditorScreenshot(page); | ||
}); | ||
} | ||
|
||
test('Import incorrect data', async ({ page }) => { | ||
const randomText = 'asjfnsalkfl'; | ||
await selectTopPanelButton(TopPanelButton.Open, page); | ||
await page.getByTestId('paste-from-clipboard-button').click(); | ||
await page.getByTestId('open-structure-textarea').fill(randomText); | ||
await chooseFileFormat(page, 'FASTA'); | ||
await page.getByTestId('add-to-canvas-button').click(); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Check import of .ket file and save in .fasta format', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvas('KET/rna-a.ket', page); | ||
const expectedFile = await getFasta(page); | ||
await saveToFile('FASTA/fasta-rna-a-expected.fasta', expectedFile); | ||
|
||
const METADATA_STRING_INDEX = [1]; | ||
|
||
const { fileExpected: fastaFileExpected, file: fastaFile } = | ||
await receiveFileComparisonData({ | ||
page, | ||
expectedFileName: 'tests/test-data/FASTA/fasta-rna-a-expected.fasta', | ||
metaDataIndexes: METADATA_STRING_INDEX, | ||
}); | ||
|
||
expect(fastaFile).toEqual(fastaFileExpected); | ||
|
||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Check that empty file can be saved in .fasta format', async ({ | ||
page, | ||
}) => { | ||
const expectedFile = await getFasta(page); | ||
await saveToFile('FASTA/fasta-empty.fasta', expectedFile); | ||
|
||
const METADATA_STRING_INDEX = [1]; | ||
|
||
const { fileExpected: fastaFileExpected, file: fastaFile } = | ||
await receiveFileComparisonData({ | ||
page, | ||
expectedFileName: 'tests/test-data/FASTA/fasta-empty.fasta', | ||
metaDataIndexes: METADATA_STRING_INDEX, | ||
}); | ||
|
||
expect(fastaFile).toEqual(fastaFileExpected); | ||
}); | ||
|
||
test('Check that system does not let importing empty .fasta file', async ({ | ||
page, | ||
}) => { | ||
await selectTopPanelButton(TopPanelButton.Open, page); | ||
await openFile('FASTA/fasta-empty.fasta', page); | ||
await page.getByText('Add to Canvas').isDisabled(); | ||
}); | ||
|
||
test('Check that system does not let uploading corrupted .fasta file', async ({ | ||
page, | ||
}) => { | ||
await selectTopPanelButton(TopPanelButton.Open, page); | ||
|
||
const filename = 'FASTA/fasta-corrupted.fasta'; | ||
await openFile(filename, page); | ||
await selectOptionInDropdown(filename, page); | ||
await pressButton(page, 'Add to Canvas'); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Validate correct displaying of snake viewed RNA chain loaded from .fasta file format', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvas('FASTA/fasta-snake-mode-rna.fasta', page); | ||
await selectSnakeLayoutModeTool(page); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Check that you can save snake viewed chain of peptides in a .fasta file', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvas('FASTA/fasta-snake-mode-rna.fasta', page); | ||
await selectSnakeLayoutModeTool(page); | ||
const expectedFile = await getFasta(page); | ||
await saveToFile('FASTA/fasta-snake-mode-rna-expected.fasta', expectedFile); | ||
|
||
const METADATA_STRING_INDEX = [1]; | ||
|
||
const { fileExpected: fastaFileExpected, file: fastaFile } = | ||
await receiveFileComparisonData({ | ||
page, | ||
expectedFileName: | ||
'tests/test-data/FASTA/fasta-snake-mode-rna-expected.fasta', | ||
metaDataIndexes: METADATA_STRING_INDEX, | ||
}); | ||
|
||
expect(fastaFile).toEqual(fastaFileExpected); | ||
}); | ||
|
||
test('Should open .ket file and modify to .fasta format in save modal textarea', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvas('KET/rna-a.ket', page); | ||
await selectTopPanelButton(TopPanelButton.Save, page); | ||
await chooseFileFormat(page, 'FASTA'); | ||
await page | ||
.getByTestId('dropdown-select') | ||
.getByRole('combobox') | ||
.allInnerTexts(); | ||
|
||
const textArea = page.getByTestId('preview-area-text'); | ||
const file = await readFileContents( | ||
'tests/test-data/FASTA/fasta-rna-a.fasta', | ||
); | ||
const expectedData = removeNotComparableData(file); | ||
const valueInTextarea = removeNotComparableData( | ||
await textArea.inputValue(), | ||
); | ||
expect(valueInTextarea).toBe(expectedData); | ||
}); | ||
|
||
// Should not convert to Fasta type in case of there are more than one monomer type | ||
test('Should not convert .ket file with RNA and Peptide to .fasta format in save modal', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvas('KET/rna-and-peptide.ket', page); | ||
await selectTopPanelButton(TopPanelButton.Save, page); | ||
await chooseFileFormat(page, 'FASTA'); | ||
|
||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
// Should not convert to Fasta type in case of there is any CHEM | ||
test('Should not convert .ket file with CHEMs to .fasta format in save modal', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvas('KET/chems-not-connected.ket', page); | ||
await selectTopPanelButton(TopPanelButton.Save, page); | ||
await chooseFileFormat(page, 'FASTA'); | ||
|
||
await takeEditorScreenshot(page); | ||
}); | ||
}); |
Binary file added
BIN
+5.62 KB
...ta-Files-Check-import-of-ket-file-and-save-in-fasta-format-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.5 KB
...ck-that-system-does-not-let-uploading-corrupted-fasta-file-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+9.01 KB
...-snapshots/Import-Saving-fasta-Files-Import-fasta-DNA-file-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+11.5 KB
...pshots/Import-Saving-fasta-Files-Import-fasta-Peptide-file-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+8.92 KB
...-snapshots/Import-Saving-fasta-Files-Import-fasta-RNA-file-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+36.5 KB
...-snapshots/Import-Saving-fasta-Files-Import-incorrect-data-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35 KB
...onvert--67032-NA-and-Peptide-to-fasta-format-in-save-modal-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+34.8 KB
...-convert-ket-file-with-CHEMs-to-fasta-format-in-save-modal-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+18.8 KB
...rect-di-57433-ewed-RNA-chain-loaded-from-fasta-file-format-1-chromium-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.