-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[GSoC2024] add test case for subsequent annotation import #7673
Merged
novda
merged 5 commits into
cvat-ai:develop
from
umangapatel123:import_annotation_filename_test
Mar 28, 2024
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
bd2f1c7
add test case for subsequent annotation import
umangapatel123 f27d268
refactored the test case
umangapatel123 7c53faa
Merge branch 'opencv:develop' into import_annotation_filename_test
umangapatel123 2433667
Merge branch 'opencv:develop' into import_annotation_filename_test
umangapatel123 522d48c
Merge branch 'opencv:develop' into import_annotation_filename_test
umangapatel123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
134 changes: 134 additions & 0 deletions
134
.../cypress/e2e/issues_prs2/issue_7428_importing_annotation_from_cloud_after_local_import.js
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,134 @@ | ||
// Copyright (C) 2024 CVAT.ai Corporation | ||
// | ||
// SPDX-License-Identifier: MIT | ||
|
||
/// <reference types="cypress" /> | ||
|
||
import { taskName, labelName } from '../../support/const'; | ||
|
||
context('Incorrect cloud storage filename used in subsequent import.', () => { | ||
const annotationsArchiveNameCloud = 'bazquux'; | ||
const annotationsArchiveNameLocal = 'foobar'; | ||
let createdCloudStorageId; | ||
const issueId = '7428'; | ||
const exportFormat = 'CVAT for images'; | ||
const rectangleShape2Points = { | ||
points: 'By 2 Points', | ||
type: 'Shape', | ||
labelName, | ||
firstX: 400, | ||
firstY: 100, | ||
secondX: 500, | ||
secondY: 200, | ||
}; | ||
|
||
const serverHost = Cypress.config('baseUrl').includes('3000') ? 'localhost' : 'minio'; | ||
|
||
const cloudStorageData = { | ||
displayName: 'Demo bucket', | ||
resource: 'public', | ||
manifest: 'manifest.jsonl', | ||
endpointUrl: `http://${serverHost}:9000`, | ||
}; | ||
|
||
function uploadToTask({ | ||
useDefaultLocation = true, | ||
annotationsArchiveName, | ||
CloudStorageId, | ||
}) { | ||
cy.clickInTaskMenu('Upload annotations', true); | ||
cy.get('.cvat-modal-import-dataset').find('.cvat-modal-import-select').click(); | ||
cy.contains('.cvat-modal-import-dataset-option-item', 'CVAT 1.1').click(); | ||
cy.get('.cvat-modal-import-select').should('contain.text', 'CVAT 1.1'); | ||
if (!useDefaultLocation) { | ||
cy.get('.cvat-modal-import-dataset') | ||
.find('.cvat-modal-import-switch-use-default-storage') | ||
.click(); | ||
cy.get('.cvat-select-source-storage').within(() => { | ||
cy.get('.ant-select-selection-item').click(); | ||
}); | ||
cy.contains('.cvat-select-source-storage-location', 'Cloud storage') | ||
.should('be.visible') | ||
.click(); | ||
if (CloudStorageId) { | ||
cy.get('.cvat-search-source-storage-cloud-storage-field').click(); | ||
cy.get('.cvat-cloud-storage-select-provider').click(); | ||
} | ||
cy.get('.cvat-modal-import-dataset') | ||
.find('.cvat-modal-import-filename-input') | ||
.type(annotationsArchiveName); | ||
} else { | ||
cy.get('input[type="file"]').attachFile(annotationsArchiveName, { subjectType: 'drag-n-drop' }); | ||
cy.get(`[title="${annotationsArchiveName}"]`).should('be.visible'); | ||
} | ||
cy.contains('button', 'OK').click(); | ||
cy.get('.cvat-modal-content-load-task-annotation') | ||
.should('be.visible') | ||
.within(() => { | ||
cy.contains('button', 'Update').click(); | ||
}); | ||
cy.get('.cvat-notification-notice-import-annotation-start').should('be.visible'); | ||
cy.closeNotification('.cvat-notification-notice-import-annotation-start'); | ||
cy.verifyNotification(); | ||
cy.get('.cvat-notification-notice-upload-annotations-fail').should('not.exist'); | ||
} | ||
|
||
before(() => { | ||
createdCloudStorageId = cy.attachS3Bucket(cloudStorageData); | ||
cy.goToTaskList(); | ||
cy.openTaskJob(taskName); | ||
cy.createRectangle(rectangleShape2Points); | ||
cy.saveJob('PATCH', 200, 'saveJobExportDataset'); | ||
cy.goToTaskList(); | ||
cy.openTask(taskName); | ||
}); | ||
|
||
after(() => { | ||
cy.contains('.cvat-header-button', 'Cloud Storages').should('be.visible').click(); | ||
cy.url().should('include', '/cloudstorages'); | ||
cy.deleteCloudStorage(cloudStorageData.displayName); | ||
}); | ||
|
||
describe(`Testing issue "${issueId}"`, () => { | ||
it('Export Annotation to the local storage', () => { | ||
const exportParams = { | ||
type: 'annotations', | ||
format: exportFormat, | ||
archiveCustomName: annotationsArchiveNameLocal, | ||
}; | ||
cy.exportTask(exportParams); | ||
cy.waitForDownload(); | ||
}); | ||
|
||
it('Export Annotation to the cloud storage', () => { | ||
const exportParams = { | ||
type: 'annotations', | ||
format: exportFormat, | ||
archiveCustomName: annotationsArchiveNameCloud, | ||
targetStorage: { | ||
location: 'Cloud storage', | ||
cloudStorageId: createdCloudStorageId, | ||
}, | ||
useDefaultLocation: false, | ||
}; | ||
cy.exportTask(exportParams); | ||
cy.waitForFileUploadToCloudStorage(); | ||
}); | ||
|
||
it('Import Annotation from the local storage', () => { | ||
const importParams = { | ||
useDefaultLocation: true, | ||
annotationsArchiveName: `${annotationsArchiveNameLocal}.zip`, | ||
}; | ||
uploadToTask(importParams); | ||
}); | ||
it('Import Annotation from the cloud storage', () => { | ||
const importParams = { | ||
useDefaultLocation: false, | ||
annotationsArchiveName: `${annotationsArchiveNameCloud}.zip`, | ||
CloudStorageId: createdCloudStorageId, | ||
}; | ||
uploadToTask(importParams); | ||
}); | ||
}); | ||
}); |
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also in the import datasets, you can use
uploadAnnotations
from commandsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried using the
uploadAnnotations
but the problem is thatuploadAnnotations
is made assuming the annotation is uploaded from the jobs page. so the GET request is intercepted and checked it's status but if you upload annotation from the tasks page, there is no GET request. It only does POST and PUT requests. Hence I have not useduploadAnnotations
but tried to write modularized code.