Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cypress tests for source & target storage #4914

Merged
merged 66 commits into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
1cb1805
Draft version
Marishka17 Aug 2, 2022
1b5232d
Implemented import & fixed export && some code cleanup && some fixes …
Marishka17 Aug 3, 2022
8bf2d3f
Refactoring && fixed several bugs
Marishka17 Aug 5, 2022
c17ac97
Merge branch 'develop' into mk/ui_source_target_storage
Marishka17 Aug 5, 2022
3ddd1d0
Update licence headers && small fixes
Marishka17 Aug 8, 2022
e8388d6
Update remaining licence headers && small changes
Marishka17 Aug 9, 2022
3561d96
Fix part of tests
Marishka17 Aug 10, 2022
b0c1f78
Fix tests
Marishka17 Aug 12, 2022
3600de4
Remove unused code
Marishka17 Aug 12, 2022
b1de375
Fix part of comments
Marishka17 Aug 17, 2022
df848dd
Merge branch 'develop' into mk/ui_source_target_storage
Marishka17 Aug 17, 2022
6d50c55
Some fixes
Marishka17 Aug 21, 2022
2dc3959
Move file download process to job
Marishka17 Aug 24, 2022
f1370dd
Rename methods
Marishka17 Aug 24, 2022
1f885f4
Small fix
Marishka17 Aug 24, 2022
5c85dd6
Fix storages configuration for tasks
Marishka17 Aug 24, 2022
bf740de
Styles
Marishka17 Aug 24, 2022
8de7d8e
Remove unused
Marishka17 Aug 25, 2022
89084fd
Change storage configuration && fix forms reset && some fixes
Marishka17 Aug 26, 2022
12592eb
Update imports
Marishka17 Aug 26, 2022
1af8f18
Remove extra argument type
Marishka17 Aug 26, 2022
4fbab2f
Add catch
Marishka17 Aug 26, 2022
5c1c173
Fix import backup from local
Marishka17 Aug 30, 2022
7520b50
Import architecture refactoring && some fixes
Marishka17 Aug 30, 2022
c4da950
Rename props
Marishka17 Aug 30, 2022
09cb40d
Small reorganization of export architecture && minor fixes
Marishka17 Aug 30, 2022
f50fecd
Remove unused import
Marishka17 Aug 30, 2022
6beff9a
Small fix && skip error notification when no permissions
Marishka17 Aug 31, 2022
d9c478d
Fix project creating
Marishka17 Aug 31, 2022
5ded8f9
Merge branch 'develop' into mk/ui_source_target_storage
Marishka17 Aug 31, 2022
ea7cf98
Fix part of eslint issues
Marishka17 Sep 1, 2022
b9dfd5f
Fix eslint
Marishka17 Sep 1, 2022
1b431cb
Merge branch 'develop' into mk/ui_source_target_storage
Marishka17 Sep 1, 2022
6273953
Fix eslint
Marishka17 Sep 1, 2022
eb8292e
Fix eslint
Marishka17 Sep 1, 2022
d3a3ed9
eslint
Marishka17 Sep 1, 2022
a869e51
Fix some eslint issues
Marishka17 Sep 1, 2022
589f38c
Combine uploadAnnotations and importDataset
Marishka17 Sep 1, 2022
0f2153c
Fix annotation uploading from local
Marishka17 Sep 1, 2022
d5cd18b
Update tests
Marishka17 Sep 2, 2022
d92293c
Fix annotation uploading
Marishka17 Sep 2, 2022
49be69f
Fix notification
Marishka17 Sep 2, 2022
051ea12
Update dependencies
Marishka17 Sep 2, 2022
f6c540e
Merge branch 'develop' into mk/ui_source_target_storage
Marishka17 Sep 2, 2022
486c1fa
fix
Marishka17 Sep 5, 2022
e78db23
Update jest tests
Marishka17 Sep 5, 2022
53f3730
Skip error notification when no permissions
Marishka17 Sep 5, 2022
042043b
Update case 91 92 canvas3d tests
Marishka17 Sep 5, 2022
6e0880e
Styles
Marishka17 Sep 5, 2022
e3ceac6
Update icons
Marishka17 Sep 5, 2022
c468d84
eslint
Marishka17 Sep 5, 2022
4d77e48
eslint
Marishka17 Sep 5, 2022
7a0d4d0
eslint
Marishka17 Sep 5, 2022
4a0d2e7
eslint
Marishka17 Sep 6, 2022
7d444de
Create & delete cloud storage
Marishka17 Sep 6, 2022
e885c43
Common part && export job annotations
Marishka17 Sep 12, 2022
46ca0be
Update tests && add tests for project backup
Marishka17 Sep 13, 2022
b24529d
Merge branch 'develop' into mk/source_target_storage_e2e_tests
Marishka17 Sep 13, 2022
eb5f811
Fix typo
Marishka17 Sep 13, 2022
8f843fa
Rename variables
Marishka17 Sep 13, 2022
9663cc4
debug
Marishka17 Sep 13, 2022
bb6eed0
Revert timeout
Marishka17 Sep 13, 2022
f734a70
Fix server host
Marishka17 Sep 13, 2022
e4797d5
Fix test with project backup restore
Marishka17 Sep 14, 2022
642bc4f
small refactoring
Marishka17 Sep 14, 2022
cedd477
Update issue_2473_import_annotations_frames_dots_in_name
Marishka17 Sep 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ jobs:
-f docker-compose.yml \
-f docker-compose.dev.yml \
-f components/serverless/docker-compose.serverless.yml \
-f tests/docker-compose.minio.yml \
-f tests/docker-compose.file_share.yml up -d

- name: Waiting for server
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ jobs:
-f docker-compose.yml \
-f docker-compose.dev.yml \
-f components/serverless/docker-compose.serverless.yml \
-f tests/docker-compose.minio.yml \
-f tests/docker-compose.file_share.yml up -d

- name: Waiting for server
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/schedule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ jobs:
-f docker-compose.yml \
-f docker-compose.dev.yml \
-f tests/docker-compose.file_share.yml \
-f tests/docker-compose.minio.yml \
-f components/serverless/docker-compose.serverless.yml up -d

- name: Waiting for server
Expand Down
1 change: 1 addition & 0 deletions cvat-core/src/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// SPDX-License-Identifier: MIT

import { Storage } from './storage';

const serverProxy = require('./server-proxy').default;
const Collection = require('./annotations-collection');
const AnnotationsSaver = require('./annotations-saver');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ function SelectCloudStorage(props: Props): JSX.Element {
setSearchPhrase(selectedCloudStorage?.displayName || '');
}}
allowClear
className={`cvat-search${!name ? '-' : `-${name[0].replace('Storage', '-storage')}-`}cloud-storage-field`}
>
<Input />
</AutoComplete>
Expand Down
23 changes: 21 additions & 2 deletions cvat-ui/src/components/storage/storage-field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export default function StorageField(props: Props): JSX.Element {
} = props;
const [cloudStorage, setCloudStorage] = useState<CloudStorage | null>(null);
const [potentialCloudStorage, setPotentialCloudStorage] = useState('');
const [storageType, setStorageType] = useState('');

useEffect(() => {
setStorageType(locationName[0].replace('Storage', '-storage'));
}, [locationName]);

function renderCloudStorage(): JSX.Element {
return (
Expand Down Expand Up @@ -65,16 +70,30 @@ export default function StorageField(props: Props): JSX.Element {
<>
<Form.Item name={locationName}>
<Select
virtual={false}
onChange={(location: StorageLocation) => {
if (onChangeLocationValue) onChangeLocationValue(location);
}}
onClear={() => {
if (onChangeLocationValue) onChangeLocationValue(StorageLocation.LOCAL);
}}
allowClear
className={`cvat-select-${storageType}`}
>
<Option value={StorageLocation.LOCAL}>Local</Option>
<Option value={StorageLocation.CLOUD_STORAGE}>Cloud storage</Option>
<Option
value={StorageLocation.LOCAL}
key={`${storageType}-${StorageLocation.LOCAL.toLowerCase()}`}
className={`cvat-select-${storageType}-location`}
>
Local
</Option>
<Option
value={StorageLocation.CLOUD_STORAGE}
key={`${storageType}-${StorageLocation.CLOUD_STORAGE.toLowerCase()}`}
className={`cvat-select-${storageType}-location`}
>
Cloud storage
</Option>
</Select>
</Form.Item>
{locationValue === StorageLocation.CLOUD_STORAGE && renderCloudStorage()}
Expand Down
1 change: 1 addition & 0 deletions site/content/en/docs/contributing/running-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ description: 'Instructions on how to run all existence tests.'
-f docker-compose.yml \
-f docker-compose.dev.yml \
-f components/serverless/docker-compose.serverless.yml \
-f tests/docker-compose.minio.yml \
-f tests/docker-compose.file_share.yml up -d
```
1. Add test user in CVAT:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
// Copyright (C) 2022 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

/// <reference types="cypress" />

context('Tests source & target storage for backups.', () => {
const backupArchiveName = 'project_backup';
let projectID = '';
let createdCloudStorageId;
const caseId = '117';
const taskName = `Case ${caseId}`;
const labelName = 'car';
const attrName = 'color';
const textDefaultValue = 'red';
const imagesCount = 1;
const imageFileName = `image_${taskName.replace(/\s+/g, '_').toLowerCase()}`;
const width = 800;
const height = 800;
const posX = 10;
const posY = 10;
const color = 'gray';
const dataArchiveName = `${imageFileName}.zip`;
const archivePath = `cypress/fixtures/${dataArchiveName}`;
const imagesFolder = `cypress/fixtures/${imageFileName}`;
const directoryToArchive = imagesFolder;

const serverHost = Cypress.config('baseUrl').includes('3000') ? 'localhost' : 'minio';

const cloudStorageData = {
displayName: 'Demo bucket',
resource: 'public',
manifest: 'manifest.jsonl',
endpointUrl: `http://${serverHost}:9000`,
};

const storageConnectedToCloud = {
location: 'Cloud storage',
cloudStorageId: undefined,
};

const project = {
name: `Case ${caseId}`,
label: labelName,
attrName: 'color',
attrVaue: 'red',
multiAttrParams: false,
advancedConfiguration: {
sourceStorage: {
...storageConnectedToCloud,
displayName: cloudStorageData.displayName,
},
targetStorage: {
...storageConnectedToCloud,
displayName: cloudStorageData.displayName,
},
},
};

const task = {
name: taskName,
label: labelName,
attrName,
textDefaultValue,
dataArchiveName,
multiAttrParams: false,
forProject: true,
attachToProject: true,
projectName: project.name,
advancedConfiguration: {
sourceStorage: {
disableSwitch: true,
location: 'Local',
cloudStorageId: null,
},
targetStorage: {
disableSwitch: true,
location: 'Local',
cloudStorageId: null,
},
},
};

function getProjectID() {
cy.url().then((url) => {
projectID = Number(url.split('/').slice(-1)[0].split('?')[0]);
});
}

before(() => {
cy.visit('auth/login');
cy.login();
createdCloudStorageId = cy.attachS3Bucket(cloudStorageData);
cy.imageGenerator(imagesFolder, imageFileName, width, height, color, posX, posY, labelName, imagesCount);
cy.createZipArchive(directoryToArchive, archivePath);
cy.goToProjectsList();
project.advancedConfiguration.sourceStorage.cloudStorageId = createdCloudStorageId;
project.advancedConfiguration.targetStorage.cloudStorageId = createdCloudStorageId;

cy.createProjects(
project.name,
project.label,
project.attrName,
project.attrVaue,
project.multiAttrParams,
project.advancedConfiguration,
);

cy.goToTaskList();
cy.createAnnotationTask(
task.name,
task.label,
task.attrName,
task.textDefaultValue,
dataArchiveName,
task.multiAttrParams,
null,
task.forProject,
task.attachToProject,
task.projectName,
);
cy.openProject(project.name);
getProjectID();
});

after(() => {
cy.goToCloudStoragesPage();
cy.deleteCloudStorage(cloudStorageData.displayName);
cy.logout();
cy.getAuthKey().then((authKey) => {
cy.deleteProjects(authKey, [project.name]);
});
});

describe(`Testing case "${caseId}"`, () => {
it('Export project to custom local storage', () => {
cy.goToProjectsList();
cy.backupProject(
project.name,
backupArchiveName,
{ location: 'Local' },
false,
);
cy.waitForDownload();
});

it('Export project to default minio bucket', () => {
cy.goToProjectsList();
cy.backupProject(
project.name,
backupArchiveName,
project.advancedConfiguration.targetStorage,
);
cy.waitForFileUploadToCloudStorage();
cy.deleteProject(project.name, projectID);
});

it('Import project from minio bucket', () => {
cy.restoreProject(
`${backupArchiveName}.zip`,
project.advancedConfiguration.sourceStorage,
);
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ context('Import annotations for frames with dots in name.', { browser: '!firefox

it('Upload annotation with YOLO format to job.', () => {
cy.interactMenu('Upload annotations');
cy.intercept('GET', '/api/jobs/**/annotations?**').as('uploadAnnotationsGet');
uploadAnnotation(
dumpType.split(' ')[0],
annotationArchiveName,
'.cvat-modal-content-load-job-annotation',
);
cy.intercept('GET', '/api/jobs/**/annotations?**').as('uploadAnnotationsGet');
cy.wait('@uploadAnnotationsGet').its('response.statusCode').should('equal', 200);
cy.contains('Annotations have been loaded').should('be.visible');
cy.closeNotification('.ant-notification-notice-info');
Expand Down
Loading