Skip to content

Commit

Permalink
Merge branch 'master' into allow-spending-unconfirmed-bsq-utxs
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer committed Mar 2, 2019
2 parents 4332c16 + 79865eb commit e62557c
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 33 deletions.
Expand Up @@ -169,7 +169,6 @@ private boolean sendMessage(MobileMessage message,
boolean useSound,
Consumer<String> resultHandler,
Consumer<Throwable> errorHandler) throws Exception {
log.info("Send message: '{}'", message.getMessage());
if (mobileModel.getKey() == null)
return false;

Expand Down Expand Up @@ -199,6 +198,9 @@ private boolean sendMessage(MobileMessage message,
if (!doSend)
return false;

log.info("Send message: '{}'", message.getMessage());


log.info("sendMessage message={}", message);
Gson gson = new Gson();
String json = gson.toJson(message);
Expand Down
Expand Up @@ -61,9 +61,9 @@ public void onAllServicesInitialized() {

private void setDisputeListener(Dispute dispute) {
//TODO use weak ref or remove listener
log.info("We got a dispute added. id={}, tradeId={}", dispute.getId(), dispute.getTradeId());
log.debug("We got a dispute added. id={}, tradeId={}", dispute.getId(), dispute.getTradeId());
dispute.getDisputeCommunicationMessages().addListener((ListChangeListener<DisputeCommunicationMessage>) c -> {
log.info("We got a DisputeCommunicationMessage added. id={}, tradeId={}", dispute.getId(), dispute.getTradeId());
log.debug("We got a DisputeCommunicationMessage added. id={}, tradeId={}", dispute.getId(), dispute.getTradeId());
c.next();
if (c.wasAdded()) {
c.getAddedSubList().forEach(this::setDisputeCommunicationMessage);
Expand Down
Binary file modified desktop/package/macosx/Bisq-background.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
78 changes: 75 additions & 3 deletions desktop/src/main/java/bisq/desktop/main/MainView.java
Expand Up @@ -40,6 +40,7 @@
import bisq.desktop.util.Transitions;

import bisq.core.exceptions.BisqException;
import bisq.core.locale.GlobalSettings;
import bisq.core.locale.Res;
import bisq.core.util.BSFormatter;

Expand Down Expand Up @@ -80,11 +81,17 @@
import javafx.geometry.Orientation;
import javafx.geometry.Pos;

import javafx.beans.binding.ObjectBinding;
import javafx.beans.property.BooleanProperty;
import javafx.beans.property.SimpleStringProperty;
import javafx.beans.property.StringProperty;
import javafx.beans.value.ChangeListener;

import java.text.DecimalFormat;
import java.text.NumberFormat;

import java.util.Locale;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

Expand Down Expand Up @@ -186,6 +193,11 @@ protected void initialize() {
JFXBadge daoButtonWithBadge = new JFXBadge(daoButton);
daoButtonWithBadge.getStyleClass().add("new");

Locale locale = GlobalSettings.getLocale();
DecimalFormat currencyFormat = (DecimalFormat) NumberFormat.getNumberInstance(locale);
currencyFormat.setMinimumFractionDigits(2);
currencyFormat.setMaximumFractionDigits(2);

root.sceneProperty().addListener((observable, oldValue, newValue) -> {
if (newValue != null) {
newValue.addEventHandler(KeyEvent.KEY_RELEASED, keyEvent -> {
Expand Down Expand Up @@ -231,15 +243,75 @@ protected void initialize() {
Tuple2<Label, VBox> availableBalanceBox = getBalanceBox(Res.get("mainView.balance.available"));
availableBalanceBox.first.textProperty().bind(model.getAvailableBalance());
availableBalanceBox.first.setPrefWidth(100);
availableBalanceBox.first.setTooltip(new Tooltip(Res.get("mainView.balance.available")));
availableBalanceBox.first.tooltipProperty().bind(new ObjectBinding<>() {
{
bind(model.getAvailableBalance());
bind(model.getMarketPrice());
}

@Override
protected Tooltip computeValue() {
String tooltipText = Res.get("mainView.balance.available");
try {
double availableBalance = Double.parseDouble(
model.getAvailableBalance().getValue().replace("BTC", ""));
double marketPrice = Double.parseDouble(model.getMarketPrice().getValue());
tooltipText += "\n" + currencyFormat.format(availableBalance * marketPrice) +
" " + model.getPreferences().getPreferredTradeCurrency().getCode();
} catch (NullPointerException | NumberFormatException e) {
// Either the balance or market price is not available yet
}
return new Tooltip(tooltipText);
}
});

Tuple2<Label, VBox> reservedBalanceBox = getBalanceBox(Res.get("mainView.balance.reserved.short"));
reservedBalanceBox.first.textProperty().bind(model.getReservedBalance());
reservedBalanceBox.first.setTooltip(new Tooltip(Res.get("mainView.balance.reserved")));
reservedBalanceBox.first.tooltipProperty().bind(new ObjectBinding<>() {
{
bind(model.getReservedBalance());
bind(model.getMarketPrice());
}

@Override
protected Tooltip computeValue() {
String tooltipText = Res.get("mainView.balance.reserved");
try {
double reservedBalance = Double.parseDouble(
model.getReservedBalance().getValue().replace("BTC", ""));
double marketPrice = Double.parseDouble(model.getMarketPrice().getValue());
tooltipText += "\n" + currencyFormat.format(reservedBalance * marketPrice) +
" " + model.getPreferences().getPreferredTradeCurrency().getCode();
} catch (NullPointerException | NumberFormatException e) {
// Either the balance or market price is not available yet
}
return new Tooltip(tooltipText);
}
});

Tuple2<Label, VBox> lockedBalanceBox = getBalanceBox(Res.get("mainView.balance.locked.short"));
lockedBalanceBox.first.textProperty().bind(model.getLockedBalance());
lockedBalanceBox.first.setTooltip(new Tooltip(Res.get("mainView.balance.locked")));
lockedBalanceBox.first.tooltipProperty().bind(new ObjectBinding<>() {
{
bind(model.getLockedBalance());
bind(model.getMarketPrice());
}

@Override
protected Tooltip computeValue() {
String tooltipText = Res.get("mainView.balance.locked");
try {
double lockedBalance = Double.parseDouble(
model.getLockedBalance().getValue().replace("BTC", ""));
double marketPrice = Double.parseDouble(model.getMarketPrice().getValue());
tooltipText += "\n" + currencyFormat.format(lockedBalance * marketPrice) +
" " + model.getPreferences().getPreferredTradeCurrency().getCode();
} catch (NullPointerException | NumberFormatException e) {
// Either the balance or market price is not available yet
}
return new Tooltip(tooltipText);
}
});

HBox primaryNav = new HBox(marketButton, getNavigationSeparator(), buyButton, getNavigationSeparator(),
sellButton, getNavigationSeparator(), portfolioButtonWithBadge, getNavigationSeparator(), fundsButton);
Expand Down
5 changes: 5 additions & 0 deletions desktop/src/main/java/bisq/desktop/main/MainViewModel.java
Expand Up @@ -97,6 +97,7 @@ public class MainViewModel implements ViewModel, BisqSetup.BisqSetupCompleteList
private final DaoPresentation daoPresentation;
private final P2PService p2PService;
private final TradeManager tradeManager;
@Getter
private final Preferences preferences;
private final PrivateNotificationManager privateNotificationManager;
private final WalletPasswordWindow walletPasswordWindow;
Expand Down Expand Up @@ -591,6 +592,10 @@ IntegerProperty getMarketPriceUpdated() {
return marketPricePresentation.getMarketPriceUpdated();
}

StringProperty getMarketPrice() {
return marketPricePresentation.getMarketPrice();
}

public ObservableList<PriceFeedComboBoxItem> getPriceFeedComboBoxItems() {
return marketPricePresentation.getPriceFeedComboBoxItems();
}
Expand Down
Expand Up @@ -237,4 +237,8 @@ public BooleanProperty getIsPriceAvailable() {
public IntegerProperty getMarketPriceUpdated() {
return marketPriceUpdated;
}

public StringProperty getMarketPrice() {
return marketPrice;
}
}
59 changes: 32 additions & 27 deletions docs/testing.md
Expand Up @@ -8,61 +8,66 @@ In order to take part in the testing process, you will need to do the following:

- Build Bisq from source (see [build.md](build.md))
- Setup a development/testing environment (see [dev-setup.md](dev-setup.md))
- Register an account with [TestQuality](https://bisq.testquality.com)

_**Note:** Once you have registered an account, or if you have trouble registering, contact us in Slack (see below) to be granted permissions to execute test runs._
- Request access to [TestPad](https://bisq.ontestpad.com) (our test management tool)

## Communication Channels

If you would like to discuss and/or contribute to Bisq's testing effort, join us in the [#testing](https://bisq.slack.com/messages/CEBLT79ML) channel within the [Bisq Slack workspace](https://bisq.network/slack-invite).

## Compensation

Testing activities are eligible for [compensation](https://docs.bisq.network/dao/phase-zero.html#how-to-request-compensation). When submitting a compensation request, please include links to artifacts on TestQuality indicating the activities that were performed (e.g. test plan runs that were executed), as well as any bugs that were discovered and entered as a result of testing.
Testing activities are eligible for [compensation](https://docs.bisq.network/dao/phase-zero.html#how-to-request-compensation).
When submitting a compensation request, please include links to artifacts on TestPad (results/reports) indicating the activities that were performed (e.g. tests that were executed), as well as any bugs that were discovered and entered as a result of testing.

## Testing Process

[TestQuality](https://bisq.testquality.com) is used to manage and track the manual testing process. For specific usage or functionality of TestQuality, please see the guided tour or refer to the help content within TestQuality.
[TestPad](https://bisq.ontestpad.com) is used to manage and track the manual testing process.
For specific usage or functionality of TestPad, please see the flash card introduction within TestPad.

### Definitions

Some definitions within the context of TestQuality:
Some definitions within the context of TestPad and how they apply to our specific testing process:

- **Project:** Defines a particular testing scope with relevant tests.
- **Script:** Each script is a collection of related tests that are intended to be used to test a particular component.
- **Folder:** Defines a group of scripts for each release.

### Test Structure

- **Test Case:** a set of conditions under which a tester will determine whether the system under test satisfies requirements or works correctly.
- **Test Suite:** a collection of test cases that are intended to be used to test the system to show that it has some specified set of behaviours.
- **Test Plan:** defines a particular testing scope with testing activities.
- **Test Plan Run:** an occurrence in which a particular test plan is executed.
Tests are written using Behaviour-Driven Development (BDD) style syntax (given/when/then).
- **Given:** This states the preconditions that are assumed for the test. It is not a test step (one that requires a result to be recorded), but instead you must ensure the preconditions are satisfied in order to perform the test.
- **When:** This states the actions to be performed for the test. This also does not require a result to be recorded.
- **Then:** This states the expected results of the test. This requires a result to be recorded.

### Testing Workflow

Once logged in to TestQuality, select the Bisq project from the dashboard.
Once logged in to TestPad, select the `Desktop Client` project from the left navigation menu.

#### Executing a Test Plan Run
Each upcoming release will have a new folder created with applicable scripts that need to be executed.

A new test plan run is created every time a test plan needs to be executed. This allows for tracking the history of test plan’s executions.
#### Executing a Script

To execute a test plan run:
Test runs allow for tracking the results of test execution. Each script may have several test runs created in order to perform the tests on different environments (e.g. operating systems) and assigned to different people. An overview of all test runs for the release can be observed from the main project view, which allows you to quickly find test runs assigned to yourself.

1. Open the test plan run to be executed.
To execute a test run:

1. Select the "Running" state in order to update the start time (used for time tracking purposes).
1. Open the script to be executed.

1. Navigate the test suites and perform each test case.
1. Hover over the applicable test run column and select the play button to start executing the test run.

- Specify a status for each step or for the overall test case and optionally enter the time spent on each step. Select from one of the following statuses:
1. Follow the script and perform each test.

- **Pass:** the test case or step has passed successfully.
- **Pending:** the test case or step has yet to be performed.
- **Fail:** there is an issue (defect) related to the test case or step.
- **Block:** the test case or step is unable to be performed.
- **Retest:** the test case or step needs to be retested.
- **Skip:** the test case or step does not need to be performed.
- Select a status for each test. Select from one of the following statuses:

- If required, use the `Reason for Status` field to add any comments, notes and actual test results. This is especially beneficial to provide details if a test fails.
- **Pass:** the test has passed successfully.
- **Fail:** there is an issue (defect) related to the test.
- **Blocked:** the test cannot be performed for a particular reason.
- **Query:** you are unsure about the test and require further information.
- **Exclude:** the test does not need to be performed for a particular reason.

- If applicable, link an existing or create a new issue (defect) if it was found during the test plan run execution.
- If necessary, use the `Comments` field to add any comments, notes and actual test results. This is especially beneficial to provide details if a test did not pass.

1. Once all test cases within the test plan run have been executed, select the "Complete" state in order to update the end time.
- If applicable, link an existing or create a new issue (defect) if it was found during the test run execution.

### Creating Issues

Expand Down

0 comments on commit e62557c

Please sign in to comment.