Test/fix failing regex with comma (#329)

* Update regex to include commas

* Add force true to clicking on transaction
This commit is contained in:
Joe Tsang 2022-04-29 11:55:55 +01:00 committed by GitHub
parent 2b910aa04c
commit 48f66a9ce8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -49,7 +49,7 @@ export default class HomePage extends BasePage {
cy.wrap($value).should('not.be.empty'); cy.wrap($value).should('not.be.empty');
if (index == 6) { if (index == 6) {
// Total staked value // Total staked value
const totalStakedRegex = /^[0-9]+(\.[0-9]{0,2})?$/; const totalStakedRegex = /^\d{1,3}(,\d{3})*(\.\d{1,2})?$/;
cy.wrap($value).invoke('text').should('match', totalStakedRegex); // Check that value is number with 2dp cy.wrap($value).invoke('text').should('match', totalStakedRegex); // Check that value is number with 2dp
} }
}) })

View File

@ -73,7 +73,11 @@ export default class TransactionsPage extends BasePage {
cy.wait(1000); // Wait for transactions to load if there are any cy.wait(1000); // Wait for transactions to load if there are any
cy.get('body').then(($body) => { cy.get('body').then(($body) => {
if ($body.find(`[data-testid=${this.transactionRow}]`).length) { if ($body.find(`[data-testid=${this.transactionRow}]`).length) {
cy.getByTestId(this.transactionRow).first().find('a').first().click(); cy.getByTestId(this.transactionRow)
.first()
.find('a')
.first()
.click({ force: true });
} else { } else {
cy.slack('Unable to find any transactions on page'); cy.slack('Unable to find any transactions on page');
cy.screenshot(); cy.screenshot();