未验证 提交 ebd04aa4 编写于 作者: B Boris Sekachev 提交者: GitHub

Fixed built, improved testing system (#43)

Fixed nightly built, reworked closing platform notification, updated cypress, fixed vulnerabilities in tests/
上级 f960da91
// Copyright (C) 2020-2021 Intel Corporation
// Copyright (C) 2020-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT
/// <reference types="cypress" />
/* eslint-disable no-loop-func */
import { taskName, labelName } from '../../support/const';
context('Group features', () => {
......@@ -11,7 +13,7 @@ context('Group features', () => {
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
labelName,
firstX: 250,
firstY: 350,
secondX: 350,
......@@ -20,7 +22,7 @@ context('Group features', () => {
const createRectangleShape2PointsSecond = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
labelName,
firstX: createRectangleShape2Points.firstX + 300,
firstY: createRectangleShape2Points.firstY,
secondX: createRectangleShape2Points.secondX + 300,
......@@ -29,7 +31,7 @@ context('Group features', () => {
const createRectangleTrack2Points = {
points: 'By 2 Points',
type: 'Track',
labelName: labelName,
labelName,
firstX: 250,
firstY: 600,
secondX: 350,
......@@ -38,7 +40,7 @@ context('Group features', () => {
const createRectangleTrack2PointsSecond = {
points: 'By 2 Points',
type: 'Track',
labelName: labelName,
labelName,
firstX: createRectangleTrack2Points.firstX + 300,
firstY: createRectangleTrack2Points.firstY,
secondX: createRectangleTrack2Points.secondX + 300,
......@@ -75,7 +77,11 @@ context('Group features', () => {
for (const shapeToGroup of objectsArray) {
cy.get(shapeToGroup).click().should('have.class', 'cvat_canvas_shape_grouping');
}
cancelGrouping ? cy.get('body').type('{Esc}') : cy.get('.cvat-group-control').click();
if (cancelGrouping) {
cy.get('body').type('{Esc}');
} else {
cy.get('.cvat-group-control').click();
}
}
function testUnGroupObjects() {
......@@ -119,9 +125,11 @@ context('Group features', () => {
cy.get(objectSideBarShape)
.should('have.css', 'background-color')
.then(($bColorobjectSideBarShape) => {
// expected rgba(250, 50, 83, 0.533) to not include [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
// expected rgba(250, 50, 83, 0.533) to not include
// [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
expect($bColorobjectSideBarShape).to.not.contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/));
// expected rgba(250, 50, 83, 0.533) to include [ 250, 50, 83, index: 4, input: 'rgb(250, 50, 83)', groups: undefined ]
// expected rgba(250, 50, 83, 0.533) to include
// [ 250, 50, 83, index: 4, input: 'rgb(250, 50, 83)', groups: undefined ]
expect($bColorobjectSideBarShape).to.be.contain(shapesGroupColor.match(/\d+, \d+, \d+/));
});
}
......@@ -151,7 +159,8 @@ context('Group features', () => {
cy.get($listObjectsSidebarStateItem[i])
.should('have.css', 'background-color')
.then(($bColorObjectsSidebarStateItem) => {
// expected rgba(224, 224, 224, 0.533) to include [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
// expected rgba(224, 224, 224, 0.533) to include
// [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
expect($bColorObjectsSidebarStateItem).contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/));
});
}
......@@ -191,9 +200,11 @@ context('Group features', () => {
cy.get(objectSideBarTrack)
.should('have.css', 'background-color')
.then(($bColorobjectSideBarTrack) => {
// expected rgba(52, 209, 183, 0.533) to not include [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
// expected rgba(52, 209, 183, 0.533) to not include
// [ 224, 224, 224, index: 4, input: 'rgb(224, 224, 224)', groups: undefined ]
expect($bColorobjectSideBarTrack).to.not.contain(defaultGroupColorRgb.match(/\d+, \d+, \d+/));
// expected rgba(52, 209, 183, 0.533) to include [ 52, 209, 183, index: 4, input: 'rgb(52, 209, 183)', groups: undefined ]
// expected rgba(52, 209, 183, 0.533) to include
// [ 52, 209, 183, index: 4, input: 'rgb(52, 209, 183)', groups: undefined ]
expect($bColorobjectSideBarTrack).to.be.contain(tracksGroupColor.match(/\d+, \d+, \d+/));
});
}
......@@ -205,7 +216,6 @@ context('Group features', () => {
cy.removeAnnotations();
cy.saveJob('PUT');
cy.reload();
cy.closeModalUnsupportedPlatform();
cy.get('.cvat-canvas-container').should('exist');
});
......
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT
......@@ -45,7 +45,6 @@ context('Settings. Default number of points in polygon approximation.', () => {
cy.closeNotification('.cvat-notification-notice-save-settings-success');
cy.closeSettings();
cy.reload();
cy.closeModalUnsupportedPlatform(); // If the Firefox browser closes the modal window after reload
testCheckSliderAttrValuenow(sliderAttrValueNow);
cy.contains('strong', 'less').click();
testCheckSliderAttrValuenow(sliderAttrValuemin);
......
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT
......@@ -11,7 +11,7 @@ context('Create a link for shape, frame.', () => {
const createRectangleShape2Points = {
points: 'By 2 Points',
type: 'Shape',
labelName: labelName,
labelName,
firstX: 250,
firstY: 350,
secondX: 350,
......@@ -26,30 +26,29 @@ context('Create a link for shape, frame.', () => {
describe(`Testing case "${caseId}"`, () => {
it('Create a link for a shape, for a frame.', () => {
cy.window().then(win => {
cy.window().then((win) => {
cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptShape');
});
cy.get('#cvat-objects-sidebar-state-item-1').find('[aria-label="more"]').trigger('mouseover');
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated')
cy.get('#cvat_canvas_shape_1').should('have.class', 'cvat_canvas_shape_activated');
cy.get('.cvat-object-item-menu').last().should('be.visible').contains('button', 'Create object URL').click();
cy.get('@copyToClipboardPromptShape').should('be.called');
cy.get('@copyToClipboardPromptShape').then(prompt => {
cy.get('@copyToClipboardPromptShape').then((prompt) => {
const url = prompt.args[0][1];
expect(url).include('frame=');
expect(url).include('type=');
expect(url).include('serverID=');
cy.visit(url);
cy.closeModalUnsupportedPlatform();
cy.get('.cvat-canvas-container').should('be.visible');
cy.get('#cvat_canvas_shape_1').should('be.visible');
});
cy.window().then(win => {
cy.window().then((win) => {
cy.stub(win, 'prompt').returns(win.prompt).as('copyToClipboardPromptFrame');
});
cy.get('.cvat-player-frame-url-icon').click();
cy.get('@copyToClipboardPromptFrame').should('be.called');
cy.get('@copyToClipboardPromptFrame').then(prompt => {
cy.get('@copyToClipboardPromptFrame').then((prompt) => {
const url = prompt.args[0][1];
expect(url).include('frame=');
expect(url).not.include('type=');
......
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT
......@@ -17,9 +17,11 @@ context('Saving setting to local storage.', () => {
'.cvat-workspace-settings-show-text-always',
'.cvat-workspace-settings-autoborders',
]) {
checked
? cy.get(ws).find('[type="checkbox"]').should('be.checked')
: cy.get(ws).find('[type="checkbox"]').should('not.be.checked').check().should('be.checked');
if (checked) {
cy.get(ws).find('[type="checkbox"]').should('be.checked');
} else {
cy.get(ws).find('[type="checkbox"]').should('not.be.checked').check().should('be.checked');
}
}
}
......@@ -37,7 +39,6 @@ context('Saving setting to local storage.', () => {
.click();
cy.closeSettings();
cy.reload();
cy.closeModalUnsupportedPlatform(); // If the Firefox browser closes the modal window after reload
testCheckedSettings(true);
});
});
......
......@@ -60,7 +60,6 @@ context('Delete a label from a task.', () => {
cy.wait('@searchUsers');
});
cy.reload();
cy.closeModalUnsupportedPlatform(); // If the Firefox browser closes the modal window after reload
cy.get('td.cvat-job-item-state').invoke('text').should('equal', 'in progress');
});
});
......
......@@ -22,7 +22,6 @@ context('When clicking on the Logout button, get the user session closed.', () =
describe(`Testing issue "${issueId}"`, () => {
it('Login', () => {
cy.closeModalUnsupportedPlatform();
cy.login();
});
......
......@@ -52,7 +52,6 @@ context('Register user, change password, login with new password', () => {
cy.logout(userName);
});
it('Login with the new password', () => {
cy.closeModalUnsupportedPlatform();
cy.login(userName, newPassword);
});
it('Change password with incorrect current password', () => {
......
......@@ -36,7 +36,6 @@ Cypress.Commands.add('logout', (username = Cypress.env('user')) => {
cy.get('span[aria-label="logout"]').click();
cy.url().should('include', '/auth/login');
cy.visit('/auth/login'); // clear query parameter "next"
cy.closeModalUnsupportedPlatform();
});
Cypress.Commands.add('userRegistration', (firstName, lastName, userName, emailAddr, password) => {
......@@ -830,7 +829,7 @@ Cypress.Commands.add('getObjectIdNumberByLabelName', (labelName) => {
});
Cypress.Commands.add('closeModalUnsupportedPlatform', () => {
if (Cypress.browser.family !== 'chromium') {
if (Cypress.browser.family !== 'chromium' && !window.localStorage.getItem('platformNotiticationShown')) {
cy.get('.cvat-modal-unsupported-platform-warning').within(() => {
cy.contains('button', 'OK').click();
});
......@@ -900,3 +899,13 @@ Cypress.Commands.add('deleteFrame', (action = 'delete') => {
cy.saveJob('PATCH', 200);
cy.wait('@patchMeta').its('response.statusCode').should('equal', 200);
});
Cypress.Commands.overwrite('visit', (orig, url, options) => {
orig(url, options);
cy.closeModalUnsupportedPlatform();
});
Cypress.Commands.overwrite('reload', (orig, options) => {
orig(options);
cy.closeModalUnsupportedPlatform();
});
......@@ -13,13 +13,6 @@ require('./commands_organizations');
require('@cypress/code-coverage/support');
require('cypress-real-events/support');
before(() => {
if (Cypress.browser.family !== 'chromium') {
cy.visit('/');
}
cy.closeModalUnsupportedPlatform();
});
// Chrome: ResizeObserver loop limit exceeded
// Firefox: ResizeObserver loop completed with undelivered notifications
const resizeObserverLoopErr = 'ResizeObserver loop';
......
此差异已折叠。
......@@ -8,11 +8,12 @@
"@cypress/code-coverage": "^3.9.10",
"archiver": "^5.3.0",
"cy-verify-downloads": "^0.0.5",
"cypress": "^8.3.1",
"cypress": "^9.7.0",
"cypress-file-upload": "^5.0.8",
"cypress-localstorage-commands": "^1.5.0",
"cypress-localstorage-commands": "^1.7.0",
"cypress-real-events": "^1.6.0",
"extract-zip": "^2.0.1",
"fs-extra": "^10.1.0",
"jimp": "^0.16.1"
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册