Skip to content

Commit

Permalink
Merge branch 'dev' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
r3kt-eth authored Aug 6, 2023
2 parents 99a0361 + be10bc1 commit ef0ac58
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions commands/playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ const {
const sleep = require('util').promisify(setTimeout);
const _ = require('underscore');

let expectInstance;

let browser;
let mainWindow;
let metamaskWindow;
Expand All @@ -22,6 +24,9 @@ let retries = 0;
let extensionsData = {};

module.exports = {
getExpectInstance() {
return expectInstance;
},
browser() {
return browser;
},
Expand All @@ -40,6 +45,9 @@ module.exports = {
activeTabName() {
return activeTabName;
},
async setExpectInstance(expect) {
expectInstance = expect;
},
async init(playwrightInstance) {
const chromium = playwrightInstance
? playwrightInstance
Expand Down Expand Up @@ -235,8 +243,8 @@ module.exports = {
await module.exports.waitUntilStable(page);
},
async waitAndGetValue(selector, page = metamaskWindow) {
const expect = global.expect
? global.expect
const expect = expectInstance
? expectInstance
: require('@playwright/test').expect;
const element = await module.exports.waitFor(selector, page);
await expect(element).toHaveText(/[a-zA-Z0-9]/, {
Expand All @@ -247,17 +255,17 @@ module.exports = {
return value;
},
async waitAndGetInputValue(selector, page = metamaskWindow) {
const expect = global.expect
? global.expect
const expect = expectInstance
? expectInstance
: require('@playwright/test').expect;
const element = await module.exports.waitFor(selector, page);
await expect(element).toHaveValue(/[a-zA-Z1-9]/);
const value = await element.inputValue();
return value;
},
async waitAndGetAttributeValue(selector, attribute, page = metamaskWindow) {
const expect = global.expect
? global.expect
const expect = expectInstance
? expectInstance
: require('@playwright/test').expect;
const element = await module.exports.waitFor(selector, page);
await expect(element).toHaveAttribute(attribute, /[a-zA-Z0-9]/);
Expand Down

0 comments on commit ef0ac58

Please sign in to comment.