Cypress test. Rework case "Save filtered object in AAM" for CI nightly. (#3441)

* Rework case 99 for CI nightly

* Some fix

* Added a comments.
main
Dmitry Kruchinin 5 years ago committed by GitHub
parent 6055be499e
commit 056b7d8bf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -9,6 +9,7 @@ import { labelName, taskName } from '../../support/const';
context('Save filtered object in AAM.', () => {
const caseId = '99';
const newLabelName = `New label for case ${caseId}`;
let secondLabel = '';
const createCuboidShape2Points = {
points: 'From rectangle',
type: 'Shape',
@ -21,7 +22,30 @@ context('Save filtered object in AAM.', () => {
before(() => {
cy.openTask(taskName);
cy.addNewLabel(newLabelName);
cy.document().then((doc) => {
// Getting list of labels and create a label if neccessary
const labelsList = Array.from(doc.querySelectorAll('.cvat-constructor-viewer-item'));
if (labelsList.length < 2) {
cy.addNewLabel(newLabelName);
}
});
cy.document().then((doc) => {
// Getting list of labels again
const labelsList = Array.from(doc.querySelectorAll('.cvat-constructor-viewer-item'));
for (let i = 0; i < labelsList.length; i++) {
if (labelsList[i].innerText === labelName) {
cy.get(labelsList[i]).then(($el) => {
// If "labelName" is not first in the labels list and previous element is not "Add label" button than getting previous label
if ($el.prev().length !== 0 && ! $el.prev().hasClass('cvat-constructor-viewer-new-item')) {
secondLabel = $el.prev().text();
// If "labelName" is not last in the labels list than getting next label
} else if ($el.next().length !== 0) {
secondLabel = $el.next().text();
}
})
}
}
});
cy.openJob();
cy.createCuboid(createCuboidShape2Points);
});
@ -41,7 +65,7 @@ context('Save filtered object in AAM.', () => {
it(`Go to AAM and change a label for the shape. Save the changes. UI is not failed.`, () => {
cy.changeWorkspace('Attribute annotation');
cy.changeLabelAAM(newLabelName);
cy.changeLabelAAM(secondLabel);
cy.saveJob();
cy.get('#cvat_canvas_shape_1').should('not.exist');
cy.get('.attribute-annotations-sidebar-not-found-wrapper').should('exist');

@ -597,6 +597,7 @@ Cypress.Commands.add('addNewLabel', (newLabelName, additionalAttrs, labelColor)
}
}
cy.contains('button', 'Done').click();
cy.get('.cvat-constructor-viewer').should('be.visible');
}
});
});

Loading…
Cancel
Save