Skip to content

Commit

Permalink
fix: убрана кнопка "все тесты" при отсутствии scenarios.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
popstas committed Jul 8, 2018
1 parent fb012da commit 215bcbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/Dialog.vue
Expand Up @@ -6,7 +6,7 @@
<Message :message="message"></Message>
</el-row>
</el-row>
<div class="dialog__tests" v-if="tests && $store.state.isBottomTests">
<div class="dialog__tests" v-if="tests.length > 0 && $store.state.isBottomTests">
<MessageButton class="message__button" v-for="dialog in tests" :key="dialog.name"
:title="dialog.name" :payload="JSON.stringify({ scenarios_test: [dialog] })"></MessageButton>
<MessageButton class="message__button" title="все тесты" :payload="JSON.stringify({ scenarios_test: tests })"></MessageButton>
Expand Down
7 changes: 4 additions & 3 deletions store/index.js
Expand Up @@ -299,7 +299,7 @@ export const actions = {
class: 'info'
});
} catch (err) {
console.error(err);
//console.error(err);
// it's normal
}
},
Expand All @@ -321,6 +321,7 @@ export const actions = {

async [RUN_TEST]({ dispatch, getters, commit }, dialogs) {
let allFailedTests = [];
const verbose = false;

// test suites (one dialog - one button)
for (let d in dialogs) {
Expand Down Expand Up @@ -355,7 +356,7 @@ export const actions = {

// simple equals string
if (typeof message === 'string') {
console.log(`test ${msg.text} == ${message}`);
if(verbose) console.log(`test ${msg.text} == ${message}`);
if (msg.text != message) {
isDialogErrors = true;
commit(ADD_MESSAGE, {
Expand Down Expand Up @@ -389,7 +390,7 @@ export const actions = {
message.tests.forEach(testmessage => {
let testType = Object.keys(testmessage)[0];
let testVal = testmessage[testType];
console.log(`test ${testType} ${testVal}`);
if(verbose) console.log(`test ${testType} ${testVal}`);
// contains
if (testType == 'contains' && !msg.text.includes(testVal)) {
messageErrors.push(`ответ не содержит "${testVal}"`);
Expand Down

0 comments on commit 215bcbf

Please sign in to comment.