Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test task - regression testing to export tasks #5519

Closed
wants to merge 3 commits into from

Conversation

AparinAA
Copy link

@AparinAA AparinAA commented Dec 27, 2022

Added test to #5396

@AparinAA AparinAA requested a review from azhavoro as a code owner December 27, 2022 13:45
@nmanovic nmanovic requested review from bsekachev and removed request for azhavoro December 27, 2022 20:20
@nmanovic
Copy link
Contributor

@bsekachev , could you please look at the PR?

});

context('Export task inner.', { browser: '!firefox' }, () => {
const caseId = '999';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should refer to real issue. If no issue exist, this does not make sense.

cy.deleteTask(taskName);
});

describe(`Testing "${taskName}"`, () => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to be more specific here. It is not clear what we are testing. Using string template is not the best option here because it makes code more difficult to read and understand.

Comment on lines +114 to +116
it('Open a task', () => {
cy.openTask(taskName);
});
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be a part of before probably, because we don't test opening a task here

Comment on lines +1 to +4
// Start writing your Cypress tests below!
// If you're unfamiliar with how Cypress works,
// check out the link below and learn how to write your first test:
// https://on.cypress.io/writing-first-test
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to put a lincese header here instead of default Cypress text:

// Copyright (C) 2022 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT


/// <reference types="cypress" />

Cypress.Commands.add('exportInnerTask', ({
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a dedicated files for Cypress commands definition:

tests/cypress/support/*.js

order,
imageClick = false,
}) => {
const orderId = Number.isNaN(parseInt(order, 10)) ? 0 : parseInt(order, 10);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const orderId = Number.isNaN(parseInt(order, 10)) ? 0 : parseInt(order, 10);
const orderId = +order || 0;

But generally, if we need an integer here, passing a string to this command does not make sense

const imagesFolder = `cypress/fixtures/${imageFileName}`;
const directoryToArchive = imagesFolder;
const newLabelName = 'person';
const exportOrders = [0, 1, 2];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choosing an export format by its order is not robust option I think. Order can be changed easily.
Better to choose by name

@@ -0,0 +1,138 @@
// Start writing your Cypress tests below!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Please check comments from the previous file, many of them applicable here
  2. A lot of code dublication, I would prefer rework it somehow to reduce it. Maybe to combine these two tests into the one.

@bsekachev
Copy link
Member

Looks like the test has not been run on CI because of configuration of tests/cypress.json and probably some configuration in .github/workflows. Please, correct me if I am wrong.

@nmanovic
Copy link
Contributor

@AparinAA , thanks for PR. I will close it.

@nmanovic nmanovic closed this Dec 29, 2022
@AparinAA
Copy link
Author

@nmanovic

OK. I can fix the wrong if needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants