Giter Club home page Giter Club logo

check-tests's People

Contributors

davertmik avatar dependabot[bot] avatar kmkoushik avatar kobenguyent avatar mykhailiukvitalii avatar olexandr13 avatar poliarush avatar vkeyboardv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

check-tests's Issues

Add an option to exclude one test from synchronization

Is your feature request related to a problem? Please describe.
Synchronized the test suite. But then I want to exclude one test from the set of tests that are synchronized.

Describe the solution you'd like
Enter a command in the console with the name of the test that I want to exclude from synchronization.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

0 tests is not valid output




TOTAL 0 TESTS FOUND


 ๐Ÿš€ Sending data to testomat.io

 ๐ŸŽ‰ Data sent to Testomat.io

0 tests - there is nothing to send to testomatio.

The message should be like this:

Can't find any tests in this folder.
Change file pattern or directory to scan to find test files:

Usage: npx check-tests <pattern> -d [directory]

Generate Living Documentation as Markdown file

Add to check-tests CLI a command which will generate documentation in Markdown format:

npx check-tests CodeceptJS **.test --doc tests.md

This will create tests.md file and write into it all found tests.

This feature is already available as GitHub Action, it also pushes generated markdown to GitHub Wiki. But we need that this option to exist in CLI and generate a simple md file which can be used as documentation in GitHub repo or on statice website, etc.

Documentation Generator: https://github.com/testomatio/check-tests/blob/master/src/document.js

stable branch gives Node.js 12 deprecation warning

With - uses: testomatio/check-tests@stable, as documented in the README.md, GitHub issues a deprecation warning:

"Node.js 12 actions are deprecated. Please update the following actions to use Node.js 16: testomatio/check-tests@stable. For more information see: https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/."

check-tests/action.yml

Lines 48 to 50 in 0ea638f

runs:
using: 'node12'
main: 'index.js'

  1. What is the current recommendation for using this action? - uses: testomatio/check-tests@???
  2. Will this JavaScript action be migrated to use node16?

tests with dynamic parameters are not uploaded correctly

Describe the bug
tests with dynamic parameters are not uploaded correctly

To Reproduce
Steps to reproduce the behavior:
Create a test of below format

test.describe('New Loan Application', () => {
    const provinces = ['AB', 'BC', 'MB', 'NB', 'NL', 'NS', 'ON', 'SK'];
    provinces.forEach((state) => {
        test(`Validate New Loan Application for Specific Province ${state} @canpre`, async ({

Expected behavior
Should read the dynamic parameters and upload the tests

Screenshots
Screenshot 2023-11-07 at 4 13 17 PM

Screenshot 2023-11-07 at 4 17 13 PM

[Playwright/Typescript] update-ids func inserts ids into import statements

When I use typescript path aliases, updatei-ids doesn't work as expected. It inserts the suiteId on the first line that matches the describe title. In this case it's "Shift"

import {expect, Page, test} from '@playwright/test'
import Shift @Sff4de22bModel from '@src/models/ShiftModel'

test.describe('Shift', () => {

avoid "node_modules" while scanning directory

In Import instructions on website we provide a very wide pattern for files to scan and it appears that tests from "node_modules" folder are added to output.

Please check the path of scanned tests.
If path contains node_modules directory - ignore that test.

[Playwright/Typescript] Last suiteId has been inserted for each describe with the same title

In my current project, I have quite complex functionality that requires many tests with complex preconditions and actions. In order not to have test files for several thousand lines and 100 tests, I break such tests into files, but leave the same "describe/title" for all describes in each file.

They are normally imported to testomat. The problem occurs when I want to call update-ids.

Let's say I have test files shifts1.spec.ts, shifts2.spec.ts, shifts3.spec.ts. I have imported suites and it has the following structure in Testomat

  • Shifts @S1 shifts1.spec.ts
    • With detailed capacity @S1a
  • Shifts @S2 shifts2.spec.ts
    • Without detailed capacity @S2a
  • Shifts @S3 shifts3.spec.ts
    • Extra @S3a

When I call npx check-tests@latest Playwright ....... --update-ids
@S3 suiteId will be inserted into each file's root describe and child suites will not be mapped/inserted.

Java TestNG & Junit integration

  • auto assign ids from testomat
  • manual ids assignment
  • sync with testomat.io

Support following actions:

  • Importing Into Project
  • Disable Detached Tests
  • Synchronous Import
  • Auto-assign Test IDs in Source Code
  • Keep Test IDs Between Projects
  • Clean Test IDs
  • Import Into a Branch
  • Keep Structure of Source Code
  • Delete Empty Suites
  • Import Into a Specific Suite

Add support for it.each tests in Jest

Support for data driven tests in Jest.

Jest has test.each syntax which can generate multiple test cases at once. We need to support it in our parser to handle such cases.

Jest parser should be updated to handle test.each as tests.
As a reference take similar syntax from CodeceptJS

// in Jest
test.each([1,2])()

// in CodeceptJS
Data([1,2]).Scenario()

Here is the implementation from CodeceptJS
https://github.com/testomatio/check-tests/blob/master/lib/frameworks/codeceptjs.js#L72

Implement a similar thing for Jest parser as well.
https://github.com/testomatio/check-tests/blob/master/lib/frameworks/jest.js

Unit test for test.each case should also be added here https://github.com/testomatio/check-tests/blob/master/tests/jest_test.js

check-tests fails on the CI with Prepend_dir and Update_ids

Trace below-

Generating script.
Script contents:
TESTOMATIO_PREPEND_DIR="Cash Money" TESTOMATIO=* npx check-tests@latest Playwright "**/*{.,_}{test,spec,cy}.ts" --typescript  --purge --no-detached --keep-structure --update-ids --sync --create
========================== Starting Command Output ===========================
/usr/bin/bash --noprofile --norc /usr/local/azuredevopsagent/_work/_temp/9f550b77-aa0e-4b26-89b7-9feeed724d36.sh
 ๐Ÿคฉ Tests checker by Testomat.io v0.8.19
Error: ENOENT: no such file or directory, open '/usr/local/azuredevopsagent/_work/1/s/tests/Capo.UI.Testing/Cash Money/tests/acquisition/loan-application.spec.ts'
Error: ENOENT: no such file or directory, open '/usr/local/azuredevopsagent/_work/1/s/tests/Capo.UI.Testing/Cash Money/tests/acquisition/loan-application.spec.ts'
    at Object.openSync (node:fs:589:3)
    at Object.readFileSync (node:fs:457:35)
    at cleanIdsCommon (/home/azureagent/.npm/_npx/876480043fc67df8/node_modules/check-tests/src/updateIds/updateIds.js:121:26)
    at cleanIds (/home/azureagent/.npm/_npx/876480043fc67df8/node_modules/check-tests/src/updateIds/index.js:11:10)
    at Command.<anonymous> (/home/azureagent/.npm/_npx/876480043fc67df8/node_modules/check-tests/bin/check.js:89:23)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
##[error]Bash exited with code '1'.
Finishing: Upload Playwright tests

Add "--line-numbers" option to check-test npm command

Add "--line-numbers" option to check-test npm command.
Example:
[without mode]

 Scenario('Edited todo is saved', async (I, TodosPage) => {
  I.say('Given I have some todos');\n" +
});

[with mode]

10: Scenario('Edited todo is saved', async (I, TodosPage) => {
11:  I.say('Given I have some todos');\n" +
12: });

Error parsing {some test file}: SyntaxError: Unexpected token (42:9)

I'm running the command TESTOMATIO={the_project_key} npx check-tests@latest Jest "**/*{.,_}{test,spec}.js" -d src/tests.

The command manages to find only one valid test.

All other tests fail, apparently because the command does not understand JSX.

Here are a few examples where the checker throws the error:

	it('has import now button', () => {
		const button_text = 'Push me!';
		render(<App buttonText={button_text}/>);
		expect(button()).not.toBeNull();
		expect(button().textContent).toEqual(button_text);
	});
describe('Items to scan UI', () => {
	const items = ['plugin1', 'plugin2'];
	let onSelected;
	const render = () => shallow(<ItemsToScan heading={'heading'} items={items} onSelected={onSelected}/>);

	beforeEach(() => {
		onSelected = jest.fn();
	});
describe('MO Scan on Localization page', () => {

	it('creates app', () => {
		const fileCount = 10;
		const filesToScan = {
			count: fileCount,
			plugins: ['plugin1'],
			themes: [],
			other: []
		};
		const expectedTitle = "WPML has detected changed or new MO files";

		const wrapper = shallow(
			<MOScanUILocalizationPage filesToScan={filesToScan}/>
		);

In all cases, it fails when it encounters some JSX (<App buttonText={button_text}/>, <ItemsToScan, <MOScanUILocalizationPage).

I don't know if that's a known limitation (from the docs, it doesn't look like it is) and how I can get around it.

Running Jest, of course, works without problems, as these are tests we have for a few years already.

I can share the source code if needed, but with other more private means, as it's from a commercial product.

Improve the support for it.each tests in Jest

After test.each support was added (#35) the new problem appeared. If the file has a test.each construction it will upload as one test with template string as name. This situation makes problems with runs because such type of test can't be matched on the platform.
The test parser should add every test from test.each construction as a separate test with the right ID

let's allow ignoring test suite without a tag reference

Is your feature request related to a problem? Please describe.
when we try to upload the test XML report then all test suits will be uploaded and an appropriate folder will be created even if there are no test suits tag references in the test suits name

Describe the solution you'd like
would be great to ignore test suits without @ tag references in the name

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Fix TypeScript support (--update-ids option)

Auto-assign Test IDs with --typescript option reformat code and cut out typings in test.

ENV: TS, Jest

STR:

  1. In __tests__ folder create new file eg.test.ts
  2. Add code:
const isEven = (n: number): boolean => n % 2 === 0;

const cases: Array<[number, boolean]> = [
    [2, true],
    [0, true],
    [1, false],
    [-2, true],
    [-1, false],
    [Math.PI, false],
    [50, true],
    [75, false]
]

describe('Check if number is even', () => {
    it.each(cases)('The %d is even %p', (number, expected ) => {
        expect(isEven(number)).toBe(expected)
    })
})
  1. Run update ids command
check-tests --typescript Jest "__tests__/*{.,_}{test,spec}.ts" --update-ids

AR:

  1. Code had reformatted
  2. Typings had removed
const isEven = (n) => n % 2 === 0;
const cases = [[2, true], [0, true], [1, false], [-2, true], [-1, false], [Math.PI, false], [50, true], [75, false]];
describe('Check if number is even @S298ffaa1', () => {
  it.each(cases)('The %d is even %p', (number, expected) => {
    expect(isEven(number)).toBe(expected);
  });
});

ER:

const isEven = (n: number): boolean => n % 2 === 0;

const cases: Array<[number, boolean]> = [
    [2, true],
    [0, true],
    [1, false],
    [-2, true],
    [-1, false],
    [Math.PI, false],
    [50, true],
    [75, false]
]

describe('Check if number is even @S298ffaa1', () => {
    it.each(cases)('The %d is even %p', (number, expected ) => {
        expect(isEven(number)).toBe(expected)
    })
})

Check-tests v 0.8.5 shows warning for current project

To Reproduce

  1. import tests with check-tests v 0.8.5 with --update-ids to Testomat project
  2. import tests with check-tests v 0.8.5 with --update-ids again to the project
  3. see warning in terminal:
    ! Previously set Test IDs detected, new IDs ignored
    ! Clean previously set Test IDs to override them
    ! Run script with DEBUG="testomatio:*" flag to get more info of affected tests
    0 files updated.

CleanShot 2023-02-22 at 14 24 21@2x

String concatenation in test titles

Users should use string literals instead of + in test titles:

BAD                                           GOOD
'test' + id + ' very important' => `test ${id} important`
  • Docs to use string literals instead (Most top, in Requirements)
  • Try to detect concatenation (or any extra things except string or string literal)

--no-empty option seems to be ignored on backend

Describe the bug
There seems to be a no way to get rid of empty test suites

To Reproduce
I have tried to import test with both options

Screenshot 2023-09-29 at 18 10 46 Screenshot 2023-09-29 at 18 09 18

After import - empty suite remains available
image

Expected behavior
When noempty is sent as true - Testomatio removes empty suites

Playwright automated tests are not being linked with manual tests with the same name

Describe the bug
Upon importing automated tests from Playwright to the project with manual tests with the same names as auto tests, it can be noticed that the manual and automated tests do not match the corresponding manual tests.

To Reproduce
Steps to reproduce the behavior:

  1. Create a classic project with a manual test with a set name
  2. Import Playwright test with the same name

Expected behavior
Manual and automated test cases merge

Actual behavior
Tests stay separated

Desktop (please complete the following information):

  • OS: macOS 13.5.2 (22G91)
  • Browser Chrome
  • Browser Version 116.0.5845.187
  • Application: production

Parameter in parameterised test incorrectly parsed on API side

Describe the bug
Testomatio API incorrectly parse parameterised test value

To Reproduce
Execute parameterised test
Ex. request to API

{
  'artifacts': [],
   'code': None,
   'example': None,
   'message': None,
   'run_time': 0.7919288370176218,
   'stack': None,
   'status': None,
   'steps': None,
   'suite_id': None,
   'suite_title': 'test_local_file_operations_via_cli.py',
   'test_id': 'f30bd3b0',
   'title': 'Version 1.0.0 @Tf30bd3b0'
}

Expected behavior
Test is displayed in test run with 1.0.0 parameter

Actual behaviour
Test is displayed in test run with 1 parameter

Screenshots
image
image

0 tests for invalid framework name

If I provide non-lowercased framework name check-tests reports to find 0 test cases:

โžœ  TESTOMATIO={xxx} npx check-tests codeceptJS "**/**_test.js" -d todomvc-tests
 ๐Ÿคฉ Tests checker by testomat.io

SHOWING CODECEPTJS TESTS FROM **/**_test.js:



TOTAL 0 TESTS FOUND


 ๐Ÿš€ Sending data to testomat.io

Once I change this to codeceptjs it is fine.


  • It should lowercase the framework name and search for it
  • If 0 tests is found it should show proper message and probably exit with 1 code

Script to update test ids doesn't work

The script that we use to update the test ids does not add new test ids for added test scenarios

Script: TESTOMATIO=b0f2514004q7 npx check-tests@latest CodeceptJS "**/*{.,_}{test,spec}.ts" --typescript --update-ids

Example file

More info on this slack thread.

How to make Manual Run use CI configuration

I tried to run a CodeceptJS scenario as a Manual Run on Testomat.io but it failed, as it tried to use the default configuration in ./codecept.conf.js which defines localhost.

Expected behavior:

The test should use codecept.ci.conf.js which defines a publicly available live URL of my production server.

`stable` branch not updated since Sep 2021

This follows on from issue #79 "stable branch gives Node.js 12 deprecation warning".

The stable branch recommended in the README documentation is unchanged since commit 0ea638f of @DavertMik on Sep 25, 2021.

See stable...master

If fixes and features are added to the default master branch, they will not be used by GitHub workflows such as .github/workflows/main.yml in this repository.

- uses: testomatio/check-tests@stable

This can be seen in the "Set up job" job for instance in job 8219074452

Download action repository 'testomatio/check-tests@stable' (SHA:0ea638fcec1820cf2e7b9854fdbdd04128a55bd4)

from the full job log

Current runner version: '2.303.0'
Operating System
Runner Image
Runner Image Provisioner
GITHUB_TOKEN Permissions
Secret source: None
Prepare workflow directory
Prepare all required actions
Getting action download info
Download action repository 'actions/checkout@v1' (SHA:50fbc622fc4ef5163becd7fab6573eac35f8462e)
Download action repository 'actions/setup-node@v2' (SHA:1f8c6b94b26d0feae1e387ca63ccbdc44d27b561)
Download action repository 'testomatio/check-tests@stable' (SHA:0ea638fcec1820cf2e7b9854fdbdd04128a55bd4)
Complete job name: Check Tests

Suggestion

Merge the latest release 0.8.12 into the stable branch.

Python RobotFramework integration

  • auto assign ids from testomat
  • manual ids assignment
  • sync with testomat.io

Support following actions:

  • Importing Into Project
  • Disable Detached Tests
  • Synchronous Import
  • Auto-assign Test IDs in Source Code
  • Keep Test IDs Between Projects
  • Clean Test IDs
  • Import Into a Branch
  • Keep Structure of Source Code
  • Delete Empty Suites
  • Import Into a Specific Suite

One-to-many test mapping

Is your feature request related to a problem? Please describe.
Some of our automation tests fulfill the requirements of several test case ID's from our test management system. Currently it seems only one-to-one mapping exists between a single automation test and single test case that is imported or created in testomatio

Describe the solution you'd like
The ability to map a single automation test to multiple test cases.

Describe alternatives you've considered
Rewriting automation tests to be one to one, however with 1k+ tests, it could take considerable time.

Additional context
In a framework like Playwright, we have the ability to create a test which includes several test.step methods. It might be helpful if we can identify which portion of the test applies to individual test cases. From my understanding, most frameworks offer the ability have soft assertions which continue on the test if one step fails. Currently, we have multiple test cases tied to a single automation test setup as follows however:

        test.describe("Add/Edit user (parallel)", () => {
            for (const role of roles1) {
                baseTest.describe(`[C88, C81641, C8209, C8199, C43080, C45741]: ${role.groupName}`, () => {
                    baseTest.use({ storageState: `${role.storageStatePath}` });
    
                    baseTest(`Add new Worker`, async ({ userPage, random, apiRequest, common, request }) => {
                        await apiRequest.createAgency(request, random.agencyName);
                        const officeID = await apiRequest.createBillingOffice(request, random.officeName);
                        const campusID = await apiRequest.createCampus(request, random.campusName);
                        await apiRequest.createFacility(request, random.facilityName, random.rand, officeID, campusID);
                        await Promise.all([
                            userPage.page.goto(`${process.env.BASE_URL}admin`),
                            userPage.page.waitForResponse(resp => resp.url().includes('api/v1/users/table') && resp.status() == 200)
                        ])
                        await userPage.usersPO.openAddUserPage();
                        await userPage.addEditUserPO.addWorker(random.userEmail, random.userPhoneNumber, random.facilityName, random.agencyName, role.groupName);
                        await common.goToUsersPage();
                        await userPage.usersPO.verifyTheUserExist(random.userEmail);
                        await userPage.usersPO.openFirstUserPage();
                        await expect(userPage.addEditUserPO.submittionStatusButton).toContainText('accepted');
                        await userPage.addEditUserPO.verifyWorkerInfo(random.userEmail, random.userPhoneNumber, random.facilityName, random.agencyName, role.groupName);
                    })
                })
           }

This approach is less ideal but what we're currently using.

GH report error if create PR from fork

https://github.com/testomatio/check-tests/pull/83/checks

Error: Resource not accessible by integration
RequestError [HttpError]: Resource not accessible by integration
    at /home/runner/work/_actions/testomatio/check-tests/stable/node_modules/@octokit/request/dist-node/index.js:66:23
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async run (/home/runner/work/_actions/testomatio/check-tests/stable/index.js:119:7) {
  status: 403,

Update Playwright tags parsing

Is your feature request related to a problem? Please describe.

Playwrigh has new tags format. Need to update check-tests to import tags correctly to Testomat.

telegram-cloud-photo-size-2-5400026170847779021-y

Python py.test integration

  • auto assign ids from testomat
  • manual ids assignment
  • sync with testomat.io

Support following actions:

  • Importing Into Project
  • Disable Detached Tests
  • Synchronous Import
  • Auto-assign Test IDs in Source Code
  • Keep Test IDs Between Projects
  • Clean Test IDs
  • Import Into a Branch
  • Keep Structure of Source Code
  • Delete Empty Suites
  • Import Into a Specific Suite

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.