niche-tester / playwright-testrail-reporter

Report playwright test results to TestRail
MIT License
7 stars 9 forks source link

Playwright - Testrail integration is not working #20

Open exotlv opened 5 months ago

exotlv commented 5 months ago

Config: ["playwright-testrail-reporter", { TESTRAIL_HOST: 'https://URL/', // Your TestRail domain TESTRAIL_USERNAME: 'Login', // Your TestRail username TESTRAIL_PASSWORD: 'Password', // Your TestRail password or API token TESTRAIL_PROJECT_ID: 1, // ID of your TestRail project TESTRAIL_SUITE_ID: 2, // ID of your TestRail test suite TESTRAIL_RUN_ID: 2204, }],

[playwright-testrail-reporter] No Existing 'TESTRAIL_RUN_ID' provided by user... [playwright-testrail-reporter] Automatically creating a run... [playwright-testrail-reporter] Failed to create new TestRail run: TypeError: Only absolute URLs are supported [playwright-testrail-reporter] Test Case Completed : Проверка главной страницы неавторизованным пользователем @C4 Status : failed [playwright-testrail-reporter] Matched Test Case ID: 4 [playwright-testrail-reporter] Updating test status for the following TestRail Run ID: NaN [playwright-testrail-reporter] Failed to update test results: {}

tsakrikas commented 5 months ago

@exotlv I have commented out the TESTRAIL_RUN_ID from my environment file, so the run id is auto created in testrail (named as TESTRAIL_RUN_NAME entry - Created On May 02 2024 14:55:57):

[playwright-testrail-reporter] No Existing 'TESTRAIL_RUN_ID' provided by user... [playwright-testrail-reporter] Automatically creating a run... [playwright-testrail-reporter] Test Case Completed : C45328 "Test Name" : passed [playwright-testrail-reporter] Updating test status for the following TestRail Run ID: 639

In case you create manually the test run prior to the tetst execution, then you must add it under the env file as TESTRAIL_RUN_ID = "run id"

Checking you error, are you sure that you have added the entry under your env file like TESTRAIL_HOST= http://your.testrailhost.com ?

exotlv commented 5 months ago

@tsakrikas config: ["playwright-testrail-reporter", { TESTRAIL_HOST: process.env.CI_TESTRAIL_HOST || "127.0.0.1", TESTRAIL_USERNAME: process.env.CI_TESTRAIL_USERNAME, TESTRAIL_PASSWORD: process.env.CI_TESTRAIL_PASSWORD, TESTRAIL_PROJECT_ID: process.env.CI_TESTRAIL_PROJECT_ID, TESTRAIL_SUITE_ID: process.env.CI_TESTRAIL_SUITE_ID, TESTRAIL_RUN_NAME: process.env.CI_TESTRAIL_RUN_NAME, // TESTRAIL_RUN_ID: process.env.CI_TESTRAIL_RUN_ID, }],

.env file config:
`CI_TESTRAIL_HOST=https://host.testrail.io

CI_TESTRAIL_USERNAME=name@name.com CI_TESTRAIL_PASSWORD=password CI_TESTRAIL_PROJECT_ID=1 CI_TESTRAIL_SUITE_ID=2 CI_TESTRAIL_RUN_NAME=Regression Suite CI_TESTRAIL_RUN_ID=2211 `

And I got this: image

exotlv commented 5 months ago

I managed to fix it. Now problem same as u have: Test Status is failed {"message":"TimeoutError: locator.waitFor: Timeout 5000ms exceeded.\nCall log:\n \u001b[2m- waiting for locator('div.balance__icon.mobileы')\u001b[22m\n","stack":"TimeoutError: locator.waitFor: Timeout 5000ms exceeded.\nCall log:\n \u001b[2m- waiting for locator('div.balance__icon.mobileы')\u001b[22m\n\n at D:\\tests-ui\\tests\\stage\\1_signIn\\logout\\logout.spec.js:50:23","location":{"file":"D:\\tests-ui\\tests\\stage\\1_signIn\\logout\\logout.spec.js","column":23,"line":50},"snippet":"\u001b[0m \u001b[90m 48 |\u001b[39m \u001b[90m// Проверем наличие элемента с балансом игрока\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 49 |\u001b[39m \u001b[36mconst\u001b[39m balance \u001b[33m=\u001b[39m \u001b[36mawait\u001b[39m page\u001b[33m.\u001b[39mlocator(balancePlayer\u001b[33m.\u001b[39mbuttonExpand)\u001b[33m;\u001b[39m\u001b[0m\n\u001b[0m\u001b[31m\u001b[1m>\u001b[22m\u001b[39m\u001b[90m 50 |\u001b[39m \u001b[36mawait\u001b[39m balance\u001b[33m.\u001b[39mwaitFor({state\u001b[33m:\u001b[39m \u001b[32m'attached'\u001b[39m\u001b[33m,\u001b[39m timeout\u001b[33m:\u001b[39m \u001b[35m5000\u001b[39m})\u001b[33m;\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m |\u001b[39m \u001b[31m\u001b[1m^\u001b[22m\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 51 |\u001b[39m \u001b[36mawait\u001b[39m balance\u001b[33m.\u001b[39mclick()\u001b[33m;\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 52 |\u001b[39m \u001b[90m// Ожидаем открытие меню баланса и других кнопок\u001b[39m\u001b[0m\n\u001b[0m \u001b[90m 53 |\u001b[39m \u001b[36mawait\u001b[39m objectTry_out(page\u001b[33m,\u001b[39m windowBalance\u001b[33m,\u001b[39m \u001b[32m'attached'\u001b[39m)\u001b[33m;\u001b[39m\u001b[0m"}

and no screenshot

tsakrikas commented 5 months ago

@exotlv your initial issue probably was due to usage of testrail params inside the playwright config file - to my understanding it is required to have them just under an .env file.