Skip to content

Commit

Permalink
Merge pull request #24 from Synthetixio/dev
Browse files Browse the repository at this point in the history
promote dev to master
  • Loading branch information
drptbl authored Dec 11, 2020
2 parents d299198 + 3a3aa89 commit c6fcf3d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
16 changes: 8 additions & 8 deletions commands/metamask.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ module.exports = {
}
},
confirmWelcomePage: async () => {
await this.fixBlankPage();
await module.exports.fixBlankPage();
await puppeteer.waitAndClick(welcomePageElements.confirmButton);
return true;
},
unlock: async password => {
await this.fixBlankPage();
await module.exports.fixBlankPage();
await puppeteer.waitAndType(unlockPageElements.passwordInput, password);
await puppeteer.waitAndClick(unlockPageElements.unlockButton);
return true;
Expand Down Expand Up @@ -175,15 +175,15 @@ module.exports = {
if (
(await puppeteer.metamaskWindow.$(unlockPageElements.unlockPage)) === null
) {
await this.confirmWelcomePage();
await this.importWallet(secretWords, password);
await this.changeNetwork(network);
walletAddress = await this.getWalletAddress();
await module.exports.confirmWelcomePage();
await module.exports.importWallet(secretWords, password);
await module.exports.changeNetwork(network);
walletAddress = await module.exports.getWalletAddress();
await puppeteer.switchToCypressWindow();
return true;
} else {
await this.unlock(password);
walletAddress = await this.getWalletAddress();
await module.exports.unlock(password);
walletAddress = await module.exports.getWalletAddress();
await puppeteer.switchToCypressWindow();
return true;
}
Expand Down
10 changes: 5 additions & 5 deletions commands/puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,26 +70,26 @@ module.exports = {
await page.waitForTimeout(300);
},
waitAndClick: async (selector, page = metamaskWindow) => {
await this.waitFor(selector, page);
await module.exports.waitFor(selector, page);
await page.evaluate(
selector => document.querySelector(selector).click(),
selector,
);
},
waitAndType: async (selector, value, page = metamaskWindow) => {
await this.waitFor(selector, page);
await module.exports.waitFor(selector, page);
const element = await page.$(selector);
await element.type(value);
},
waitAndGetValue: async (selector, page = metamaskWindow) => {
await this.waitFor(selector, page);
await module.exports.waitFor(selector, page);
const element = await page.$(selector);
const property = await element.getProperty('value');
const value = await property.jsonValue();
return value;
},
waitAndSetValue: async (text, selector, page = metamaskWindow) => {
await this.waitFor(selector, page);
await module.exports.waitFor(selector, page);
await page.evaluate(
selector => (document.querySelector(selector).value = ''),
selector,
Expand All @@ -98,7 +98,7 @@ module.exports = {
await page.keyboard.type(text);
},
waitForText: async (selector, text, page = metamaskWindow) => {
await this.waitFor(selector, page);
await module.exports.waitFor(selector, page);
await page.waitForFunction(
`document.querySelector('${selector}').innerText.toLowerCase().includes('${text}')`,
);
Expand Down
6 changes: 3 additions & 3 deletions helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,15 @@ module.exports = {
);
},
prepareMetamask: async () => {
const release = await this.getMetamaskReleases();
const release = await module.exports.getMetamaskReleases();
const downloadsDirectory = path.resolve(__dirname, 'downloads');
if (!fs.existsSync(downloadsDirectory)) {
fs.mkdirSync(downloadsDirectory);
}
const downloadDestination = path.join(downloadsDirectory, release.filename);
await this.download(release.downloadUrl, downloadDestination);
await module.exports.download(release.downloadUrl, downloadDestination);
const metamaskDirectory = path.join(downloadsDirectory, 'metamask');
await this.extract(downloadDestination, metamaskDirectory);
await module.exports.extract(downloadDestination, metamaskDirectory);
return metamaskDirectory;
},
};

0 comments on commit c6fcf3d

Please sign in to comment.