Skip to content

Commit

Permalink
refactored suite for parallelism
Browse files Browse the repository at this point in the history
  • Loading branch information
shashwatahalder01 committed Feb 15, 2024
1 parent 9273dca commit e53e074
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion tests/pw/api.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default defineConfig({
// globalTeardown: './global-teardown' /* Path to the global teardown file. This file will be required and run after all the tests. */,
globalTimeout: process.env.CI ? 20 * (60 * 1000) : 20 * (60 * 1000) /* Maximum time in milliseconds the whole test suite can run */,
maxFailures: process.env.CI ? 30 : 30 /* The maximum number of test failures for the whole test suite run. After reaching this number, testing will stop and exit with an error. */,
timeout: process.env.CI ? 10 * 1000 : 15 * 1000 /* Maximum time one test can run for. */,
timeout: process.env.CI ? 15 * 1000 : 15 * 1000 /* Maximum time one test can run for. */,
expect: {
timeout: 5 * 1000 /* Maximum time expect() should wait for the condition to be met. For example in `await expect(locator).toHaveText();`*/,
} /* Configuration for the expect assertion library */,
Expand Down
4 changes: 2 additions & 2 deletions tests/pw/e2e.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export default defineConfig({
use: {
...devices['Desktop Chrome'],
acceptDownloads: true /* Whether to automatically download all the attachments. */,
actionTimeout: 20 * 1000 /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */,
navigationTimeout: 20 * 1000 /* Maximum time each navigation such as 'goto()' can take. */,
actionTimeout: 30 * 1000 /* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */,
navigationTimeout: 30 * 1000 /* Maximum time each navigation such as 'goto()' can take. */,
baseURL: process.env.BASE_URL ? process.env.BASE_URL : 'http://localhost:9999' /* Base URL */,
// browserName: 'chromium' /* Name of the browser that runs tests. */,
bypassCSP: true /* Toggles bypassing page's Content-Security-Policy. */,
Expand Down
4 changes: 2 additions & 2 deletions tests/pw/global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ async function globalSetup(config: FullConfig) {
console.log('Global Setup running....');

// rewrite permalink structure
!CI && helpers.execommand(data.command.permalinkLocal);
!CI && helpers.exeCommand(data.command.permalinkLocal);

// activate theme: storefront
!CI && helpers.execommand(data.command.activateTheme);
!CI && helpers.exeCommand(data.command.activateTheme);

// get site url structure
let serverUrl = config.projects[0]?.use.baseURL as string;
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/tests/api/refunds.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test.describe('refunds api test', () => {
test.beforeAll(async () => {
apiUtils = new ApiUtils(await request.newContext());
[, orderResponseBody] = await apiUtils.createOrderWithStatus(payloads.createProduct(), payloads.createOrder, 'wc-processing', payloads.vendorAuth);
[, refundId] = await dbUtils.createRefund(orderResponseBody);
[, refundId] = await dbUtils.createRefundRequest(orderResponseBody);
});

test.afterAll(async () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/pw/tests/e2e/modules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test.describe('Modules test', () => {
});

test('admin can activate module @pro @a', async () => {
await apiUtils.deactivateModules([payloads.moduleIds.auction]);
await apiUtils.deactivateModules([payloads.moduleIds.auction], payloads.adminAuth);
await admin.activateDeactivateModule(data.modules.modulesName.AuctionIntegration);
});

Expand Down
1 change: 0 additions & 1 deletion tests/pw/tests/e2e/productAddons.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ test.describe('Product addon functionality test', () => {
async function createVendorProductAddon(): Promise<[string, string, string]> {
const [, addonId, addonName, addonFieldTitle] = await apiUtils.createProductAddon(payloads.createProductAddons(), payloads.adminAuth);
await dbUtils.updateCell(addonId, VENDOR_ID);
console.log(addonId, addonName, addonFieldTitle);
return [addonId, addonName, addonFieldTitle];
}

Expand Down
6 changes: 3 additions & 3 deletions tests/pw/tests/e2e/requestForQuotes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ test.describe('Request for quotation test vendor', () => {
vPage = await vendorContext.newPage();
vendor = new RequestForQuotationsPage(vPage);

// apiUtils = new ApiUtils(await request.newContext());
// [, productId[0], productName] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth);
// [, quoteId, quoteTitle] = await apiUtils.createQuoteRequest({ ...payloads.createQuoteRequest(), product_ids: productId, user_id: CUSTOMER_ID }, payloads.adminAuth);
apiUtils = new ApiUtils(await request.newContext());
[, productId[0], productName] = await apiUtils.createProduct(payloads.createProduct(), payloads.vendorAuth);
[, quoteId, quoteTitle] = await apiUtils.createQuoteRequest({ ...payloads.createQuoteRequest(), product_ids: productId, user_id: CUSTOMER_ID }, payloads.adminAuth);
});

test.afterAll(async () => {
Expand Down

0 comments on commit e53e074

Please sign in to comment.