added locators for lock unlock torn flow

This commit is contained in:
Roman Kasinsky 2022-06-13 18:13:02 +03:00 committed by Danil Kovtonyuk
parent 7f57fb6263
commit 6d56ed2405
5 changed files with 34 additions and 9 deletions

View File

@ -35,6 +35,7 @@
type="is-text" type="is-text"
:icon-left="isDataLoading ? '' : 'settings'" :icon-left="isDataLoading ? '' : 'settings'"
:loading="isDataLoading" :loading="isDataLoading"
data-test="button_manage_torn"
@click.native="onManage" @click.native="onManage"
> >
{{ $t('manage') }} {{ $t('manage') }}

View File

@ -1,7 +1,7 @@
<template> <template>
<div class="modal-card box box-modal has-delete"> <div class="modal-card box box-modal has-delete">
<button type="button" class="delete" @click="$emit('close')" /> <button type="button" class="delete" @click="$emit('close')" />
<b-tabs v-model="activeTab" :animated="false" class="is-modal"> <b-tabs v-model="activeTab" :data-test="`tab_${activeTab}`" :animated="false" class="is-modal">
<LockTab /> <LockTab />
<UnlockTab /> <UnlockTab />
<DelegateTab /> <DelegateTab />

View File

@ -1,5 +1,5 @@
<template> <template>
<b-tab-item :label="$t('delegate')"> <b-tab-item :label="$t('delegate')" header-class="delegate_tab">
<div class="p"> <div class="p">
{{ $t('delegateTabDesc') }} {{ $t('delegateTabDesc') }}
</div> </div>

View File

@ -1,5 +1,5 @@
<template> <template>
<b-tab-item :label="$t('lock')"> <b-tab-item :label="$t('lock')" header-class="lock_torn_tab">
<div class="p"> <div class="p">
{{ $t('lockTabDesc') }} {{ $t('lockTabDesc') }}
</div> </div>
@ -7,6 +7,7 @@
<b-field :class="hasErrorAmount ? 'is-warning' : ''"> <b-field :class="hasErrorAmount ? 'is-warning' : ''">
<b-input <b-input
v-model="computedAmountToLock" v-model="computedAmountToLock"
data-test="input_torn_amount_to_lock"
step="0.01" step="0.01"
:min="minAmount" :min="minAmount"
:max="maxAmountToLock" :max="maxAmountToLock"
@ -18,6 +19,7 @@
<div class="control has-button"> <div class="control has-button">
<button <button
class="button is-primary is-small is-outlined" class="button is-primary is-small is-outlined"
data-test="button_max_torn_amount_to_lock"
@mousedown.prevent @mousedown.prevent
@click="setMaxAmountToLock" @click="setMaxAmountToLock"
> >
@ -27,13 +29,26 @@
</b-field> </b-field>
</b-field> </b-field>
<div class="label-with-value"> <div class="label-with-value">
{{ $t('availableBalance') }}: <span><number-format :value="maxAmountToLock" /> TORN</span> {{ $t('availableBalance') }}:
<span><number-format data-test="info_available_balance" :value="maxAmountToLock" /> TORN</span>
</div> </div>
<div class="buttons buttons__halfwidth"> <div class="buttons buttons__halfwidth">
<b-button type="is-primary is-fullwidth" outlined :disabled="disabledApprove" @click="onApprove"> <b-button
type="is-primary is-fullwidth"
outlined
data-test="button_approve_torn"
:disabled="disabledApprove"
@click="onApprove"
>
{{ $t('approve') }} {{ $t('approve') }}
</b-button> </b-button>
<b-button type="is-primary is-fullwidth" outlined :disabled="disabledLock" @click="onLock"> <b-button
type="is-primary is-fullwidth"
outlined
data-test="button_lock_torn"
:disabled="disabledLock"
@click="onLock"
>
{{ $t('lock') }} {{ $t('lock') }}
</b-button> </b-button>
</div> </div>

View File

@ -1,5 +1,5 @@
<template> <template>
<b-tab-item :label="$t('unlock')"> <b-tab-item :label="$t('unlock')" header-class="unlock_torn_tab">
<div class="p"> <div class="p">
{{ $t('unlockTabDesc') }} {{ $t('unlockTabDesc') }}
</div> </div>
@ -7,6 +7,7 @@
<b-field :class="hasErrorAmount ? 'is-warning' : ''"> <b-field :class="hasErrorAmount ? 'is-warning' : ''">
<b-input <b-input
v-model="computedAmountToUnlock" v-model="computedAmountToUnlock"
data-test="input_torn_amount_to_unlock"
step="0.01" step="0.01"
:min="minAmount" :min="minAmount"
:max="maxAmountToUnlock" :max="maxAmountToUnlock"
@ -18,6 +19,7 @@
<div class="control has-button"> <div class="control has-button">
<button <button
class="button is-primary is-small is-outlined" class="button is-primary is-small is-outlined"
data-test="button_max_torn_amount_to_unlock"
@mousedown.prevent @mousedown.prevent
@click="setMaxAmountToUnlock" @click="setMaxAmountToUnlock"
> >
@ -27,7 +29,8 @@
</b-field> </b-field>
</b-field> </b-field>
<div class="label-with-value"> <div class="label-with-value">
{{ $t('lockedBalance') }}: <span><number-format :value="maxAmountToUnlock" /> TORN</span> {{ $t('lockedBalance') }}:
<span><number-format data-test="info_locked_balance" :value="maxAmountToUnlock" /> TORN</span>
</div> </div>
<b-tooltip <b-tooltip
class="is-block" class="is-block"
@ -36,7 +39,13 @@
:active="!hasLockedBalance || !canWithdraw" :active="!hasLockedBalance || !canWithdraw"
multilined multilined
> >
<b-button :disabled="disableUnlock" type="is-primary is-fullwidth" outlined @click="onUnlock"> <b-button
:disabled="disableUnlock"
type="is-primary is-fullwidth"
outlined
data-test="button_unlock_torn"
@click="onUnlock"
>
{{ $t('unlock') }} {{ $t('unlock') }}
</b-button> </b-button>
</b-tooltip> </b-tooltip>