Preparation for testing. Add tests for issue 1599. (#1983)
* Automate test preparation(mandatory operations for each test cases) - Add test for creating an annotation task. - Add automate for creating superuser. * Add tests for issue 1599. * Run Cypress from Travis CI. Remove Cypress installation command from Dockerfile.ci Remove the unnecessary docker-compose.ci.yml * Replase image for creation an annotation task. Change name of imsge in the Cypress test create_new_task.js * Temporarily deleting the annotation task creation functionality * Image generarion functionality Add Cypress module for auto generation images Add package files. * Add custome commands for create an annotation task and a shape. * Applying comments. * /tasks instead of /task in the tests (applying comments) Co-authored-by: Dmitry Kruchinin <dmitryx.kruchinin@intel.com>main
parent
d6ca864d51
commit
ca4b320d23
@ -1,3 +1,10 @@
|
|||||||
{
|
{
|
||||||
"baseUrl": "http://localhost:8080"
|
"video": false,
|
||||||
|
"baseUrl": "http://localhost:8080",
|
||||||
|
"viewportWidth": 1300,
|
||||||
|
"viewportHeight": 960,
|
||||||
|
"testFiles": [
|
||||||
|
"auth_page.js",
|
||||||
|
"issue_*.js"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
context('Issue 1599 (Chinese alphabet).', () => {
|
||||||
|
before(() => {
|
||||||
|
cy.visit('auth/register')
|
||||||
|
cy.url().should('include', '/auth/register')
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('User registration using the Chinese alphabet.', () => {
|
||||||
|
it('Filling in the placeholder "First name"', () => {
|
||||||
|
cy.get('[placeholder="First name"]').type('测试者')
|
||||||
|
.should('not.have.class', 'has-error')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Filling in the placeholder "Last name"', () => {
|
||||||
|
cy.get('[placeholder="Last name"]').type('测试')
|
||||||
|
.should('not.have.class', 'has-error')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Filling in the placeholder "Username"', () => {
|
||||||
|
cy.get('[placeholder="Username"]').type('Testuser_ch')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Filling in the placeholder "Email address"', () => {
|
||||||
|
cy.get('[placeholder="Email address"]').type('Testuser_ch@local.local')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Filling in the placeholder "Password"', () => {
|
||||||
|
cy.get('[placeholder="Password"]').type('Qwerty123!')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Filling in the placeholder "Confirm password"', () => {
|
||||||
|
cy.get('[placeholder="Confirm password"]').type('Qwerty123!')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Click to "Submit" button', () => {
|
||||||
|
cy.get('[type="submit"]').click()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('Successful registration', () => {
|
||||||
|
cy.url().should('include', '/tasks')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
exports.imageGenerator = imageGenerator
|
||||||
|
|
||||||
|
const jimp = require('jimp')
|
||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
function imageGenerator(args) {
|
||||||
|
const directory = args.directory
|
||||||
|
const fileName = args.fileName
|
||||||
|
const width = args.width
|
||||||
|
const height = args.height
|
||||||
|
const color = args.color
|
||||||
|
const posX = args.posX
|
||||||
|
const posY = args.posY
|
||||||
|
const message = args.message
|
||||||
|
const file = path.join(directory, fileName)
|
||||||
|
const image = new jimp(width, height, color, function (err, image) {
|
||||||
|
if (err) throw err
|
||||||
|
jimp.loadFont(jimp.FONT_SANS_64_BLACK, function (err, font) {
|
||||||
|
if (err) throw err
|
||||||
|
image.print(font, Number(posX), Number(posY), message)
|
||||||
|
.write(file)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
return file
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
Cypress.Commands.add('imageGenerator', (directory,
|
||||||
|
fileName,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
color,
|
||||||
|
posX,
|
||||||
|
posY,
|
||||||
|
message) => {
|
||||||
|
return cy.task('imageGenerator', {
|
||||||
|
directory: directory,
|
||||||
|
fileName: fileName,
|
||||||
|
width: width,
|
||||||
|
height: height,
|
||||||
|
color: color,
|
||||||
|
posX: posX,
|
||||||
|
posY: posY,
|
||||||
|
message: message
|
||||||
|
})
|
||||||
|
})
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
const {imageGenerator} = require('../plugins/imageGenerator/addPlugin')
|
||||||
|
|
||||||
|
module.exports = (on) => {
|
||||||
|
on('task', {imageGenerator})
|
||||||
|
}
|
||||||
@ -0,0 +1,47 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
/// <reference types="cypress" />
|
||||||
|
|
||||||
|
require('cypress-file-upload')
|
||||||
|
require('../plugins/imageGenerator/imageGeneratorCommand')
|
||||||
|
|
||||||
|
Cypress.Commands.add('login', (username='admin', password='12qwaszx') => {
|
||||||
|
cy.get('[placeholder="Username"]').type(username)
|
||||||
|
cy.get('[placeholder="Password"]').type(password)
|
||||||
|
})
|
||||||
|
|
||||||
|
Cypress.Commands.add('createAnnotationTask', (taksName='New annotation task',
|
||||||
|
labelName='Some label',
|
||||||
|
attrName='Some attr name',
|
||||||
|
textDefaultValue='Some default value for type Text',
|
||||||
|
image='image.png') => {
|
||||||
|
cy.contains('button', 'Create new task').click()
|
||||||
|
cy.url().should('include', '/tasks/create')
|
||||||
|
cy.get('[id="name"]').type(taksName)
|
||||||
|
cy.contains('button', 'Add label').click()
|
||||||
|
cy.get('[placeholder="Label name"]').type(labelName)
|
||||||
|
cy.contains('button', 'Add an attribute').click()
|
||||||
|
cy.get('[placeholder="Name"]').type(attrName)
|
||||||
|
cy.get('div[title="Select"]').click()
|
||||||
|
cy.get('li').contains('Text').click()
|
||||||
|
cy.get('[placeholder="Default value"]').type(textDefaultValue)
|
||||||
|
cy.contains('button', 'Done').click()
|
||||||
|
cy.get('input[type="file"]').attachFile(image, { subjectType: 'drag-n-drop' });
|
||||||
|
cy.contains('button', 'Submit').click()
|
||||||
|
cy.contains('The task has been created', {timeout: '8000'})
|
||||||
|
cy.get('button[value="tasks"]').click()
|
||||||
|
cy.url().should('include', '/tasks?page=')
|
||||||
|
})
|
||||||
|
|
||||||
|
Cypress.Commands.add('createShape', (ferstX, ferstY, lastX, lastY) => {
|
||||||
|
cy.get(':nth-child(8) > svg').trigger('mousemove').click()
|
||||||
|
cy.get(':nth-child(6) > :nth-child(1) > .ant-btn').click()
|
||||||
|
cy.get('.cvat-canvas-container')
|
||||||
|
.click(ferstX, ferstY)
|
||||||
|
cy.get('.cvat-canvas-container')
|
||||||
|
.click(lastX, lastY)
|
||||||
|
})
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2020 Intel Corporation
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: MIT
|
||||||
|
*/
|
||||||
|
|
||||||
|
import './commands'
|
||||||
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"video": false,
|
|
||||||
"baseUrl": "http://cvat_ui"
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"devDependencies": {
|
||||||
|
"cypress": "^4.12.1",
|
||||||
|
"cypress-file-upload": "^4.0.7"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"jimp": "^0.14.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue