Skip to content

Commit

Permalink
#4146 - Macro: UI for Open/Save As FASTA
Browse files Browse the repository at this point in the history
  • Loading branch information
ilya-asiyuk-epam committed Mar 13, 2024
1 parent c52b20f commit 4e6f7aa
Show file tree
Hide file tree
Showing 213 changed files with 1,428 additions and 592 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
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);
// });
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 4e6f7aa

Please sign in to comment.