Skip to content

Commit

Permalink
fix: fix reporter config
Browse files Browse the repository at this point in the history
  • Loading branch information
jake4take committed Dec 5, 2024
1 parent 2bfb564 commit a2a4508
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 55 deletions.
1 change: 1 addition & 0 deletions playwright-tests/config/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export * from './config';
export * from './env.config';
export * from './reporter.config';
39 changes: 39 additions & 0 deletions playwright-tests/config/reporter.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import { REEF_KNOT_CONFIG } from '@config';
import { ReporterDescription } from '@playwright/test';

const htmlReporter: ReporterDescription = ['html', { open: 'never' }];
const consoleReporter: ReporterDescription = ['list', { printSteps: true }];
const githubReporter: ReporterDescription = ['github'];
const qaseReporter: ReporterDescription = [
'playwright-qase-reporter',
{
debug: false,
environment: REEF_KNOT_CONFIG.STAND_ENV,
mode: 'testops', // value 'testops' enables Qase reporter, 'off' disables
testops: {
api: {
token: process.env.QASE_API_TOKEN,
},
project: 'REEFKNOT',
uploadAttachments: true,
run: {
complete: true,
title: 'Auto Run [s:@All]',
description:
`Stand url: ${REEF_KNOT_CONFIG.STAND_URL}\n` +
`Env: ${REEF_KNOT_CONFIG.STAND_ENV}`,
},
batch: {
size: 10,
},
},
},
];

export const REPORT_CONFIG: () => ReporterDescription[] = function () {
const reporterConfig: ReporterDescription[] = [htmlReporter, consoleReporter];
if (process.env.CI) {
reporterConfig.push(githubReporter, qaseReporter);
}
return reporterConfig;
};
43 changes: 3 additions & 40 deletions playwright-tests/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
import { PlaywrightTestConfig } from 'playwright/test';
import { REEF_KNOT_CONFIG } from '@config';

// Setting of Qase Reporter
process.env.QASE_MODE = process.env.CI ? 'testops' : 'off'; // value 'testops' enables Qase reporter

// Setting TestRun naming and QASE_ENVIRONMENT for reporter with CI test run
if (process.env.QASE_MODE === 'testops') {
process.env.QASE_TESTOPS_RUN_TITLE = 'Auto Run [s:@All]';
process.env.QASE_ENVIRONMENT = REEF_KNOT_CONFIG.STAND_TYPE;
}
import { REEF_KNOT_CONFIG, REPORT_CONFIG } from '@config';

const config: PlaywrightTestConfig = {
testDir: './tests',
Expand All @@ -18,37 +9,9 @@ const config: PlaywrightTestConfig = {
},
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: 0,
retries: 1,
workers: 1,
reporter: process.env.CI
? [
['html', { open: 'never' }],
['list'],
['github'],
[
'playwright-qase-reporter',
{
debug: false,
testops: {
api: {
token: process.env.QASE_API_TOKEN,
},
project: 'REEFKNOT',
uploadAttachments: true,
run: {
complete: true,
description:
`Stand url: ${REEF_KNOT_CONFIG.STAND_URL}\n` +
`Env: ${REEF_KNOT_CONFIG.STAND_TYPE}`,
},
batch: {
size: 10,
},
},
},
],
]
: [['html', { open: 'never' }], ['list']],
reporter: REPORT_CONFIG(),
use: {
actionTimeout: 15000,
screenshot: { fullPage: true, mode: 'only-on-failure' },
Expand Down
9 changes: 6 additions & 3 deletions playwright-tests/tests/matomo-event-connected-wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const wallets = [
wallets.forEach((wallet) => {
test.describe(
`ReefKnot. Matomo events (${wallet.name})`,
{ tag: [Tags.connectedWallet] },
{ tag: [Tags.connectedWallet, wallet.name] },
async () => {
let browserService: BrowserService;
let reefKnotService: ReefKnotService;
Expand All @@ -35,7 +35,7 @@ wallets.forEach((wallet) => {
});

test(qase(432, `Connect ${wallet.name} wallet`), async () => {
qase.groupParameters({
await qase.groupParameters({
wallet: wallet.name,
eventName: wallet.expectedEvent,
});
Expand Down Expand Up @@ -81,7 +81,10 @@ test.describe(

test(qase(433, 'Connect wallet with Browser button'), async () => {
const expectedNameParam = 'browserExtension connected';
qase.groupParameters({ wallet: 'browser', eventName: expectedNameParam });
await qase.groupParameters({
wallet: 'browser',
eventName: expectedNameParam,
});

await test.step('Connect wallet and check console.log', async () => {
const [connectWalletPage] =
Expand Down
7 changes: 6 additions & 1 deletion playwright-tests/tests/matomo-event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ test.describe('ReefKnot. Matomo events', async () => {

CONFIG_MATOMO_CLICK_TO_WALLET_EVENTS.forEach((event) => {
test(qase(430, `Click to "${event.walletName}" wallet`), async () => {
qase.groupParameters({
await qase.groupParameters({
wallet: event.walletName,
event: event.eventMessage,
});
Expand Down Expand Up @@ -59,6 +59,11 @@ test.describe('ReefKnot. Matomo events', async () => {
const expectedMoreWalletsNameParam = 'more wallets clicked';
const expectedLessWalletsNameParam = 'less wallets clicked';

await qase.groupParameters({
eventMoreWallet: expectedMoreWalletsNameParam,
eventLessWallet: expectedLessWalletsNameParam,
});

await test.step('Open the wallet popup', async () => {
await reefKnotPage.header.connectWalletButton.click();
await reefKnotPage.walletListModal.confirmConditionWalletModal();
Expand Down
12 changes: 7 additions & 5 deletions playwright-tests/tests/wallet-connection.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const wallets = [{ name: 'metamask' }, { name: 'okx' }];
wallets.forEach((wallet) => {
test.describe.serial(
`ReefKnot. Wallet connection (${wallet.name})`,
{ tag: [Tags.connectedWallet] },
{ tag: [Tags.connectedWallet, wallet.name] },
async () => {
let browserService: BrowserService;
let reefKnotService: ReefKnotService;
Expand All @@ -31,7 +31,8 @@ wallets.forEach((wallet) => {
});

test(qase(434, 'Connect wallet'), async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

await test.step('Check the stand appearance before wallet connection', async () => {
await expect(
reefKnotPage.statsBlock.mainComponent,
Expand Down Expand Up @@ -78,7 +79,7 @@ wallets.forEach((wallet) => {
test(
qase(440, 'Reload page and check that the wallet connection remains'),
async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

await reefKnotPage.page.reload();
await expect(
Expand All @@ -93,7 +94,7 @@ wallets.forEach((wallet) => {
);

test(qase(441, 'Disconnect wallet'), async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

await reefKnotPage.disconnectWallet();
await test.step('Check the stand appearance after wallet disconnection', async () => {
Expand Down Expand Up @@ -134,7 +135,8 @@ wallets.forEach((wallet) => {
'Reload page and check that the wallet disconnection remains',
),
async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

await reefKnotPage.page.reload();
await expect(
reefKnotPage.header.accountButton,
Expand Down
12 changes: 6 additions & 6 deletions playwright-tests/tests/wallet-stats.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const wallets = [{ name: 'metamask' }, { name: 'okx' }];
wallets.forEach((wallet) => {
test.describe(
`ReefKnot. Check statistic (${wallet.name})`,
{ tag: [Tags.connectedWallet] },
{ tag: [Tags.connectedWallet, wallet.name] },
async () => {
let browserService: BrowserService;
let reefKnotService: ReefKnotService;
Expand All @@ -34,7 +34,7 @@ wallets.forEach((wallet) => {
});

test(qase(435, 'Check provider name'), async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

await expect(
reefKnotPage.statsBlock.providerValue,
Expand All @@ -45,7 +45,7 @@ wallets.forEach((wallet) => {
});

test(qase(436, 'Check chainId'), async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

await expect(
reefKnotPage.statsBlock.chainIdValue,
Expand All @@ -54,7 +54,7 @@ wallets.forEach((wallet) => {
});

test(qase(437, 'Check ETH balance'), async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

const walletEthBalance = toCut(
String(await reefKnotService.walletPage.getTokenBalance('ETH')),
Expand All @@ -68,7 +68,7 @@ wallets.forEach((wallet) => {
});

test(qase(438, 'Check stETH balance'), async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

const walletStethBalance = toCut(
formatEther(await reefKnotService.sdkService.steth.balance()),
Expand All @@ -81,7 +81,7 @@ wallets.forEach((wallet) => {
});

test(qase(439, 'Check wstETH balance'), async () => {
qase.parameters({ wallet: wallet.name });
await qase.parameters({ wallet: wallet.name });

const walletWstethBalance = toCut(
formatEther(await reefKnotService.sdkService.wsteth.balance()),
Expand Down

0 comments on commit a2a4508

Please sign in to comment.