Cypress tests for source & target storage (#4914)
* Draft version * Implemented import & fixed export && some code cleanup && some fixes && updated notifications * Refactoring && fixed several bugs * Update licence headers && small fixes * Update remaining licence headers && small changes * Fix part of tests * Fix tests * Remove unused code * Fix part of comments * Some fixes * Move file download process to job * Rename methods * Small fix * Fix storages configuration for tasks * Styles * Remove unused * Change storage configuration && fix forms reset && some fixes * Update imports * Remove extra argument type * Add catch * Fix import backup from local * Import architecture refactoring && some fixes * Rename props * Small reorganization of export architecture && minor fixes * Remove unused import * Small fix && skip error notification when no permissions * Fix project creating * Fix part of eslint issues * Fix eslint * Fix eslint * Fix eslint * eslint * Fix some eslint issues * Combine uploadAnnotations and importDataset * Fix annotation uploading from local * Update tests * Fix annotation uploading * Fix notification * Update dependencies * fix * Update jest tests * Skip error notification when no permissions * Update case 91 92 canvas3d tests * Styles * Update icons * eslint * eslint * eslint * eslint * Create & delete cloud storage * Common part && export job annotations * Update tests && add tests for project backup * Fix typo * Rename variables * debug * Revert timeout * Fix server host * Fix test with project backup restore * small refactoring * Update issue_2473_import_annotations_frames_dots_in_namemain
parent
79dcc0e0cf
commit
56e8c1eb82
@ -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,
|
||||
);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,185 @@
|
||||
// Copyright (C) 2022 CVAT.ai Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
context('Tests for source and target storage.', () => {
|
||||
let createdCloudStorageId;
|
||||
|
||||
const caseId = '113';
|
||||
|
||||
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 format = 'CVAT for images';
|
||||
|
||||
const createRectangleShape2Points = {
|
||||
points: 'By 2 Points',
|
||||
type: 'Shape',
|
||||
labelName,
|
||||
firstX: 250,
|
||||
firstY: 350,
|
||||
secondX: 350,
|
||||
secondY: 450,
|
||||
};
|
||||
|
||||
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,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
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,
|
||||
);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
cy.goToCloudStoragesPage();
|
||||
cy.deleteCloudStorage(cloudStorageData.displayName);
|
||||
cy.logout();
|
||||
cy.getAuthKey().then((authKey) => {
|
||||
cy.deleteProjects(authKey, [project.name]);
|
||||
});
|
||||
});
|
||||
|
||||
describe(`Testing case "${caseId}"`, () => {
|
||||
it('Export job annotations to default minio bucket that was attached to the project.', () => {
|
||||
// create an annotation task with default project source and target storages
|
||||
cy.goToTaskList();
|
||||
cy.createAnnotationTask(
|
||||
task.name,
|
||||
task.label,
|
||||
task.attrName,
|
||||
task.textDefaultValue,
|
||||
dataArchiveName,
|
||||
task.multiAttrParams,
|
||||
null,
|
||||
task.forProject,
|
||||
task.attachToProject,
|
||||
task.projectName,
|
||||
);
|
||||
cy.goToTaskList();
|
||||
cy.openTask(task.name);
|
||||
|
||||
// create dummy annotations and export them to "public" minio bucket
|
||||
cy.openJob();
|
||||
cy.createRectangle(createRectangleShape2Points).then(() => {
|
||||
Cypress.config('scrollBehavior', false);
|
||||
});
|
||||
cy.saveJob('PATCH', 200, 'saveJobDump');
|
||||
const exportParams = {
|
||||
type: 'annotations',
|
||||
format,
|
||||
archiveCustomeName: 'job_annotations',
|
||||
targetStorage: project.advancedConfiguration.targetStorage,
|
||||
};
|
||||
cy.exportJob(exportParams);
|
||||
cy.waitForFileUploadToCloudStorage();
|
||||
|
||||
// remove annotations
|
||||
cy.removeAnnotations();
|
||||
cy.saveJob('PUT');
|
||||
cy.get('#cvat_canvas_shape_1').should('not.exist');
|
||||
cy.get('#cvat-objects-sidebar-state-item-1').should('not.exist');
|
||||
});
|
||||
|
||||
it('Import job annotations from default minio bucket that was attached to the project.', () => {
|
||||
// upload annotations from "public" minio bucket
|
||||
cy.interactMenu('Upload annotations');
|
||||
cy.intercept('GET', '/api/jobs/**/annotations?**').as('uploadAnnotationsGet');
|
||||
|
||||
cy.uploadAnnotations(
|
||||
format.split(' ')[0],
|
||||
'job_annotations.zip',
|
||||
'.cvat-modal-content-load-job-annotation',
|
||||
project.advancedConfiguration.sourceStorage,
|
||||
);
|
||||
|
||||
cy.get('.cvat-notification-notice-upload-annotations-fail').should('not.exist');
|
||||
cy.get('#cvat_canvas_shape_1').should('exist');
|
||||
cy.get('#cvat-objects-sidebar-state-item-1').should('exist');
|
||||
|
||||
cy.goToTaskList();
|
||||
cy.deleteTask(task.name);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,194 @@
|
||||
// Copyright (C) 2022 CVAT.ai Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
context('Tests for source and target storage.', () => {
|
||||
let annotationsArchiveName = '';
|
||||
let createdCloudStorageId;
|
||||
|
||||
const caseId = '114';
|
||||
|
||||
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 format = 'CVAT for images';
|
||||
|
||||
const createRectangleShape2Points = {
|
||||
points: 'By 2 Points',
|
||||
type: 'Shape',
|
||||
labelName,
|
||||
firstX: 250,
|
||||
firstY: 350,
|
||||
secondX: 350,
|
||||
secondY: 450,
|
||||
};
|
||||
|
||||
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,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
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,
|
||||
);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
cy.goToCloudStoragesPage();
|
||||
cy.deleteCloudStorage(cloudStorageData.displayName);
|
||||
cy.logout();
|
||||
cy.getAuthKey().then((authKey) => {
|
||||
cy.deleteProjects(authKey, [project.name]);
|
||||
});
|
||||
});
|
||||
|
||||
describe(`Testing case "${caseId}"`, () => {
|
||||
it('Export job annotations to default minio bucket that was attached to the task in the project.', () => {
|
||||
// create an annotation task with custom local source & target storages
|
||||
cy.goToTaskList();
|
||||
cy.createAnnotationTask(
|
||||
task.name,
|
||||
task.label,
|
||||
task.attrName,
|
||||
task.textDefaultValue,
|
||||
dataArchiveName,
|
||||
task.multiAttrParams,
|
||||
task.advancedConfiguration,
|
||||
task.forProject,
|
||||
task.attachToProject,
|
||||
task.projectName,
|
||||
);
|
||||
cy.goToTaskList();
|
||||
cy.openTask(task.name);
|
||||
|
||||
// create dummy annotations and export them to default local storage
|
||||
cy.openJob();
|
||||
cy.createRectangle(createRectangleShape2Points).then(() => {
|
||||
Cypress.config('scrollBehavior', false);
|
||||
});
|
||||
|
||||
cy.saveJob('PATCH', 200, 'saveJobDump');
|
||||
const exportParams = {
|
||||
type: 'annotations',
|
||||
format,
|
||||
archiveCustomeName: 'job_annotations',
|
||||
targetStorage: project.advancedConfiguration.targetStorage,
|
||||
};
|
||||
cy.exportJob(exportParams);
|
||||
cy.getDownloadFileName().then((file) => {
|
||||
annotationsArchiveName = file;
|
||||
cy.verifyDownload(annotationsArchiveName);
|
||||
});
|
||||
cy.verifyNotification();
|
||||
|
||||
// remove annotations
|
||||
cy.removeAnnotations();
|
||||
cy.saveJob('PUT');
|
||||
cy.get('#cvat_canvas_shape_1').should('not.exist');
|
||||
cy.get('#cvat-objects-sidebar-state-item-1').should('not.exist');
|
||||
});
|
||||
|
||||
it('Import job annotations from default minio bucket that was attached to the task in the project.', () => {
|
||||
cy.goToTaskList();
|
||||
cy.openTask(task.name);
|
||||
cy.openJob();
|
||||
|
||||
// upload annotations from default local storage
|
||||
cy.interactMenu('Upload annotations');
|
||||
cy.intercept('GET', '/api/jobs/**/annotations?**').as('uploadAnnotationsGet');
|
||||
cy.uploadAnnotations(
|
||||
format.split(' ')[0],
|
||||
annotationsArchiveName,
|
||||
'.cvat-modal-content-load-job-annotation',
|
||||
task.advancedConfiguration.sourceStorage,
|
||||
);
|
||||
|
||||
cy.get('.cvat-notification-notice-upload-annotations-fail').should('not.exist');
|
||||
cy.get('#cvat_canvas_shape_1').should('exist');
|
||||
cy.get('#cvat-objects-sidebar-state-item-1').should('exist');
|
||||
|
||||
cy.goToTaskList();
|
||||
cy.deleteTask(task.name);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,155 @@
|
||||
// Copyright (C) 2022 CVAT.ai Corporation
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
context('Import and export annotations: specify source and target storage in modals.', () => {
|
||||
let createdCloudStorageId;
|
||||
const caseId = '115';
|
||||
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 format = 'CVAT for images';
|
||||
|
||||
const createRectangleShape2Points = {
|
||||
points: 'By 2 Points',
|
||||
type: 'Shape',
|
||||
labelName,
|
||||
firstX: 250,
|
||||
firstY: 350,
|
||||
secondX: 350,
|
||||
secondY: 450,
|
||||
};
|
||||
|
||||
const serverHost = Cypress.config('baseUrl').includes('3000') ? 'localhost' : 'minio';
|
||||
|
||||
const cloudStorageData = {
|
||||
displayName: 'Demo bucket',
|
||||
resource: 'public',
|
||||
manifest: 'manifest.jsonl',
|
||||
endpointUrl: `http://${serverHost}:9000`,
|
||||
};
|
||||
|
||||
const project = {
|
||||
name: `Case ${caseId}`,
|
||||
label: labelName,
|
||||
attrName: 'color',
|
||||
attrVaue: 'red',
|
||||
multiAttrParams: false,
|
||||
};
|
||||
|
||||
const task = {
|
||||
name: taskName,
|
||||
label: labelName,
|
||||
attrName,
|
||||
textDefaultValue,
|
||||
dataArchiveName,
|
||||
multiAttrParams: false,
|
||||
forProject: true,
|
||||
attachToProject: true,
|
||||
projectName: project.name,
|
||||
};
|
||||
|
||||
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();
|
||||
|
||||
cy.createProjects(
|
||||
project.name,
|
||||
project.label,
|
||||
project.attrName,
|
||||
project.attrVaue,
|
||||
project.multiAttrParams,
|
||||
);
|
||||
});
|
||||
|
||||
after(() => {
|
||||
cy.goToCloudStoragesPage();
|
||||
cy.deleteCloudStorage(cloudStorageData.displayName);
|
||||
cy.logout();
|
||||
cy.getAuthKey().then((authKey) => {
|
||||
cy.deleteProjects(authKey, [project.name]);
|
||||
});
|
||||
});
|
||||
|
||||
describe(`Testing case "${caseId}"`, () => {
|
||||
it('Export job annotations to custom minio bucket', () => {
|
||||
// create an annotation task with local source & target storages
|
||||
cy.goToTaskList();
|
||||
cy.createAnnotationTask(
|
||||
task.name,
|
||||
task.label,
|
||||
task.attrName,
|
||||
task.textDefaultValue,
|
||||
dataArchiveName,
|
||||
task.multiAttrParams,
|
||||
null,
|
||||
task.forProject,
|
||||
task.attachToProject,
|
||||
task.projectName,
|
||||
);
|
||||
cy.goToTaskList();
|
||||
cy.openTask(task.name);
|
||||
cy.openJob();
|
||||
|
||||
// create dummy annotations and export them to "public" minio bucket
|
||||
cy.createRectangle(createRectangleShape2Points).then(() => {
|
||||
Cypress.config('scrollBehavior', false);
|
||||
});
|
||||
cy.saveJob('PATCH', 200, 'saveJobDump');
|
||||
const exportParams = {
|
||||
type: 'annotations',
|
||||
format,
|
||||
archiveCustomeName: 'job_annotations',
|
||||
targetStorage: {
|
||||
location: 'Cloud storage',
|
||||
cloudStorageId: createdCloudStorageId,
|
||||
},
|
||||
useDefaultLocation: false,
|
||||
};
|
||||
cy.exportJob(exportParams);
|
||||
cy.waitForFileUploadToCloudStorage();
|
||||
|
||||
// remove annotations
|
||||
cy.removeAnnotations();
|
||||
cy.saveJob('PUT');
|
||||
cy.get('#cvat_canvas_shape_1').should('not.exist');
|
||||
cy.get('#cvat-objects-sidebar-state-item-1').should('not.exist');
|
||||
});
|
||||
|
||||
it('Import job annotations from custom minio "public" bucket', () => {
|
||||
cy.interactMenu('Upload annotations');
|
||||
cy.intercept('GET', '/api/jobs/**/annotations?**').as('uploadAnnotationsGet');
|
||||
cy.uploadAnnotations(
|
||||
format.split(' ')[0],
|
||||
'job_annotations.zip',
|
||||
'.cvat-modal-content-load-job-annotation',
|
||||
{
|
||||
location: 'Cloud storage',
|
||||
cloudStorageId: createdCloudStorageId,
|
||||
},
|
||||
false,
|
||||
);
|
||||
cy.get('.cvat-notification-notice-upload-annotations-fail').should('not.exist');
|
||||
cy.get('#cvat_canvas_shape_1').should('exist');
|
||||
cy.get('#cvat-objects-sidebar-state-item-1').should('exist');
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -0,0 +1,46 @@
|
||||
// Copyright (C) 2022 CVAT.ai Corp
|
||||
//
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
/// <reference types="cypress" />
|
||||
|
||||
Cypress.Commands.add('attachS3Bucket', (data) => {
|
||||
let createdCloudStorageId;
|
||||
cy.contains('.cvat-header-button', 'Cloud Storages').should('be.visible').click();
|
||||
cy.get('.cvat-attach-cloud-storage-button').should('be.visible').click();
|
||||
cy.get('#display_name')
|
||||
.type(data.displayName)
|
||||
.should('have.attr', 'value', data.displayName);
|
||||
cy.get('#provider_type').click();
|
||||
cy.contains('.cvat-cloud-storage-select-provider', 'AWS').click();
|
||||
cy.get('#resource')
|
||||
.should('exist')
|
||||
.type(data.resource)
|
||||
.should('have.attr', 'value', data.resource);
|
||||
cy.get('#credentials_type').should('exist').click();
|
||||
cy.get('.ant-select-dropdown')
|
||||
.not('.ant-select-dropdown-hidden')
|
||||
.get('[title="Anonymous access"]')
|
||||
.should('be.visible')
|
||||
.click();
|
||||
cy.get('#endpoint_url')
|
||||
.type(data.endpointUrl)
|
||||
.should('have.attr', 'value', data.endpointUrl);
|
||||
|
||||
cy.get('.cvat-add-manifest-button').should('be.visible').click();
|
||||
cy.get('[placeholder="manifest.jsonl"]')
|
||||
.should('exist')
|
||||
.should('have.attr', 'value', '')
|
||||
.type(data.manifest)
|
||||
.should('have.attr', 'value', data.manifest);
|
||||
cy.intercept('POST', /\/api\/cloudstorages.*/).as('createCloudStorage');
|
||||
cy.get('.cvat-cloud-storage-form').within(() => {
|
||||
cy.contains('button', 'Submit').click();
|
||||
});
|
||||
cy.wait('@createCloudStorage').then((interseption) => {
|
||||
expect(interseption.response.statusCode).to.be.equal(201);
|
||||
createdCloudStorageId = interseption.response.body.id;
|
||||
});
|
||||
cy.verifyNotification();
|
||||
return createdCloudStorageId;
|
||||
});
|
||||
Loading…
Reference in New Issue