From 0da914a7c8187c45d6fd28b179440696bc3bef29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chy=C5=82a?= Date: Tue, 24 Dec 2024 11:17:47 +0100 Subject: [PATCH 1/4] Upgrade actions/upload-artifact to v4 (#5325) * Remove not used action combine-e2e-results * Use v4 upload and download artifacts * Use shard * Extract shard index * Add shell * Add changeset * Generate report name * Generate report name in one step * Generate report name in one step v2 --- .changeset/dirty-toes-tan.md | 5 ++ .../actions/combineReportsFromE2E/action.yml | 51 ------------------- .github/actions/merge-pw-reports/action.yml | 7 +-- .github/actions/run-pw-tests/action.yml | 5 +- 4 files changed, 12 insertions(+), 56 deletions(-) create mode 100644 .changeset/dirty-toes-tan.md delete mode 100644 .github/actions/combineReportsFromE2E/action.yml diff --git a/.changeset/dirty-toes-tan.md b/.changeset/dirty-toes-tan.md new file mode 100644 index 00000000000..6f73247acc1 --- /dev/null +++ b/.changeset/dirty-toes-tan.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Now CI workflows use updated action to upload and download artifacts diff --git a/.github/actions/combineReportsFromE2E/action.yml b/.github/actions/combineReportsFromE2E/action.yml deleted file mode 100644 index cc4f715332c..00000000000 --- a/.github/actions/combineReportsFromE2E/action.yml +++ /dev/null @@ -1,51 +0,0 @@ -name: combine-e2e-results -description: "Combines reports from matrix and upload them as one" -runs: - using: "composite" - steps: - - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - cache: npm - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - path: ~/.npm - key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-qa-${{ env.cache-name }}- - ${{ runner.os }}-qa- - ${{ runner.os }}- - - name: Install Dependencies - if: steps.cache-node-modules.outputs.cache-hit != 'true' - shell: bash - run: NODE_OPTIONS=--max_old_space_size=4096 npm ci - - run: npm ci - shell: bash - working-directory: .github/workflows - - name: Download reports artifacts - uses: actions/download-artifact@v3 - with: - path: ./cypress/reports - - name: Create reports dir - shell: bash - continue-on-error: true - run: npm run qa:create-artifacts-dirs - - name: Merge report files - shell: bash - continue-on-error: true - run: npm run qa:generate-html-report - - name: Move artifacts screenshots into reports dir - shell: bash - continue-on-error: true - run: npm run qa:artifact-move-screenshots - - name: Upload reports - uses: actions/upload-artifact@v3 - if: always() - with: - name: combined-report - path: ./cypress/reports - retention-days: 5 - if-no-files-found: ignore diff --git a/.github/actions/merge-pw-reports/action.yml b/.github/actions/merge-pw-reports/action.yml index b646a9fe3f8..46f2b1b56c7 100644 --- a/.github/actions/merge-pw-reports/action.yml +++ b/.github/actions/merge-pw-reports/action.yml @@ -13,17 +13,18 @@ runs: run: npm ci - name: Download blob reports from GitHub Actions Artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: all-blob-reports path: all-blob-reports + pattern: all-blob-reports-* + merge-multiple: true - name: Merge into HTML Report shell: bash run: npx playwright merge-reports --reporter html ./all-blob-reports - name: Upload HTML report - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: html-report--attempt-${{ github.run_attempt }} path: playwright-report diff --git a/.github/actions/run-pw-tests/action.yml b/.github/actions/run-pw-tests/action.yml index f20b108fdf0..9657daca227 100644 --- a/.github/actions/run-pw-tests/action.yml +++ b/.github/actions/run-pw-tests/action.yml @@ -89,11 +89,12 @@ runs: PROJECT_PARAMS+="--project=${PROJECT} " done npx playwright test --grep @e2e $PROJECT_PARAMS --shard "$SHARD_NUMBER" + echo "reportName=all-blob-reports-${SHARD_NUMBER%%/*}" >> $GITHUB_ENV - name: Upload blob report to GitHub Actions Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: always() with: - name: all-blob-reports + name: ${{ env.reportName }} path: blob-report retention-days: 1 \ No newline at end of file From 7c0c89d52e076da931c4fd87238f7b2e91858a8e Mon Sep 17 00:00:00 2001 From: "M.Graczyk" Date: Fri, 27 Dec 2024 11:31:52 +0100 Subject: [PATCH 2/4] Split select options into 2 (#5301) * Split select options into 2 * Update .changeset/stupid-peas-work.md Co-authored-by: Jonatan Witoszek --------- Co-authored-by: Jonatan Witoszek --- .changeset/stupid-peas-work.md | 5 +++ .../dialogs/addNavigationMenuItemDialog.ts | 37 ++++++++++++++----- playwright/tests/navigation.spec.ts | 9 +++-- 3 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 .changeset/stupid-peas-work.md diff --git a/.changeset/stupid-peas-work.md b/.changeset/stupid-peas-work.md new file mode 100644 index 00000000000..19dc8d684f8 --- /dev/null +++ b/.changeset/stupid-peas-work.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Split select link option into 2 different ones to avoid flakyness in tests diff --git a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts index e943d4d2db8..8faa2b463b8 100644 --- a/playwright/pages/dialogs/addNavigationMenuItemDialog.ts +++ b/playwright/pages/dialogs/addNavigationMenuItemDialog.ts @@ -14,20 +14,37 @@ export class AddNavigationMenuItemDialog extends BasePage { super(page); } - async selectLinkOption(option: string, optionName: string) { + async selectLinkTypeOption(linkType: string) { await this.menuLinkType.click(); await this.waitForDOMToFullyLoad(); - await this.menuLinkOptions.filter({ hasText: "Categories" }).waitFor({ state: "visible" }); - await this.menuLinkOptions.filter({ hasText: "Collections" }).waitFor({ state: "visible" }); - await this.menuLinkOptions.filter({ hasText: "Pages" }).waitFor({ state: "visible" }); - await expect(this.menuLinkOptions.filter({ hasText: option })).toBeEnabled(); - await this.menuLinkOptions.filter({ hasText: option }).click({ force: true }); - await this.waitForDOMToFullyLoad(); + + // Ensure the link type option is visible and select it + const linkTypeOption = this.menuLinkOptions.filter({ hasText: linkType }); + + await linkTypeOption.waitFor({ state: "visible" }); + await expect(linkTypeOption).toBeEnabled(); + await linkTypeOption.click({ force: true }); + + // Verify the correct link type is selected + const selectedLinkType = await this.menuLinkType.inputValue(); + + if (selectedLinkType !== linkType) { + throw new Error(`Expected link type "${linkType}" but found "${selectedLinkType}"`); + } + } + + async selectLinkTypeValue(optionName: string) { await this.menuLinkValue.click(); - await this.menuLinkOptions.filter({ hasText: optionName }).waitFor({ state: "visible" }); - await expect(this.menuLinkOptions.filter({ hasText: optionName })).toBeEnabled(); - await this.menuLinkOptions.filter({ hasText: optionName }).click({ force: true }); await this.waitForDOMToFullyLoad(); + + // Ensure the option is present and select it + const option = this.menuLinkOptions.filter({ hasText: optionName }); + + await option.waitFor({ state: "visible" }); + await expect(option).toBeEnabled(); + await option.click({ force: true }); + + // Verify the correct option is selected await expect(this.menuLinkValue).toHaveValue(optionName); } diff --git a/playwright/tests/navigation.spec.ts b/playwright/tests/navigation.spec.ts index 94871aa60c0..83531c81120 100644 --- a/playwright/tests/navigation.spec.ts +++ b/playwright/tests/navigation.spec.ts @@ -42,7 +42,8 @@ test("TC: SALEOR_194 Should create a new menu navigation with menu item @navigat const menuItemName = faker.random.word(); await addNavigationMenuItemDialog.typeMenuItemName(menuItemName); - await addNavigationMenuItemDialog.selectLinkOption("Categories", "Polo Shirts"); + await addNavigationMenuItemDialog.selectLinkTypeOption("Categories"); + await addNavigationMenuItemDialog.selectLinkTypeValue("Polo Shirts"); await addNavigationMenuItemDialog.clickSaveButton(); await expect(navigationDetailsPage.addMenuItemDialog).not.toBeVisible(); await navigation.expectSuccessBanner(); @@ -59,7 +60,8 @@ test("TC: SALEOR_198 Should update existing menu @navigation @e2e", async () => await navigationDetailsPage.clickEditMenuItemButton(menuItemToBeUpdated.name); await addNavigationMenuItemDialog.typeMenuItemName(newItemName); - await addNavigationMenuItemDialog.selectLinkOption("Categories", "Polo Shirts"); + await addNavigationMenuItemDialog.selectLinkTypeOption("Categories"); + await addNavigationMenuItemDialog.selectLinkTypeValue("Polo Shirts"); await addNavigationMenuItemDialog.clickSaveButton(); await expect(navigationDetailsPage.addMenuItemDialog).not.toBeVisible(); await navigationDetailsPage.clickDeleteMenuItemButton(menuItemToBeDeleted.name); @@ -69,7 +71,8 @@ test("TC: SALEOR_198 Should update existing menu @navigation @e2e", async () => const menuItemName = faker.random.word(); await addNavigationMenuItemDialog.typeMenuItemName(menuItemName); - await addNavigationMenuItemDialog.selectLinkOption("Categories", "Polo Shirts"); + await addNavigationMenuItemDialog.selectLinkTypeOption("Categories"); + await addNavigationMenuItemDialog.selectLinkTypeValue("Polo Shirts"); await addNavigationMenuItemDialog.clickSaveButton(); await expect(navigationDetailsPage.menuItemList).toContainText(menuItemName); await navigationDetailsPage.clickDeleteMenuItemButton(menuItemName); From ab543c52eb4d30a989d23d836b447dd1d02fbaef Mon Sep 17 00:00:00 2001 From: "M.Graczyk" Date: Fri, 27 Dec 2024 13:32:12 +0100 Subject: [PATCH 3/4] Add explicit waits for draft order shipping carrier button interaction (#5324) * Add explicit waits for draft order shipping carrier button interaction * Add fixes from review --- .changeset/thin-drinks-kneel.md | 5 +++++ playwright/pages/draftOrdersPage.ts | 2 ++ playwright/tests/orders.spec.ts | 8 +++++++- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 .changeset/thin-drinks-kneel.md diff --git a/.changeset/thin-drinks-kneel.md b/.changeset/thin-drinks-kneel.md new file mode 100644 index 00000000000..8c7c5d97400 --- /dev/null +++ b/.changeset/thin-drinks-kneel.md @@ -0,0 +1,5 @@ +--- +"saleor-dashboard": patch +--- + +Add explicit waits for draft order shipping carrier button interaction diff --git a/playwright/pages/draftOrdersPage.ts b/playwright/pages/draftOrdersPage.ts index 39ac3bac584..2b139d32bea 100644 --- a/playwright/pages/draftOrdersPage.ts +++ b/playwright/pages/draftOrdersPage.ts @@ -60,7 +60,9 @@ export class DraftOrdersPage extends BasePage { } async clickAddShippingCarrierButton() { + await this.addShippingCarrierLink.scrollIntoViewIfNeeded(); await this.addShippingCarrierLink.click(); + await this.waitForDOMToFullyLoad(); } diff --git a/playwright/tests/orders.spec.ts b/playwright/tests/orders.spec.ts index 5ce96be6b99..6a36ce1b320 100644 --- a/playwright/tests/orders.spec.ts +++ b/playwright/tests/orders.spec.ts @@ -251,9 +251,15 @@ test("TC: SALEOR_84 Create draft order @e2e @draft", async () => { await draftOrdersPage.expectSuccessBanner(); await draftOrdersPage.addressDialog.clickConfirmButton(); await draftOrdersPage.expectSuccessBanner(); + + await draftOrdersPage.addShippingCarrierLink.waitFor({ state: "visible" }); + // Ensure the button is in viewport before clicking + await draftOrdersPage.addShippingCarrierLink.scrollIntoViewIfNeeded(); + + await expect(draftOrdersPage.addShippingCarrierLink).toBeVisible(); await draftOrdersPage.clickAddShippingCarrierButton(); + await draftOrdersPage.shippingAddressDialog.pickAndConfirmFirstShippingMethod(); - //await draftOrdersPage.expectSuccessBanner(); await draftOrdersPage.clickFinalizeButton(); await draftOrdersPage.expectSuccessBanner({ message: "finalized" }); }); From 6c723fe0a8587db1ad0e145628808dc8b4a22ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Chy=C5=82a?= Date: Fri, 3 Jan 2025 09:20:59 +0100 Subject: [PATCH 4/4] Fix fetch products data in webhook dry run and add warning (#5323) * Fix fetch products in dry run * Add changeset * Add items that do not work to excluded * Update changeset --- .changeset/mean-chicken-turn.md | 6 +++ src/components/DryRun/utils.ts | 4 +- src/components/DryRunItemsList/utils.ts | 69 ++++++++++--------------- 3 files changed, 35 insertions(+), 44 deletions(-) create mode 100644 .changeset/mean-chicken-turn.md diff --git a/.changeset/mean-chicken-turn.md b/.changeset/mean-chicken-turn.md new file mode 100644 index 00000000000..e0af25723a7 --- /dev/null +++ b/.changeset/mean-chicken-turn.md @@ -0,0 +1,6 @@ +--- +"saleor-dashboard": patch +--- + +Product data is now properly displayed in webhook dry run modal. +Add warning alert in webhook dry run modal for webhooks that don't have a valid object ids. diff --git a/src/components/DryRun/utils.ts b/src/components/DryRun/utils.ts index 437fd818955..4532fed6309 100644 --- a/src/components/DryRun/utils.ts +++ b/src/components/DryRun/utils.ts @@ -3,7 +3,7 @@ import { getWebhookTypes } from "@dashboard/custom-apps/components/WebhookEvents import { WebhookEventTypeAsyncEnum } from "@dashboard/graphql"; import { InlineFragmentNode, ObjectFieldNode, parse, visit } from "graphql"; -import { DocumentMap, ExcludedDocumentMap } from "../DryRunItemsList/utils"; +import { DocumentMap, ExcludedDocumentKeys } from "../DryRunItemsList/utils"; const getEventsFromQuery = (query: string) => { if (query.length === 0) { @@ -56,7 +56,7 @@ const checkEventPresence = (event: string) => { object => !availableObjects.includes(object), ); - Object.keys(ExcludedDocumentMap).forEach( + ExcludedDocumentKeys.forEach( object => !excludedObjects.includes(object) && excludedObjects.push(object), ); diff --git a/src/components/DryRunItemsList/utils.ts b/src/components/DryRunItemsList/utils.ts index f279c6b68e4..8889c594bbd 100644 --- a/src/components/DryRunItemsList/utils.ts +++ b/src/components/DryRunItemsList/utils.ts @@ -8,14 +8,12 @@ import { AttributeListQueryVariables, CategoryDetailsQuery, CategoryDetailsQueryVariables, - ChannelListDocument, CheckoutListDocument, CheckoutListQuery, CheckoutListQueryVariables, CollectionListDocument, CollectionListQuery, CollectionListQueryVariables, - CustomerAddressesDocument, CustomerAddressesQuery, CustomerAddressesQueryVariables, CustomerDetailsQuery, @@ -29,7 +27,6 @@ import { MenuListDocument, MenuListQuery, MenuListQueryVariables, - OrderFulfillDataDocument, OrderFulfillDataQuery, OrderFulfillDataQueryVariables, OrderListDocument, @@ -41,7 +38,6 @@ import { ProductListDocument, ProductListQuery, ProductListQueryVariables, - ProductVariantListDocument, ProductVariantListQuery, ProductVariantListQueryVariables, RootCategoriesDocument, @@ -162,13 +158,6 @@ export const DocumentMap: Record = { displayedAttribute: "email", // TODO inverted name }, - - INVOICE: { - document: OrderListDocument, - variables: DefaultVariables, - collection: "orders", - displayedAttribute: "number", - }, MENU: { document: MenuListDocument, variables: DefaultVariables, @@ -189,6 +178,8 @@ export const DocumentMap: Record = { variables: { first: 100, hasChannel: true, + includeCategories: false, + includeCollections: false, }, displayedAttribute: "name", }, @@ -228,35 +219,29 @@ export const DocumentMap: Record = { // Documents which require parent object or can't be handled ATM // -export const ExcludedDocumentMap: Record = { - ADDRESS: { - document: CustomerAddressesDocument, - variables: { - // USER ID REQUIRED - first: 100, - }, - }, +export const ExcludedDocumentKeys = [ + // USER ID REQUIRED + "ADDRESS", // it's not a countable collection - CHANNEL: { - document: ChannelListDocument, - variables: {}, - }, - FULFILLMENT: { - document: OrderFulfillDataDocument, - variables: { - // ORDER ID REQUIRED - first: 100, - }, - }, - PRODUCT_VARIANT: { - document: ProductVariantListDocument, - variables: { - // PRODUCT ID REQUIRED - first: 100, - }, - }, - TRANSLATION: { - document: null, - variables: {}, - }, -}; + "CHANNEL", + // ORDER ID REQUIRED + "FULFILLMENT", + // PRODUCT ID REQUIRED + "PRODUCT_VARIANT", + "PRODUCT_EXPORT_COMPLETED", + "PRODUCT_MEDIA_CREATED", + "PRODUCT_MEDIA_DELETED", + "PRODUCT_MEDIA_UPDATED", + "PRODUCT_VARIANT_BACK_IN_STOCK", + "PRODUCT_VARIANT_CREATED", + "PRODUCT_VARIANT_DELETED", + "PRODUCT_VARIANT_METADATA_UPDATED", + "PRODUCT_VARIANT_OUT_OF_STOCK", + "PRODUCT_VARIANT_STOCK_UPDATED", + "PRODUCT_VARIANT_UPDATED", + "VOUCHER_CODES_CREATED", + "VOUCHER_CODES_DELETED", + "VOUCHER_CODE_EXPORT_COMPLETED", + "ORDER_BULK_CREATED", + "TRANSLATION", +];