Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Faulty Cypress Test #835

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 41 additions & 56 deletions web-frontend/cypress/e2e/acceptance/home/send.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,74 +148,59 @@ describe('E2E | Acceptance | Home | Send', () => {
cy.url().should('eq', `${baseUrl}/${account.nickname}/home`);
});

it('should process any % as input', async () => {
it('should process any % as input', () => {
server.trackRequest = true;
const account = mockedAccounts.at(2);

cy.visit('/');

cy.get('[data-testid="account-2"]')
.click()
.then(() => {
cy.url().should('eq', `${baseUrl}/${account.nickname}/home`);
cy.waitForRequest(server, '/accounts/MarioX', 'GET').then(() => {
cy.get('[data-testid="send-button"]')
.click()
.then(() => {
cy.waitForRequest(server, '/accounts/MarioX', 'GET');
cy.url().should(
'eq',
`${baseUrl}/${account.nickname}/transfer-coins`,
);
cy.get(`[data-testid="send-percent-25"]`).click();
cy.get('[data-testid="money-field"').should(
'have.value',
'250 MAS',
);

cy.get(`[data-testid="send-percent-50"]`).click();
cy.get('[data-testid="money-field"').should(
'have.value',
'500 MAS',
);

cy.get(`[data-testid="send-percent-75"]`).click();
cy.get('[data-testid="money-field"').should(
'have.value',
'750 MAS',
);

cy.get(`[data-testid="send-percent-100"]`).click();
cy.get('[data-testid="money-field"').should(
'have.value',
'999.999999 MAS',
);
});
});
});
cy.get('[data-testid="account-2"]').click();

cy.url().should('eq', `${baseUrl}/${account.nickname}/home`);

cy.waitForRequest(server, '/accounts/MarioX', 'GET').then(() => {
cy.get('[data-testid="send-button"]').click();
cy.url().should('eq', `${baseUrl}/${account.nickname}/transfer-coins`);

// cy.waitForRequest(server, '/accounts/MarioX', 'GET');

cy.get(`[data-testid="send-percent-25"]`).click();
cy.get('[data-testid="money-field"').should('have.value', '250 MAS');

cy.get(`[data-testid="send-percent-50"]`).click();
cy.get('[data-testid="money-field"').should('have.value', '500 MAS');

cy.get(`[data-testid="send-percent-75"]`).click();
cy.get('[data-testid="money-field"').should('have.value', '750 MAS');

cy.get(`[data-testid="send-percent-100"]`).click();
cy.get('[data-testid="money-field"').should(
'have.value',
'999.999999 MAS',
);
});
server.trackRequest = false;
});

// TODO: commented out because failing, needs to be fixed
// it('should transfer to accounts', () => {
// const selectedAccount = mockedAccounts.at(1);
it('should transfer to accounts', () => {
const selectedAccount = mockedAccounts.at(1);

// navigateToTransferCoinsOfAccountIndex(0);
navigateToTransferCoinsOfAccountIndex(0);

// cy.get('[data-testid="transfer-between-accounts"]')
// .should('exist')
// .click()
// .then(() => {
// cy.get('[data-testid="popup-modal-content"]').should('be.visible');
cy.get('[data-testid="transfer-between-accounts"]')
.should('exist')
.click()
.then(() => {
cy.get('[data-testid="popup-modal-content"]').should('be.visible');

// cy.get('[data-testid="selector-account-0"]').should('exist').click();
cy.get('[data-testid="selector-account-0"]').should('exist').click();

// cy.get('[data-testid="input-field"]').should(
// 'have.value',
// selectedAccount.address,
// );
// });
// });
cy.get('[data-testid="input-field"]').should(
'have.value',
selectedAccount.address,
);
});
});

it('should refuse wrong currency input', () => {
const account = mockedAccounts.at(2);
Expand Down