Skip to content

Commit

Permalink
Allow only @wppconnect/wa-js dependency to be updated until we have f…
Browse files Browse the repository at this point in the history
…ull test coverage and the grouping feature from dependabot github/roadmap#148
  • Loading branch information
marcosvrs committed Jun 28, 2023
1 parent 4a90996 commit a93298b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ updates:
directory: "/"
schedule:
interval: "daily"
allow:
- dependency-name: "@wppconnect/wa-js"
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wtf",
"version": "3.2.12",
"description": "WhatsApp Toolbox Features Chrome Extension that allows you to send WhatsApp messages in bulk ",
"description": "WhatsApp Toolbox Features Chrome Extension that allows you to send WhatsApp messages in bulk",
"main": "index.js",
"scripts": {
"watch": "webpack --config webpack/webpack.dev.js --watch --progress",
Expand Down
10 changes: 5 additions & 5 deletions tests/fixtures.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { test as base, chromium } from '@playwright/test';
import os from 'os';
import path from 'path';
import { tmpdir } from 'os';
import { join } from 'path';

export const test = base.extend({
context: async ({ browserName }, use) => {
const pathToExtension = path.join(__dirname, '../dist');
let userDataDir = path.join(os.tmpdir(), `wa-js-test-${browserName}`);
const pathToExtension = join(__dirname, '../dist');
let userDataDir = join(tmpdir(), `wa-js-test-${browserName}`);
if (process.env.WORKSPACE) {
userDataDir = path.join(process.env.WORKSPACE, `wa-js-test-${browserName}`);
userDataDir = join(process.env.WORKSPACE, `wa-js-test-${browserName}`);
}
const browserArgs = [
`--disable-extensions-except=${pathToExtension}`,
Expand Down
23 changes: 12 additions & 11 deletions tests/wa-js.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { test, expect } from './fixtures';
import type { Page } from '@playwright/test';
import type { Message } from '../src/types/Message';
import { promises as fs } from 'fs';
import path from 'path';
import qrcode from 'qrcode-terminal';
import type { Message } from '../src/types/Message';
import { expect, test } from './fixtures';

const sendMessage = async (page: Page, payload: Message) => {
await page.evaluate(([payload]) => {
Expand Down Expand Up @@ -71,19 +71,20 @@ const convertFileToAttachment = async (filePath: string): Promise<Message['attac
test.describe.serial("Send Messages via WPP", () => {
test('expect', async ({ page }, testInfo) => {
await page.goto('https://web.whatsapp.com/', { waitUntil: 'networkidle' });
let timeout = testInfo.timeout;
const defaultTimeout = testInfo.timeout;
test.setTimeout(300000); // 5min

const qrCodeContainer = page.getByTestId('qrcode');
try {
await qrCodeContainer.waitFor({ timeout: 5000 });
timeout = 300000; // 5min
qrCodeContainer.screenshot({ path: 'qrcode.png' });
qrCodeContainer.waitFor().then(async () => {
qrcode.generate(await qrCodeContainer.getAttribute('data-ref'), { small: true });
} catch (e) {
console.log('QR Code Error: ', e.name || e.message || e || 'Unknown error');
}
testInfo.setTimeout(timeout);
}).catch((e) => {
console.log('QR Code Error: ', e.message || e.name || e || 'Unknown error');
});

await page.getByTestId('intro-title').waitFor();

test.setTimeout(defaultTimeout); // back to default

await test.step('message to be sent', async () => {
await sendMessage(page, {
contact: process.env.TEST_CONTACT?.replace(/\D/g, '') || '',
Expand Down

0 comments on commit a93298b

Please sign in to comment.