未验证 提交 ddd1c089 编写于 作者: D Dmitry Kruchinin 提交者: GitHub

Fix multiple tests for the Firefox browser (#2615)

* Add css class for modal window

* support/index.js adaptation

* Several tests adaptation

* Apply comments.

* Applying comments.
Co-authored-by: NKruchinin <dmitryx.kruchinin@intel.com>
上级 33b9f8bc
......@@ -276,6 +276,7 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
Modal.warning({
title: 'Unsupported platform detected',
className: 'cvat-modal-unsupported-platform-warning',
content: (
<>
<Row>
......
......@@ -174,6 +174,7 @@ context('Group features', () => {
cy.removeAnnotations();
cy.saveJob();
cy.reload();
cy.closeModalUnsupportedPlatform();
cy.get('.cvat-canvas-container').should('exist');
});
......
......@@ -16,6 +16,7 @@ context('When clicking on the Logout button, get the user session closed.', () =
describe(`Testing issue "${issueId}"`, () => {
it('Login', () => {
cy.closeModalUnsupportedPlatform();
cy.login();
});
......@@ -24,6 +25,7 @@ context('When clicking on the Logout button, get the user session closed.', () =
});
it('Login and open task', () => {
cy.closeModalUnsupportedPlatform();
cy.login();
cy.openTask(taskName);
// get id task
......@@ -35,7 +37,9 @@ context('When clicking on the Logout button, get the user session closed.', () =
it('Logout and login to task via GUI', () => {
// logout from task
cy.get('.cvat-right-header').within(() => {
cy.get('.cvat-header-menu-dropdown').should('have.text', Cypress.env('user')).trigger('mouseover', { which: 1 });
cy.get('.cvat-header-menu-dropdown')
.should('have.text', Cypress.env('user'))
.trigger('mouseover', { which: 1 });
});
cy.get('span[aria-label="logout"]').click();
cy.url().should('include', `/auth/login/?next=/tasks/${taskId}`);
......@@ -43,9 +47,7 @@ context('When clicking on the Logout button, get the user session closed.', () =
cy.get('[placeholder="Username"]').type(Cypress.env('user'));
cy.get('[placeholder="Password"]').type(Cypress.env('password'));
cy.get('[type="submit"]').click();
cy.url()
.should('include', `/tasks/${taskId}`)
.and('not.include', '/auth/login/');
cy.url().should('include', `/tasks/${taskId}`).and('not.include', '/auth/login/');
cy.contains('.cvat-task-details-task-name', `${taskName}`).should('be.visible');
});
......@@ -64,7 +66,8 @@ context('When clicking on the Logout button, get the user session closed.', () =
responce = await responce['headers']['set-cookie'];
const csrfToken = responce[0].match(/csrftoken=\w+/)[0].replace('csrftoken=', '');
const sessionId = responce[1].match(/sessionid=\w+/)[0].replace('sessionid=', '');
cy.visit(`/login-with-token/${sessionId}/${csrfToken}?next=/tasks/${taskId}`)
cy.visit(`/login-with-token/${sessionId}/${csrfToken}?next=/tasks/${taskId}`);
cy.closeModalUnsupportedPlatform();
cy.contains('.cvat-task-details-task-name', `${taskName}`).should('be.visible');
});
});
......
......@@ -274,7 +274,6 @@ Cypress.Commands.add('changeWorkspace', (mode, labelName) => {
});
Cypress.Commands.add('changeLabelAAM', (labelName) => {
cy.get('.cvat-workspace-selector').then((value) => {
const cvatWorkspaceSelectorValue = value.text();
if (cvatWorkspaceSelectorValue.includes('Attribute annotation')) {
......@@ -420,7 +419,7 @@ Cypress.Commands.add('removeAnnotations', () => {
cy.contains('Remove annotations').click();
});
cy.get('.cvat-modal-confirm-remove-annotation').within(() => {
cy.contains('button','Delete').click();
cy.contains('button', 'Delete').click();
});
});
......@@ -576,15 +575,26 @@ Cypress.Commands.add('goToPreviousFrame', (expectedFrameNum) => {
Cypress.Commands.add('getObjectIdNumberByLabelName', (labelName) => {
cy.document().then((doc) => {
const stateItemLabelSelectorList = Array.from(doc.querySelectorAll('.cvat-objects-sidebar-state-item-label-selector'));
const stateItemLabelSelectorList = Array.from(
doc.querySelectorAll('.cvat-objects-sidebar-state-item-label-selector'),
);
for (let i = 0; i < stateItemLabelSelectorList.length; i++) {
if (stateItemLabelSelectorList[i].textContent === labelName) {
cy.get(stateItemLabelSelectorList[i])
.parents('.cvat-objects-sidebar-state-item')
.should('have.attr', 'id').then((id) => {
.should('have.attr', 'id')
.then((id) => {
return Number(id.match(/\d+$/));
});
}
}
});
});
Cypress.Commands.add('closeModalUnsupportedPlatform', () => {
if (Cypress.browser.family !== 'chromium') {
cy.get('.cvat-modal-unsupported-platform-warning').within(() => {
cy.contains('button', 'OK').click();
});
}
});
......@@ -10,11 +10,8 @@ require('cypress-plugin-tab');
before(() => {
if (Cypress.browser.family !== 'chromium') {
cy.visit('/');
cy.get('.ant-modal-body').within(() => {
cy.get('.ant-modal-confirm-title').should('contain', 'Unsupported platform detected');
cy.get('.ant-modal-confirm-btns').contains('OK').click();
});
}
cy.closeModalUnsupportedPlatform();
});
const resizeObserverLoopErrRe = /^[^(ResizeObserver loop limit exceeded)]/;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册