-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
960d557
commit cbcc91c
Showing
34 changed files
with
245 additions
and
9 deletions.
There are no files selected for viewing
190 changes: 190 additions & 0 deletions
190
...r-autotests/tests/Macromolecule-editor/Import-Saving-Files/import-saving-sequence.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,190 @@ | ||
import { test, expect } from '@playwright/test'; | ||
import { | ||
TopPanelButton, | ||
openFileAndAddToCanvasMacro, | ||
selectTopPanelButton, | ||
takeEditorScreenshot, | ||
waitForPageInit, | ||
saveToFile, | ||
openFile, | ||
receiveFileComparisonData, | ||
selectOptionInDropdown, | ||
pressButton, | ||
selectSnakeLayoutModeTool, | ||
chooseFileFormat, | ||
readFileContents, | ||
getSequence, | ||
moveMouseAway, | ||
} from '@utils'; | ||
import { turnOnMacromoleculesEditor } from '@utils/macromolecules'; | ||
|
||
test.describe('Import-Saving .seq Files', () => { | ||
test.beforeEach(async ({ page }) => { | ||
await waitForPageInit(page); | ||
await turnOnMacromoleculesEditor(page); | ||
}); | ||
|
||
const sequenceFileTypes = ['DNA', 'RNA', 'Peptide'] as const; | ||
|
||
for (const fileType of sequenceFileTypes) { | ||
test(`Import .seq ${fileType} file`, async ({ page }) => { | ||
await openFileAndAddToCanvasMacro( | ||
`Sequence/sequence-${fileType.toLowerCase()}.seq`, | ||
page, | ||
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, 'Sequence'); | ||
await page.getByTestId('add-to-canvas-button').click(); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Check import of .ket file and save in .seq format', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvasMacro('KET/rna-a.ket', page); | ||
const expectedFile = await getSequence(page); | ||
await saveToFile('Sequence/sequence-rna-a-expected.seq', expectedFile); | ||
|
||
const METADATA_STRING_INDEX = [1]; | ||
|
||
const { fileExpected: sequenceFileExpected, file: sequenceFile } = | ||
await receiveFileComparisonData({ | ||
page, | ||
expectedFileName: | ||
'tests/test-data/Sequence/sequence-rna-a-expected.seq', | ||
metaDataIndexes: METADATA_STRING_INDEX, | ||
}); | ||
|
||
expect(sequenceFile).toEqual(sequenceFileExpected); | ||
|
||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Check that empty file can be saved in .seq format', async ({ | ||
page, | ||
}) => { | ||
const expectedFile = await getSequence(page); | ||
await saveToFile('Sequence/sequence-empty.seq', expectedFile); | ||
|
||
const METADATA_STRING_INDEX = [1]; | ||
|
||
const { fileExpected: sequenceFileExpected, file: sequenceFile } = | ||
await receiveFileComparisonData({ | ||
page, | ||
expectedFileName: 'tests/test-data/Sequence/sequence-empty.seq', | ||
metaDataIndexes: METADATA_STRING_INDEX, | ||
}); | ||
|
||
expect(sequenceFile).toEqual(sequenceFileExpected); | ||
}); | ||
|
||
test('Check that system does not let importing empty .seq file', async ({ | ||
page, | ||
}) => { | ||
await selectTopPanelButton(TopPanelButton.Open, page); | ||
await openFile('Sequence/sequence-empty.seq', page); | ||
await page.getByText('Add to Canvas').isDisabled(); | ||
}); | ||
|
||
test('Check that system does not let uploading corrupted .seq file', async ({ | ||
page, | ||
}) => { | ||
await selectTopPanelButton(TopPanelButton.Open, page); | ||
|
||
const filename = 'Sequence/sequence-corrupted.seq'; | ||
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 .seq file format', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvasMacro( | ||
'Sequence/sequence-snake-mode-rna.seq', | ||
page, | ||
); | ||
await selectSnakeLayoutModeTool(page); | ||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
test('Check that you can save snake viewed chain of peptides in a .seq file', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvasMacro( | ||
'Sequence/sequence-snake-mode-rna.seq', | ||
page, | ||
); | ||
await selectSnakeLayoutModeTool(page); | ||
const expectedFile = await getSequence(page); | ||
await saveToFile( | ||
'Sequence/sequence-snake-mode-rna-expected.seq', | ||
expectedFile, | ||
); | ||
|
||
const METADATA_STRING_INDEX = [1]; | ||
|
||
const { fileExpected: sequenceFileExpected, file: sequenceFile } = | ||
await receiveFileComparisonData({ | ||
page, | ||
expectedFileName: | ||
'tests/test-data/Sequence/sequence-snake-mode-rna-expected.seq', | ||
metaDataIndexes: METADATA_STRING_INDEX, | ||
}); | ||
|
||
expect(sequenceFile).toEqual(sequenceFileExpected); | ||
}); | ||
|
||
test('Should open .ket file and modify to .seq format in save modal textarea', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvasMacro('KET/rna-a.ket', page); | ||
await selectTopPanelButton(TopPanelButton.Save, page); | ||
await chooseFileFormat(page, 'Sequence'); | ||
await page | ||
.getByTestId('dropdown-select') | ||
.getByRole('combobox') | ||
.allInnerTexts(); | ||
|
||
const textArea = page.getByTestId('preview-area-text'); | ||
const file = await readFileContents( | ||
'tests/test-data/Sequence/sequence-rna-a.seq', | ||
); | ||
const expectedData = file; | ||
const valueInTextarea = await textArea.inputValue(); | ||
expect(valueInTextarea).toBe(expectedData); | ||
}); | ||
|
||
// Should not convert to Sequence type in case of there are more than one monomer type | ||
test('Should not convert .ket file with RNA and Peptide to .seq format in save modal', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvasMacro('KET/rna-and-peptide.ket', page); | ||
await selectTopPanelButton(TopPanelButton.Save, page); | ||
await chooseFileFormat(page, 'Sequence'); | ||
|
||
await takeEditorScreenshot(page); | ||
}); | ||
|
||
// Should not convert to Sequence type in case of there is any CHEM | ||
test('Should not convert .ket file with CHEMs to .seq format in save modal', async ({ | ||
page, | ||
}) => { | ||
await openFileAndAddToCanvasMacro('KET/chems-not-connected.ket', page); | ||
await selectTopPanelButton(TopPanelButton.Save, page); | ||
await chooseFileFormat(page, 'Sequence'); | ||
|
||
await takeEditorScreenshot(page); | ||
}); | ||
}); |
Binary file added
BIN
+5.67 KB
...-seq-Files-Check-import-of-ket-file-and-save-in-seq-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
+37.9 KB
...heck-that-system-does-not-let-uploading-corrupted-seq-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
+37.9 KB
...ts-snapshots/Import-Saving-seq-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
+9.36 KB
...c.ts-snapshots/Import-Saving-seq-Files-Import-seq-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
...-snapshots/Import-Saving-seq-Files-Import-seq-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
+9.31 KB
...c.ts-snapshots/Import-Saving-seq-Files-Import-seq-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
+35.4 KB
...nvert-k-24fc3--RNA-and-Peptide-to-seq-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
+35.2 KB
...ot-convert-ket-file-with-CHEMs-to-seq-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
+19.3 KB
...ct-disp-527b1-viewed-RNA-chain-loaded-from-seq-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.
1 change: 1 addition & 0 deletions
1
ketcher-autotests/tests/test-data/Sequence/sequence-corrupted.seq
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 @@ | ||
12w12r23e32e33 |
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 @@ | ||
TCCAGCCATTGTGATTGCATGTTCCCAGGTTGAGGTAGTAGGTTGTATAGTTTAGAATTACATCAAGGGAGATAACTGTACAGCCTCCTAGCTTTCCTTGGGTCTTGCACAAAGCAACATGGCGAGA |
Empty file.
1 change: 1 addition & 0 deletions
1
ketcher-autotests/tests/test-data/Sequence/sequence-peptide.seq
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 @@ | ||
MIIGYVIGQATTQEALILAERPVRLGTYVVLEYDNVKALGLITNVTRGSPLLDDNMNDIEIVQRLKQFNNSIPVYTKAKVKLLCDMNNHFLMPDIPPFAGTPAREAEDEELKSIYSQDGQIRIGSLIGKNVEVKLNINSFARHLAILAATGSGKSNTVAVLSQRISELGGSVLIFDYHGEYYDSDIKNLNRIEPKLNPLYMTPREFSTLLEIRENAIIQYRILRRAFIKVTNGIRAALAAGQIPFSTLNSQFYELMADALETQGNSDKKSSAKDEVLNKFEEFMDRYSNVIDLTSSDIIEKVKRGKVNVVSLTQLDEDSMDAVVSHYLRRILDSRKDFKRSKNSGLKFPIIAVIEEAHVFLSKNENTLTKYWASRIAREGRKFGVGLTIVSQRPKGLDENILSQMTNKIILKIIEPTDKKYILESSDNLSEDLAEQLSSLDVGEAIIIGKIVKLPAVVKIDMFEGKLLGSDPDMIGEWKKVAASEKIAKGFADFGTEIGD |
1 change: 1 addition & 0 deletions
1
ketcher-autotests/tests/test-data/Sequence/sequence-rna-a-expected.seq
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 @@ | ||
A |
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 @@ | ||
A |
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 @@ | ||
UCCAGCCAUUGUGAUUGCAUGUUCCCAGGUUGAGGUAGUAGGUUGUAUAGUUUAGAAUUACAUCAAGGGAGAUAACUGUACAGCCUCCUAGCUUUCCUUGGGUCUUGCACAAAGCAACAUGGCGAGA |
1 change: 1 addition & 0 deletions
1
ketcher-autotests/tests/test-data/Sequence/sequence-snake-mode-rna-expected.seq
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 @@ | ||
CCCCCCCCCCCCCCCCCCCCCCCCCCC |
1 change: 1 addition & 0 deletions
1
ketcher-autotests/tests/test-data/Sequence/sequence-snake-mode-rna.seq
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 @@ | ||
CCCCCCCCCCCCCCCCCCCCCCCCCCC |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Oops, something went wrong.