-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Cupress test for issue 1785 Add test. Add functionality for create zip archive with images. Update package.json, package-lock.json. * Applying comments. Code refactoring. * Applying comments. * Reworking commands to search for elements by new classes * Return Promise from imageGenerator function. Remove wait() after image generation. * Replace "throw" to "reject" in the "imageGenerator" function. Co-authored-by: Dmitry Kruchinin <[email protected]>
- Loading branch information
1 parent
33156ab
commit ec8ebc7
Showing
8 changed files
with
350 additions
and
47 deletions.
There are no files selected for viewing
61 changes: 61 additions & 0 deletions
61
tests/cypress/integration/issue_1785_propagation_latest_frame.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,61 @@ | ||
/* | ||
* Copyright (C) 2020 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
/// <reference types="cypress" /> | ||
|
||
context('Check propagation work from the latest frame', () => { | ||
|
||
const issueId = '1785' | ||
const labelName = `Issue ${issueId}` | ||
const taskName = `New annotation task for ${labelName}` | ||
const attrName = `Attr for ${labelName}` | ||
const textDefaultValue = 'Some default value for type Text' | ||
const images = [`image_${issueId}_1.png`, | ||
`image_${issueId}_2.png`, | ||
`image_${issueId}_3.png`] | ||
const width = 800 | ||
const height = 800 | ||
const posX = 10 | ||
const posY = 10 | ||
const color = 'gray' | ||
const archiveName = `images_issue_${issueId}.zip` | ||
const archivePath = `cypress/fixtures/${archiveName}` | ||
const imagesFolder = `cypress/fixtures/image_issue_${issueId}` | ||
const directoryToArchive = imagesFolder | ||
|
||
before(() => { | ||
cy.visit('auth/login') | ||
cy.login() | ||
for (let img of images) { | ||
cy.imageGenerator(imagesFolder, img, width, height, color, posX, posY, labelName) | ||
} | ||
cy.createZipArchive(directoryToArchive, archivePath) | ||
cy.createAnnotationTask(taskName, labelName, attrName, textDefaultValue, archiveName) | ||
cy.openTaskJob(taskName) | ||
}) | ||
|
||
describe(`Testing issue "${issueId}"`, () => { | ||
it('Go to the last frame', () => { | ||
cy.get('.cvat-player-last-button') | ||
.click() | ||
cy.get('.cvat-player-frame-selector').within(() => { | ||
cy.get('input[role="spinbutton"]') | ||
.should('have.value', '2') | ||
}) | ||
}) | ||
it('Create a shape', () => { | ||
cy.createShape(309, 431, 616, 671) | ||
}) | ||
it('Try to propagate', () => { | ||
cy.get('#cvat_canvas_shape_1').trigger('mousemove') | ||
cy.get('body').type('{ctrl}b') | ||
cy.get('.ant-modal-content') | ||
.find('.ant-btn-primary') | ||
.click() | ||
cy.get('.ant-notification-notice').should('not.exist') | ||
}) | ||
}) | ||
}) |
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,30 @@ | ||
/* | ||
* Copyright (C) 2020 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
exports.createZipArchive = createZipArchive | ||
|
||
const archiver = require('archiver') | ||
const fs = require('fs-extra') | ||
|
||
function createZipArchive(args) { | ||
const directoryToArchive = args.directoryToArchive | ||
const output = fs.createWriteStream(args.arhivePath) | ||
const archive = archiver('zip', { | ||
gzip: true, | ||
zlib: { level: 9 } | ||
}) | ||
|
||
archive.on('error', function(err) { | ||
throw err | ||
}) | ||
|
||
archive.pipe(output) | ||
|
||
archive.directory(`${directoryToArchive}/`, false) | ||
archive.finalize() | ||
|
||
return fs.pathExists(archive) | ||
} |
12 changes: 12 additions & 0 deletions
12
tests/cypress/plugins/createZipArchive/createZipArchiveCommand.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,12 @@ | ||
/* | ||
* Copyright (C) 2020 Intel Corporation | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
Cypress.Commands.add('createZipArchive', function (directoryToArchive, arhivePath) { | ||
return cy.task('createZipArchive', { | ||
directoryToArchive: directoryToArchive, | ||
arhivePath: arhivePath | ||
}) | ||
}) |
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
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
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.