-
Notifications
You must be signed in to change notification settings - Fork 187
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
c52b20f
commit 8f89f0f
Showing
214 changed files
with
1,464 additions
and
595 deletions.
There are no files selected for viewing
178 changes: 178 additions & 0 deletions
178
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,178 @@ | ||
import { | ||
test, | ||
// expect, | ||
} from '@playwright/test'; | ||
import { | ||
TopPanelButton, | ||
openFileAndAddToCanvas, | ||
selectTopPanelButton, | ||
takeEditorScreenshot, | ||
waitForPageInit, | ||
// saveToFile, | ||
openFile, | ||
// receiveFileComparisonData, | ||
// selectOptionInDropdown, | ||
// pressButton, | ||
selectSnakeLayoutModeTool, | ||
chooseFileFormat, | ||
// readFileContents, | ||
// getFasta, | ||
} from '@utils'; | ||
import { turnOnMacromoleculesEditor } from '@utils/macromolecules'; | ||
|
||
test.describe('Import-Saving .fasta Files', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await waitForPageInit(page); | ||
await turnOnMacromoleculesEditor(page); | ||
}); | ||
|
||
// const fileTypes = ['dna', 'rna', 'peptide']; | ||
// | ||
// for (const fileType of fileTypes) { | ||
// test(`Import .fasta ${fileType} file`, async ({ page }) => { | ||
// // TODO: add selection 'RNA', 'DNA', 'Peptide' to openFileAndAddToCanvas | ||
// await openFileAndAddToCanvas(`FASTA/fasta-${fileType}.fasta`, 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('Import .fasta peptide and when hover to peptide', async ({ | ||
// page, | ||
// }) => { | ||
// await openFileAndAddToCanvas( | ||
// 'FASTA/fasta-peptide.fasta', | ||
// page, | ||
// ); | ||
// await page.getByTestId('select-rectangle').click(); | ||
// await page.getByText('N').locator('..').hover(); | ||
// 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/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-peptides.fasta', | ||
// page, | ||
// ); | ||
// await selectSnakeLayoutModeTool(page); | ||
// const expectedFile = await getFasta(page); | ||
// await saveToFile( | ||
// 'FASTA/fasta-snake-mode-peptides-expected.fasta', | ||
// expectedFile, | ||
// ); | ||
// | ||
// const METADATA_STRING_INDEX = [1]; | ||
// | ||
// const { fileExpected: molFileExpected, file: molFile } = | ||
// await receiveFileComparisonData({ | ||
// page, | ||
// expectedFileName: | ||
// 'tests/test-data/FASTA/fasta-snake-mode-peptides-expected.fasta', | ||
// metaDataIndexes: METADATA_STRING_INDEX, | ||
// }); | ||
// | ||
// expect(molFile).toEqual(molFileExpected); | ||
// }); | ||
|
||
// test('Export to .fasta file', 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 valueInTextarea = await textArea.inputValue(); | ||
// await expect(valueInTextarea).toBe(file); | ||
// }); | ||
|
||
// TODO: add tests for validation validateIfApplicableForFasta function | ||
}); |
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
+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.