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

Fixed upload test #3742

Merged
merged 1 commit into from
Sep 29, 2021
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,22 @@ context('Dump/Upload annotation.', { browser: '!firefox' }, () => {
cy.contains('.cvat-menu-load-submenu-item', exportFormat.split(' ')[0])
.should('be.visible')
.within(() => {
cy.get('.cvat-menu-load-submenu-item-button')
.click()
.get('input[type=file]')
.attachFile(annotationArchiveNameCustomeName);
cy.get('.cvat-menu-load-submenu-item-button').click();
});
// when a user clicks, menu is closing and it triggers rerender
// we use mouseout here to emulate user behaviour
cy.get('.cvat-actions-menu').trigger('mouseout').should('be.hidden');
cy.contains('.cvat-menu-load-submenu-item', exportFormat.split(' ')[0]).within(() => {
cy.get('input[type=file]').attachFile(annotationArchiveNameCustomeName);
});
}

function confirmUpdate(modalWindowClassName) {
cy.get(modalWindowClassName).should('be.visible').within(() => {
cy.contains('button', 'Update').click();
});
cy.get(modalWindowClassName)
.should('be.visible')
.within(() => {
cy.contains('button', 'Update').click();
});
}

before(() => {
Expand All @@ -72,7 +77,7 @@ context('Dump/Upload annotation.', { browser: '!firefox' }, () => {
as: 'exportAnnotationsRenameArchive',
type: 'annotations',
format: exportFormat,
archiveCustomeName: 'task_export_annotation_custome_name'
archiveCustomeName: 'task_export_annotation_custome_name',
};
cy.exportTask(exportAnnotationRenameArchive);
const regex = new RegExp(`^${exportAnnotationRenameArchive.archiveCustomeName}.zip$`);
Expand All @@ -95,7 +100,9 @@ context('Dump/Upload annotation.', { browser: '!firefox' }, () => {
cy.saveJob('PUT');
cy.get('#cvat_canvas_shape_1').should('not.exist');
cy.get('#cvat-objects-sidebar-state-item-1').should('not.exist');
const regex = new RegExp(`^task_${taskName.toLowerCase()}-.*-${exportAnnotation.format.toLowerCase()}.*.zip$`);
const regex = new RegExp(
`^task_${taskName.toLowerCase()}-.*-${exportAnnotation.format.toLowerCase()}.*.zip$`,
);
cy.task('listFiles', 'cypress/fixtures').each((fileName) => {
if (fileName.match(regex)) {
cy.readFile(`cypress/fixtures/${fileName}`).should('exist');
Expand All @@ -109,11 +116,14 @@ context('Dump/Upload annotation.', { browser: '!firefox' }, () => {
cy.contains('.cvat-menu-load-submenu-item', exportFormat.split(' ')[0])
.should('be.visible')
.within(() => {
cy.get('.cvat-menu-load-submenu-item-button')
.click()
.get('input[type=file]')
.attachFile(annotationArchiveName);
cy.get('.cvat-menu-load-submenu-item-button').click();
});
// when a user clicks, menu is closing and it triggers rerender
// we use mouseout here to emulate user behaviour
cy.get('.cvat-annotation-menu').trigger('mouseout').should('be.hidden');
cy.contains('.cvat-menu-load-submenu-item', exportFormat.split(' ')[0]).within(() => {
cy.get('input[type=file]').attachFile(annotationArchiveName);
});
confirmUpdate('.cvat-modal-content-load-job-annotation');
cy.intercept('GET', '/api/v1/jobs/**/annotations**').as('uploadAnnotationsGet');
cy.wait('@uploadAnnotationsGet').its('response.statusCode').should('equal', 200);
Expand Down