Skip to content

Commit

Permalink
added new function and edited tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bowensanders committed Jul 21, 2023
1 parent 4e6e37c commit 1d2b784
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 1 addition & 5 deletions test/e2e/snaps/test-snap-bip-44.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,7 @@ describe('Test Snap bip-44', function () {
});
await driver.waitForSelector({ text: 'Install' });

try {
await driver.clickElement('[data-testid="snap-install-scroll"]');
} catch (_) {
console.log('Missing scroll');
}
await driver.clickElementSafe('[data-testid="snap-install-scroll"]');

await driver.clickElement({
text: 'Install',
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/snaps/test-snap-getentropy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,7 @@ describe('Test Snap getEntropy', function () {

await driver.waitForSelector({ text: 'Install' });

try {
await driver.clickElement('[data-testid="snap-install-scroll"]');
} catch (_) {
console.log('Missing scroll');
}
await driver.clickElementSafe('[data-testid="snap-install-scroll"]');

await driver.clickElement({
text: 'Install',
Expand Down
6 changes: 1 addition & 5 deletions test/e2e/snaps/test-snap-manageAccount.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,7 @@ describe('Test Snap Account', function () {
tag: 'button',
});

try {
await driver.clickElement('[data-testid="snap-install-scroll"]');
} catch (_) {
console.log('Missing scroll');
}
await driver.clickElementSafe('[data-testid="snap-install-scroll"]');

await driver.waitForSelector({ text: 'Install' });

Expand Down
12 changes: 12 additions & 0 deletions test/e2e/webdriver/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,18 @@ class Driver {
await element.click();
}

async clickElementSafe(rawLocator) {
// for instances where an element such as a scroll button does not
// show up because of render differences, proceed to the next step
// without causing a test failure, but provide a console log of why.
try {
const element = await this.findClickableElement(rawLocator);
await element.click();
} catch (e) {
console.log(`Element ${rawLocator} not found (${e})`);
}
}

async clickPoint(rawLocator, x, y) {
const element = await this.findElement(rawLocator);
await this.driver
Expand Down

0 comments on commit 1d2b784

Please sign in to comment.