Skip to content

Commit

Permalink
Merge pull request #1458 from LiskHQ/1455-fix-flaky
Browse files Browse the repository at this point in the history
Fix flaky tests - Closes #1455
  • Loading branch information
Efefefef committed Nov 7, 2018
2 parents 462079c + e6c08cc commit 6ff918c
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -117,7 +117,7 @@
"cpx": "=1.5.0",
"css-hot-loader": "=1.3.1",
"css-loader": "0.28.7",
"cypress": "3.1.0",
"cypress": "3.1.1",
"del-cli": "1.1.0",
"electron": "1.8.8",
"electron-builder": "19.32.2",
Expand Down
4 changes: 2 additions & 2 deletions src/utils/regex.js
@@ -1,5 +1,5 @@
export default {
address: /^\d{1,21}[L]$/,
transactionId: /^[0-9]+$/,
address: /^[1-9]\d{0,19}L$/,
transactionId: /^[1-9]\d{0,19}$/,
amount: /^\d+(\.\d{1,8})?$/,
};
2 changes: 1 addition & 1 deletion test/cypress/e2e/activity.spec.js
Expand Up @@ -22,7 +22,7 @@ const ss = {
/**
* To remove the effect of activating the All tab back after full load
*/
const waitBeforeChangeTabAfterLoading = () => cy.wait(1500); // TODO Update when #1400 is done
const waitBeforeChangeTabAfterLoading = () => cy.wait(2000); // TODO Update when #1400 is done

describe('Dashboard Activity', () => {
describe('Latest activity', () => {
Expand Down
File renamed without changes.
3 changes: 1 addition & 2 deletions test/cypress/e2e/delegates.spec.js
Expand Up @@ -39,8 +39,7 @@ describe('Delegates', () => {
cy.addLocalStorage('settings', 'advancedMode', true);
cy.autologin(accounts.genesis.passphrase, networks.devnet.node);
cy.visit(urls.dashboard);
cy.wait(200); // Wait for wallet sidebar button to appear
cy.get(ss.sidebarMenuDelegatesBtn).click();
cy.get(ss.sidebarMenuDelegatesBtn).should('have.css', 'opacity', '1').click();
cy.url().should('contain', urls.delegates);
cy.get(ss.confirmVotesSidebar).find(ss.nextButton);
});
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/help.spec.js
Expand Up @@ -25,7 +25,7 @@ describe('Help', () => {
it('opens by sidebar button', () => {
cy.autologin(accounts.genesis.passphrase, networks.devnet.node);
cy.visit('/');
cy.get(ss.sidebarMenuHelpBtn).click();
cy.get(ss.sidebarMenuHelpBtn).should('have.css', 'opacity', '1').click();
cy.url().should('contain', 'help');
checkHelpPageLoaded();
});
Expand Down
2 changes: 1 addition & 1 deletion test/cypress/e2e/settings.spec.js
Expand Up @@ -26,7 +26,7 @@ describe('Settings', () => {

it('opens by sidebar button', () => {
cy.visit('/');
cy.get(ss.sidebarMenuSettingsBtn).click();
cy.get(ss.sidebarMenuSettingsBtn).should('have.css', 'opacity', '1').click();
cy.url().should('contain', 'setting');
checkSettingsPageLoaded();
});
Expand Down
3 changes: 1 addition & 2 deletions test/cypress/e2e/transfer.spec.js
Expand Up @@ -64,8 +64,7 @@ describe('Transfer', () => {
it('Wallet page opens by sidebar button', () => {
cy.autologin(accounts.genesis.passphrase, networks.devnet.node);
cy.visit(urls.dashboard);
cy.wait(100);
cy.get(ss.sidebarMenuWalletBtn).click();
cy.get(ss.sidebarMenuWalletBtn).should('have.css', 'opacity', '1').click();
cy.url().should('contain', 'wallet');
checkWalletPageLoaded();
});
Expand Down
9 changes: 5 additions & 4 deletions test/cypress/e2e/txDetails.spec.js
@@ -1,6 +1,7 @@
import accounts from '../../constants/accounts';
import networks from '../../constants/networks';
import urls from '../../constants/urls';
import regex from '../../../src/utils/regex';

const ss = {
nextBtn: '.send-next-button',
Expand Down Expand Up @@ -44,7 +45,7 @@ describe('Tx details', () => {
cy.get(ss.txAmount).should('have.text', '-5');
cy.get(ss.txFee).should('have.text', '0.1');
cy.get(ss.txConfirmations).should('have.text', '');
cy.get(ss.txId).contains(/^\d{19}/);
cy.get(ss.txId).contains(regex.transactionId);
cy.get(ss.txReference).should('have.text', 'test-details');
// After confirmation
cy.get(ss.txDate, { timeout: txConfirmationTimeout }).contains(new Date().getFullYear());
Expand All @@ -62,7 +63,7 @@ describe('Tx details', () => {
cy.get(ss.txRemovedVotes).should('not.exist');
cy.get(ss.txFee).should('have.text', '1');
cy.get(ss.txConfirmations).contains(/^\d/);
cy.get(ss.txId).contains(/^\d{19}/);
cy.get(ss.txId).contains(regex.transactionId);
cy.get(ss.txReference).should('have.text', '-');
});

Expand All @@ -80,7 +81,7 @@ describe('Tx details', () => {
cy.get(ss.txRemovedVotes).should('not.exist');
// cy.get(ss.txFee).should('have.text', '25');
cy.get(ss.txConfirmations).contains(/^\d/);
cy.get(ss.txId).contains(/^\d{19}/);
cy.get(ss.txId).contains(regex.transactionId);
cy.get(ss.txReference).should('have.text', '-');
});

Expand All @@ -95,7 +96,7 @@ describe('Tx details', () => {
cy.get(ss.txRemovedVotes).should('not.exist');
cy.get(ss.txFee).should('have.text', '5');
cy.get(ss.txConfirmations).contains(/^\d/);
cy.get(ss.txId).contains(/^\d{19}/);
cy.get(ss.txId).contains(regex.transactionId);
cy.get(ss.txReference).should('have.text', '-');
});
});

0 comments on commit 6ff918c

Please sign in to comment.