Skip to content

Commit

Permalink
(chocolatey#410) Update paths for Playwright Imports
Browse files Browse the repository at this point in the history
This updates the paths to imports done in
Playwright tests to reflect the correct location.
  • Loading branch information
st3phhays committed Jun 17, 2024
1 parent 368fc0f commit 74185a0
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 15 deletions.
23 changes: 23 additions & 0 deletions build/choco-theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ const init = async () => {

// Playwright
if (repository.playwright) {
// General
parallelTasksInitial.push(
{
task: 'Playwright tests - general',
Expand All @@ -155,6 +156,7 @@ const init = async () => {
}
);

// Pricing Calculator
if (repository.name === repositoryConfig.org.name) {
parallelTasksInitial.push(
{
Expand Down Expand Up @@ -235,6 +237,27 @@ const init = async () => {
await Promise.all(parallelTasksInitial.map(({ task, source, destination, isFolder }) => {
return copyTheme({ task, source, destination, isFolder });
}));

// Playwright - Pricing Calculator types
// This must be done at the end to ensure the files are copied
if (repository.playwright) {
copyTheme({
task: 'Playwright base config',
source: `${repositoryConfig.theme.root}/build/data/playwright-config.ts`,
destination: `${repository.playwright}/playwright-config.ts`,
isFolder: false
});

if (repository.name === repositoryConfig.org.name) {
copyTheme({
task: 'Playwright tests - pricing calculator types',
source: `${repositoryConfig.theme.root}/js/src/ts/util/pricing-calculator.ts`,
destination: `${repository.playwright}/pricing-calculator/pricing-calculator.ts`,
isFolder: false
});
}
}

console.log('✅ Copying of choco-theme complete');

// If blog repository, update Program.cs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { c4bAddOnPrice } from 'choco-theme/js/src/ts/util/pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { c4bAddOnPrice } from './pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { addOnContainer, packageCounts, packagingSelect } from './util';

test('test-add-on-packaging', async ({ page }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { c4bSupportNodes, c4bAddOnPrice } from 'choco-theme/js/src/ts/util/pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { c4bSupportNodes, c4bAddOnPrice } from './pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { addOnContainer, communitySupportCheckboxBtn, numberInput, standardSupportCheckboxBtn } from './util';

test('test-add-on-standard-support', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/pricing-calculator/included-items.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { c4bIncludedItems } from 'choco-theme/js/src/ts/util/pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { c4bIncludedItems } from './pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { addOnContainer, numberInput, premiumSupportCheckboxBtn } from './util';

test('test-included-items', async ({ page }) => {
Expand Down
6 changes: 6 additions & 0 deletions playwright/tests/pricing-calculator/modals.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ test('test-modals', async ({ page }) => {

const testModal = async (locator: string, showContactLink: boolean) => {
await page.click(`[data-bs-target="${locator}"]`);

await page.locator('body.modal-open').waitFor();

await expect(page.locator(locator)).toBeVisible();

if (showContactLink) {
await expect(page.locator(`${locator} .modal-footer a`)).toContainText('Contact Us');
}

await page.locator(`${locator} .modal-footer button[data-bs-dismiss="modal"]`).click();

await page.locator(locator).waitFor({ state: 'hidden' });

await expect(page.locator(locator)).toBeHidden();
};

Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/pricing-calculator/price.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { c4bStandardSubscription, c4bPremiumSubscription, c4bAddOnPrice, C4bSubscription } from 'choco-theme/js/src/ts/util/pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { c4bStandardSubscription, c4bPremiumSubscription, c4bAddOnPrice, C4bSubscription } from './pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { numberInput, packageCounts, packagingSelect, premiumSupportCheckboxBtn, standardSupportCheckboxBtn } from './util';

test('test-price', async ({ page }) => {
Expand Down
2 changes: 1 addition & 1 deletion playwright/tests/pricing-calculator/support-types.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { test, expect } from '@playwright/test';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { c4bSupportNodes } from 'choco-theme/js/src/ts/util/pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { c4bSupportNodes } from './pricing-calculator'; // This is ignored since this is the correct location after it is imported into the repository by gulp
import { numberInput } from './util';

test('test-support-types', async ({ page }) => {
Expand Down
10 changes: 0 additions & 10 deletions playwright/tsconfig.json

This file was deleted.

0 comments on commit 74185a0

Please sign in to comment.