Last active
April 10, 2021 17:48
-
-
Save hram/381f291bb5546083d14fc655e30d14b1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run tests | |
description: Triggers automated tests | |
author: Evgeny Hramov | |
version: 1.0 | |
includes: ^ runs / view | |
excludes: | |
js: | |
$(document).ready( | |
function() { | |
document.domain = document.domain | |
/* Create the button */ | |
var button = $('<div class="toolbar content-header-toolbar"><a class="toolbar-button toolbar-button-last toolbar-button-first content-header-button button-start" href="javascript:void(0)">Запустить UI тесты</a></div>'); | |
/* Add it to the toolbar */ | |
$("#content-header .content-header-inner").prepend(button); | |
/* Bind the click event to trigger the automated tests */ | |
$("a", button).click( | |
function() { | |
var somejson = { | |
"branchName": "<replace here>", | |
"buildType": { | |
"id": "<replace here>" | |
}, | |
"properties": { | |
"property": [{ | |
"name": "env.testrail_run_id", | |
"value": +uiscripts.context.run.id | |
}] | |
} | |
} | |
$.ajax({ | |
url: "https://<replace here>/app/rest/buildQueue", | |
dataType: "json", | |
type: "POST", | |
crossDomain: true, | |
headers: { | |
"Authorization": "Bearer <replace here>", | |
"Content-Type": "application/json" | |
}, | |
data: JSON.stringify(somejson), | |
processData: false, | |
success: function() { | |
App.Dialogs.message('Тесты успешно запущены на teamcity. Статус тестов будет автоматически проставлен в TestRail.', 'Успех'); | |
}, | |
error: function() { | |
App.Dialogs.error('An error occurred while trying to trigger the automated tests.'); | |
} | |
}); | |
return false; | |
} | |
); | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment