diff --git a/.github/workflows/authservice.yml b/.github/workflows/authservice.yml index 0409adb8..68d83ede 100644 --- a/.github/workflows/authservice.yml +++ b/.github/workflows/authservice.yml @@ -66,9 +66,6 @@ jobs: TWITTER_EMAIL: ${{ secrets.TWITTER_EMAIL }} CI: true CI_MODE: ${{ secrets.CI_MODE }} - MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} - MAILOSAUR_SERVER_ID: ${{ secrets.MAILOSAUR_SERVER_ID }} - MAILOSAUR_SERVER_DOMAIN: ${{ secrets.MAILOSAUR_SERVER_DOMAIN }} PLATFORM: ${{ matrix.env.PLATFORM }} APP_VERSION: "v3" GITHUB_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} diff --git a/.github/workflows/demowalletservice.yml b/.github/workflows/demowalletservice.yml index 1b71949b..0d519cc4 100644 --- a/.github/workflows/demowalletservice.yml +++ b/.github/workflows/demowalletservice.yml @@ -52,9 +52,6 @@ jobs: TWITTER_EMAIL: ${{ secrets.TWITTER_EMAIL }} CI: true CI_MODE: ${{ secrets.CI_MODE }} - MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} - MAILOSAUR_SERVER_ID: ${{ secrets.MAILOSAUR_SERVER_ID }} - MAILOSAUR_SERVER_DOMAIN: ${{ secrets.MAILOSAUR_SERVER_DOMAIN }} PLATFORM: ${{ matrix.env.PLATFORM }} APP_VERSION: "v3" GITHUB_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} diff --git a/.github/workflows/walletservice.yml b/.github/workflows/walletservice.yml index d66a6532..4d94ea24 100644 --- a/.github/workflows/walletservice.yml +++ b/.github/workflows/walletservice.yml @@ -52,9 +52,6 @@ jobs: TWITTER_EMAIL: ${{ secrets.TWITTER_EMAIL }} CI: true CI_MODE: ${{ secrets.CI_MODE }} - MAILOSAUR_API_KEY: ${{ secrets.MAILOSAUR_API_KEY }} - MAILOSAUR_SERVER_ID: ${{ secrets.MAILOSAUR_SERVER_ID }} - MAILOSAUR_SERVER_DOMAIN: ${{ secrets.MAILOSAUR_SERVER_DOMAIN }} PLATFORM: ${{ matrix.env.PLATFORM }} APP_VERSION: "v3" GITHUB_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 9e4d45ac..793eb339 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -18,7 +18,6 @@ "gmail", "isrefinement", "jakejarvis", - "Mailosaur", "mkdir", "networkidle", "noreport", diff --git a/authservice/login-with-passwordless/index.test.ts b/authservice/login-with-passwordless/index.test.ts index 5f43a154..6dfa5228 100644 --- a/authservice/login-with-passwordless/index.test.ts +++ b/authservice/login-with-passwordless/index.test.ts @@ -1,4 +1,3 @@ -import { Client } from "@opensearch-project/opensearch"; import { expect, test } from "@playwright/test"; import { AccountsPage } from "../openlogin-account-page/AccountsPage"; @@ -16,16 +15,7 @@ import { } from "../utils"; const demoAppUrl = env_map.demo; const demoAppUrlV4 = env_map.demoV6; -const eventPostURL = - process.env.ES_ENDPOINT === undefined - ? "search-sapphire-latency-stats-7n6qd4g6m3au5fpre3gwvwo6vm.eu-west-1.es.amazonaws.com" - : process.env.ES_ENDPOINT; -const region = process.env.REGION === undefined ? "singapore" : process.env.REGION; -const username = "devops"; const platform = process.env.PLATFORM || ""; -const password = process.env.PASSWORD; -const version = process.env.APP_VERSION; -const ci_mode = process.env.CI_MODE; const openloginURL = env_map[process.env.PLATFORM || "prod"]; const user = { mobileNumberForLogin: process.env.LOGIN_MOBILE_NUMBER || "", diff --git a/authservice/openlogin-account-page/AccountsPage.ts b/authservice/openlogin-account-page/AccountsPage.ts index f9aee99b..5f69e0ee 100644 --- a/authservice/openlogin-account-page/AccountsPage.ts +++ b/authservice/openlogin-account-page/AccountsPage.ts @@ -33,27 +33,6 @@ export class AccountsPage { let seedArray: string[]; let seedEmail; let seedString = ""; - if (process.env.MAIL_APP === "mailosaur") { - const seedEmail = await mailosaur.messages.get( - process.env.MAILOSAUR_SERVER_ID || "", - { - sentTo: backupEmail, - }, - { timeout: 30 * 1000 } - ); - seedArray = - seedEmail.html?.body - ?.toString() - .replace(/(\r\n|\n|\r)/gm, "") - .slice(11084) - .split("<")[0] - .split(" ") || []; - for (let i = 0; i < 23; i++) { - seedString += `${seedArray[i]} `; - } - seedString += seedArray[23]; - await mailosaur.messages.del(seedEmail?.id || ""); - } if (process.env.MAIL_APP === "testmail") { // Setup our JSON API endpoint const ENDPOINT = `https://api.testmail.app/api/json?apikey=${testEmailAppApiKey}&namespace=kelg8`; diff --git a/authservice/utils/index.ts b/authservice/utils/index.ts index 87d2315a..57656f2c 100644 --- a/authservice/utils/index.ts +++ b/authservice/utils/index.ts @@ -1,8 +1,5 @@ /* eslint-disable no-unmodified-loop-condition */ import { Browser, expect, Page } from "@playwright/test"; -import { generate } from "generate-password"; -import Mailosaur from "mailosaur"; -import { Link } from "mailosaur/lib/models"; import confirmEmail from "./confirmEmail"; process.env.APP_VERSION = "v4"; @@ -27,10 +24,6 @@ const env_map: { [key: string]: string } = { demoV4: "https://demo-openlogin-v4.web3auth.io/", demoV6: "https://demo-openlogin-v6.web3auth.io/", }; -const randomEmail = generate({ - length: 20, - lowercase: true, -}); function delay(time: number | undefined) { return new Promise(function (resolve) { @@ -38,14 +31,6 @@ function delay(time: number | undefined) { }); } -function findLink(links: Link[], text: string) { - for (const link of links) { - if (link.text === text) return link; - } - - return null; -} - export async function slowOperation(op: () => Promise, timeout?: number): Promise { if (timeout) { return new Promise((resolve, reject) => { @@ -257,38 +242,6 @@ async function signInWithGoogle({ } } -async function signInWithEmailIntoTorusWallet(page: Page, email: string, browser: Browser): Promise { - try { - await page.fill('[placeholder="Enter your email"]', email); - await delay(5000); - await page.click('div:has-text("Continue with Email")'); - //await page.waitForSelector("text=Verify your email"); - await delay(3000); - const mailosaur = new Mailosaur(process.env.MAILOSAUR_API_KEY || ""); - const mailBox = await mailosaur.messages.get(process.env.MAILOSAUR_SERVER_ID || "", { - sentTo: email, - }); - let link = findLink(mailBox.html?.links || [], "Approve login request"); - if (!link) { - link = findLink(mailBox.html?.links || [], "Verify my email"); - } - await mailosaur.messages.del(mailBox?.id || ""); - const href = link?.href || ""; - - const context2 = await browser.newContext(); - const page2 = await context2.newPage(); - await page2.goto(href); - await page2.waitForSelector("text=Close this and return to your previous window", { - timeout: 10000, - }); - await page2.close(); - return true; - } catch (err) { - console.error(err); - return false; - } -} - async function signInWithGitHub({ page, github, @@ -551,18 +504,6 @@ async function signInWithEmail(page: Page, email: string, browser: Browser): Pro await page.waitForSelector("text=Verify your email"); await delay(3000); let href; - if (process.env.MAIL_APP === "mailosaur") { - const mailosaur = new Mailosaur(process.env.MAILOSAUR_API_KEY || ""); - const mailBox = await mailosaur.messages.get(process.env.MAILOSAUR_SERVER_ID || "", { - sentTo: email, - }); - let link = findLink(mailBox.html?.links || [], "Approve login request"); - if (!link) { - link = findLink(mailBox.html?.links || [], "Verify my email"); - } - await mailosaur.messages.del(mailBox?.id || ""); - href = link?.href || ""; - } if (process.env.MAIL_APP === "testmail") { // Setup our JSON API endpoint const ENDPOINT = `https://api.testmail.app/api/json?apikey=${testEmailAppApiKey}&namespace=kelg8`; @@ -741,40 +682,6 @@ async function signInWithMobileNumber({ await page.locator("xpath=.//input[@aria-label='Please enter verification code. Digit 1']").fill(otp); } -async function signInWithDapps({ page, browser, testEmail }: { page: Page; browser: Browser; testEmail: string }) { - const context3 = await browser.newContext(); - await page.goto("https://demo-openlogin.web3auth.io/"); - await page.locator("select.select").last().selectOption("email_passwordless"); - await page.fill('[placeholder="Enter an email"]', testEmail); - await page.click('button:has-text("Login with email passwordless")'); - const newEmail = await mailosaur.messages.get( - process.env.MAILOSAUR_SERVER_ID || "", - { - sentTo: testEmail, - }, - { - timeout: 20 * 1000, - } - ); - expect(newEmail.subject).toContain("Verify your email"); - let link = findLink(newEmail.html?.links || [], "Approve login request"); - if (!link) { - link = findLink(newEmail.html?.links || [], "Verify my email"); - } - expect(link?.text).toContain("Approve login request"); - const href = link?.href || ""; - const page3 = await context3.newPage(); - await page3.goto(href); - await page3.waitForSelector("text=Close this and return to your previous window", { - timeout: 10000, - }); - await page3.close(); - await delay(3000); - await page.getByLabel("Set up 2FA").waitFor(); - await page.locator("xpath=.//button[text()='Skip for Now']").first().click(); - await delay(5000); -} - function generateEmailWithTag() { // Randomly generating the tag... const chance = new ChanceJS(); @@ -786,9 +693,6 @@ function generateEmailWithTag() { } function generateRandomEmail() { - if (process.env.MAIL_APP === "mailosaur") { - return `${randomEmail}${Date.now()}@${process.env.MAILOSAUR_SERVER_DOMAIN}`; - } if (process.env.MAIL_APP === "testmail") { return generateEmailWithTag(); } @@ -816,14 +720,12 @@ export { delay, deleteCurrentDeviceShare, env_map, - findLink, generateEmailWithTag, generateRandomEmail, getBackUpPhrase, - signInWithDapps, + // signInWithDapps, signInWithDiscord, signInWithEmail, - signInWithEmailIntoTorusWallet, signInWithEmailWithTestEmailApp, signInWithEmailWithTestEmailOnDemoApp, signInWithEmailWithTestEmailOnDemoAppV4, diff --git a/developerdashboard/utils/index.ts b/developerdashboard/utils/index.ts index 185448d0..d3eff5fd 100644 --- a/developerdashboard/utils/index.ts +++ b/developerdashboard/utils/index.ts @@ -1,8 +1,7 @@ +/* eslint-disable no-unmodified-loop-condition */ import { Browser, expect, Page, test } from "@playwright/test"; import axios from "axios"; import Chance from "chance"; -import { generate } from "generate-password"; -import { Link } from "mailosaur/lib/models"; import config from "../../index.config"; import confirmEmail from "./confirmEmail"; @@ -21,10 +20,30 @@ const env_map: { [key: string]: string } = { aqua: `https://aqua.openlogin.com/${openloginversion}`, local: "http://localhost:3000", }; -const randomEmail = generate({ - length: 20, - lowercase: true, -}); + +function generateEmailWithTag() { + // Randomly generating the tag... + const chance = new Chance(); + const tag = chance.string({ + length: 12, + pool: "abcdefghijklmnopqrstuvwxyz0123456789", + }); + return `kelg8.${tag}@inbox.testmail.app`; +} + +function delay(time: number | undefined) { + return new Promise(function (resolve) { + setTimeout(resolve, time); + }); +} + +export async function slowOperation(op: () => Promise, timeout?: number) { + // Set slow timeout + test.setTimeout(timeout || 2 * 60 * 1000); // => 2 mins timeout + await op(); + // Reset timeout + test.setTimeout(config.timeout || 0); +} function useAutoCancelShareTransfer(page: Page): () => Promise { let stopped = false; @@ -220,9 +239,9 @@ async function signInWithGoogle({ try { await page.waitForURL("https://accounts.google.com/**"); await page.waitForSelector('input[type="Email"]'); - expect(await page.isVisible('input[type="Email"]')); + expect(await page.isVisible('input[type="Email"]')).toBe(true); await page.fill('input[type="Email"]', google.email); - expect(await page.isVisible('button:has-text("Next")')); + expect(await page.isVisible('button:has-text("Next")')).toBe(true); await page.click(`button:has-text("Next")`); await page.fill('input[type="password"]', google.password); await page.click(`button:has-text("Next")`); @@ -255,7 +274,7 @@ async function signInWithGitHub({ await page.click('input[value="Sign in"]'); await page.waitForSelector("text=Create repository"); - expect(page.isVisible("text=Create repository")); + expect(page.isVisible("text=Create repository")).toBe(true); return true; } catch { return false; @@ -354,14 +373,6 @@ async function signInWithTwitterWithoutLogin({ await page.click("xpath=.//input[@value='Sign In']"); } -export async function slowOperation(op: () => Promise, timeout?: number) { - // Set slow timeout - test.setTimeout(timeout || 2 * 60 * 1000); // => 2 mins timeout - await op(); - // Reset timeout - test.setTimeout(config.timeout || 0); -} - async function signInWithFacebook({ page, FB, @@ -492,14 +503,6 @@ async function changePasswordShare(page: Page, password: string) { await y; } -function findLink(links: Link[], text: string) { - for (const link of links) { - if (link.text === text) return link; - } - - return null; -} - async function signInWithEmail(page: Page, email: string, browser: Browser): Promise { try { console.log(`Email:${email}`); @@ -508,7 +511,7 @@ async function signInWithEmail(page: Page, email: string, browser: Browser): Pro //await page.waitForSelector("text=Verify your email"); await delay(3000); let href; - if (process.env.MAIL_APP == "testmail") { + if (process.env.MAIL_APP === "testmail") { // Setup our JSON API endpoint const ENDPOINT = `https://api.testmail.app/api/json?apikey=${process.env.TESTMAIL_APP_APIKEY}&namespace=kelg8`; const res = await axios.get(`${ENDPOINT}&tag=${email.split("@")[0].split(".")[1]}&livequery=true`); @@ -556,64 +559,12 @@ async function signInWithMobileNumber({ await page.locator("xpath=.//input[@aria-label='Please enter verification code. Digit 1']").fill(otp); } -async function signInWithDapps({ page, browser, testEmail }: { page: Page; browser: Browser; testEmail: string }) { - const context3 = await browser.newContext(); - await page.goto("https://demo-openlogin.web3auth.io/"); - await page.locator("select.select").last().selectOption("email_passwordless"); - await page.fill('[placeholder="Enter an email"]', testEmail); - await page.click('button:has-text("Login with email passwordless")'); - const newEmail = await mailosaur.messages.get( - process.env.MAILOSAUR_SERVER_ID || "", - { - sentTo: testEmail, - }, - { - timeout: 20 * 1000, - } - ); - expect(newEmail.subject).toContain("Verify your email"); - let link = findLink(newEmail.html?.links || [], "Approve login request"); - if (!link) { - link = findLink(newEmail.html?.links || [], "Verify my email"); - } - expect(link?.text).toContain("Approve login request"); - const href = link?.href || ""; - const page3 = await context3.newPage(); - await page3.goto(href); - await page3.waitForSelector("text=Close this and return to your previous window", { - timeout: 10000, - }); - await page3.close(); - await page.getByLabel("Set up 2FA").waitFor(); - await page.locator("xpath=.//button").first().click(); - await delay(5000); -} - function generateRandomEmail() { - if (process.env.MAIL_APP == "mailosaur") { - return `${randomEmail}${Date.now()}@${process.env.MAILOSAUR_SERVER_DOMAIN}`; - } - if (process.env.MAIL_APP == "testmail") { + if (process.env.MAIL_APP === "testmail") { return generateEmailWithTag(); } } -function generateEmailWithTag() { - // Randomly generating the tag... - const chance = new Chance(); - const tag = chance.string({ - length: 12, - pool: "abcdefghijklmnopqrstuvwxyz0123456789", - }); - return `kelg8.${tag}@inbox.testmail.app`; -} - -function delay(time: number | undefined) { - return new Promise(function (resolve) { - setTimeout(resolve, time); - }); -} - export { addPasswordShare, authorizeWithGitHub, @@ -624,9 +575,8 @@ export { delay, deleteCurrentDeviceShare, env_map, - findLink, generateRandomEmail, - signInWithDapps, + // signInWithDapps, signInWithDiscord, signInWithEmail, signInWithFacebook, diff --git a/package-lock.json b/package-lock.json index 03f597e9..5d575af9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,13 +8,12 @@ "name": "@toruslabs/e2e-tests", "version": "0.0.0", "dependencies": { - "@opensearch-project/opensearch": "^2.11.0", + "@playwright/test": "^1.45.3", "axios": "^1.7.2", "bip39": "^3.1.0", "chance": "^1.1.12", "dotenv": "^16.4.5", "generate-password": "^1.7.1", - "mailosaur": "^8.6.1", "playwright": "^1.45.3", "reportportal-client": "https://github.com/wiibaker/client-javascript.git#master", "serve-handler": "^6.1.5", @@ -332,28 +331,6 @@ "node": ">= 8" } }, - "node_modules/@opensearch-project/opensearch": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/@opensearch-project/opensearch/-/opensearch-2.11.0.tgz", - "integrity": "sha512-G+SZwtWRDv90IrtTSNnCt0MQjHVyqrcIXcpwN68vjHnfbun2+RHn+ux4K7dnG+s/KwWzVKIpPFoRjg2gfFX0Mw==", - "dependencies": { - "aws4": "^1.11.0", - "debug": "^4.3.1", - "hpagent": "^1.2.0", - "json11": "^1.1.2", - "ms": "^2.1.3", - "secure-json-parse": "^2.4.0" - }, - "engines": { - "node": ">=10", - "yarn": "^1.22.10" - } - }, - "node_modules/@opensearch-project/opensearch/node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - }, "node_modules/@paulirish/trace_engine": { "version": "0.0.23", "resolved": "https://registry.npmjs.org/@paulirish/trace_engine/-/trace_engine-0.0.23.tgz", @@ -976,6 +953,7 @@ }, "node_modules/agent-base": { "version": "6.0.2", + "dev": true, "license": "MIT", "dependencies": { "debug": "4" @@ -3457,14 +3435,6 @@ "node": ">= 0.4" } }, - "node_modules/hpagent": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", - "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==", - "engines": { - "node": ">=14" - } - }, "node_modules/http-link-header": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/http-link-header/-/http-link-header-1.1.3.tgz", @@ -3515,6 +3485,7 @@ }, "node_modules/https-proxy-agent": { "version": "5.0.1", + "dev": true, "license": "MIT", "dependencies": { "agent-base": "6", @@ -4104,14 +4075,6 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" }, - "node_modules/json11": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/json11/-/json11-1.1.2.tgz", - "integrity": "sha512-5r1RHT1/Gr/jsI/XZZj/P6F11BKM8xvTaftRuiLkQI9Z2PFDukM82Ysxw8yDszb3NJP/NKnRlSGmhUdG99rlBw==", - "bin": { - "json11": "dist/cli.mjs" - } - }, "node_modules/json5": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", @@ -4553,17 +4516,6 @@ "node": ">=12" } }, - "node_modules/mailosaur": { - "version": "8.6.1", - "resolved": "https://registry.npmjs.org/mailosaur/-/mailosaur-8.6.1.tgz", - "integrity": "sha512-e41UXlwBDKFICK1jmovoKM3cJIfvW2wAUPwlok/zM0RL0tP+gpbFdFKWDaIZh85nMM/PFBsJQJT+CJ+o2Q/9cA==", - "dependencies": { - "https-proxy-agent": "^5.0.0" - }, - "engines": { - "node": ">= v6.0.0" - } - }, "node_modules/make-dir": { "version": "3.1.0", "dev": true, @@ -5677,11 +5629,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "node_modules/secure-json-parse": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz", - "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==" - }, "node_modules/semver": { "version": "5.7.1", "dev": true, @@ -7000,26 +6947,6 @@ "fastq": "^1.6.0" } }, - "@opensearch-project/opensearch": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/@opensearch-project/opensearch/-/opensearch-2.11.0.tgz", - "integrity": "sha512-G+SZwtWRDv90IrtTSNnCt0MQjHVyqrcIXcpwN68vjHnfbun2+RHn+ux4K7dnG+s/KwWzVKIpPFoRjg2gfFX0Mw==", - "requires": { - "aws4": "^1.11.0", - "debug": "^4.3.1", - "hpagent": "^1.2.0", - "json11": "^1.1.2", - "ms": "^2.1.3", - "secure-json-parse": "^2.4.0" - }, - "dependencies": { - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" - } - } - }, "@paulirish/trace_engine": { "version": "0.0.23", "resolved": "https://registry.npmjs.org/@paulirish/trace_engine/-/trace_engine-0.0.23.tgz", @@ -7442,6 +7369,7 @@ }, "agent-base": { "version": "6.0.2", + "dev": true, "requires": { "debug": "4" } @@ -9192,11 +9120,6 @@ "function-bind": "^1.1.2" } }, - "hpagent": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", - "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==" - }, "http-link-header": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/http-link-header/-/http-link-header-1.1.3.tgz", @@ -9236,6 +9159,7 @@ }, "https-proxy-agent": { "version": "5.0.1", + "dev": true, "requires": { "agent-base": "6", "debug": "4" @@ -9619,11 +9543,6 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA==" }, - "json11": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/json11/-/json11-1.1.2.tgz", - "integrity": "sha512-5r1RHT1/Gr/jsI/XZZj/P6F11BKM8xvTaftRuiLkQI9Z2PFDukM82Ysxw8yDszb3NJP/NKnRlSGmhUdG99rlBw==" - }, "json5": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", @@ -9946,14 +9865,6 @@ "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", "dev": true }, - "mailosaur": { - "version": "8.6.1", - "resolved": "https://registry.npmjs.org/mailosaur/-/mailosaur-8.6.1.tgz", - "integrity": "sha512-e41UXlwBDKFICK1jmovoKM3cJIfvW2wAUPwlok/zM0RL0tP+gpbFdFKWDaIZh85nMM/PFBsJQJT+CJ+o2Q/9cA==", - "requires": { - "https-proxy-agent": "^5.0.0" - } - }, "make-dir": { "version": "3.1.0", "dev": true, @@ -10723,11 +10634,6 @@ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" }, - "secure-json-parse": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz", - "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==" - }, "semver": { "version": "5.7.1", "dev": true diff --git a/package.json b/package.json index 16b8d75a..bc8ffb5b 100644 --- a/package.json +++ b/package.json @@ -16,14 +16,12 @@ "docker:run": "docker run -it test-image /bin/bash" }, "dependencies": { - "@opensearch-project/opensearch": "^2.11.0", "@playwright/test": "^1.45.3", "axios": "^1.7.2", "bip39": "^3.1.0", "chance": "^1.1.12", "dotenv": "^16.4.5", "generate-password": "^1.7.1", - "mailosaur": "^8.6.1", "playwright": "^1.45.3", "reportportal-client": "https://github.com/wiibaker/client-javascript.git#master", "serve-handler": "^6.1.5", diff --git a/walletservices/utils/index.ts b/walletservices/utils/index.ts index 75869401..509a8e1c 100644 --- a/walletservices/utils/index.ts +++ b/walletservices/utils/index.ts @@ -2,8 +2,6 @@ import { Browser, expect, Page, test } from "@playwright/test"; import axios from "axios"; import Chance from "chance"; -import { generate } from "generate-password"; -import { Link } from "mailosaur/lib/models"; import config from "../../index.config"; import confirmEmail from "./confirmEmail"; @@ -22,10 +20,6 @@ const env_map: { [key: string]: string } = { aqua: `https://aqua.openlogin.com/${openloginversion}`, local: "http://localhost:3000", }; -const randomEmail = generate({ - length: 20, - lowercase: true, -}); function delay(time: number | undefined) { return new Promise(function (resolve) { @@ -499,14 +493,6 @@ async function changePasswordShare(page: Page, password: string) { await y; } -function findLink(links: Link[], text: string) { - for (const link of links) { - if (link.text === text) return link; - } - - return null; -} - async function signInWithEmailWithTestEmailApp(page: Page, email: string, browser: Browser, tag: string, timestamp: number): Promise { try { console.log(`Email:${email}`); @@ -589,39 +575,6 @@ async function signInWithMobileNumber({ await page.locator("xpath=.//input[@aria-label='Please enter verification code. Digit 1']").fill(otp); } -async function signInWithDapps({ page, browser, testEmail }: { page: Page; browser: Browser; testEmail: string }) { - const context3 = await browser.newContext(); - await page.goto("https://demo-openlogin.web3auth.io/"); - await page.locator("select.select").last().selectOption("email_passwordless"); - await page.fill('[placeholder="Enter an email"]', testEmail); - await page.click('button:has-text("Login with email passwordless")'); - const newEmail = await mailosaur.messages.get( - process.env.MAILOSAUR_SERVER_ID || "", - { - sentTo: testEmail, - }, - { - timeout: 20 * 1000, - } - ); - expect(newEmail.subject).toContain("Verify your email"); - let link = findLink(newEmail.html?.links || [], "Approve login request"); - if (!link) { - link = findLink(newEmail.html?.links || [], "Verify my email"); - } - expect(link?.text).toContain("Approve login request"); - const href = link?.href || ""; - const page3 = await context3.newPage(); - await page3.goto(href); - await page3.waitForSelector("text=Close this and return to your previous window", { - timeout: 10000, - }); - await page3.close(); - await page.getByLabel("Set up 2FA").waitFor(); - await page.locator("xpath=.//button").first().click(); - await delay(5000); -} - function generateEmailWithTag() { // Randomly generating the tag... const chance = new Chance(); @@ -633,9 +586,6 @@ function generateEmailWithTag() { } function generateRandomEmail() { - if (process.env.MAIL_APP === "mailosaur") { - return `${randomEmail}${Date.now()}@${process.env.MAILOSAUR_SERVER_DOMAIN}`; - } if (process.env.MAIL_APP === "testmail") { return generateEmailWithTag(); } @@ -651,9 +601,8 @@ export { delay, deleteCurrentDeviceShare, env_map, - findLink, generateRandomEmail, - signInWithDapps, + // signInWithDapps, signInWithDiscord, signInWithEmailWithTestEmailApp, signInWithEmailWithTestEmailAppInDemoApp,