Skip to content

Commit

Permalink
Update orders, vouchers, apps e2e tests to UI/API changes (#4478)
Browse files Browse the repository at this point in the history
* fix orders, vouchers, apps e2e tests

* changset added

* removed duplicated selector
  • Loading branch information
wojteknowacki authored Nov 23, 2023
1 parent 8cbcd25 commit b7ed22f
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 32 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-zoos-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"saleor-dashboard": minor
---

fixes e2e tests which fails on nightly run orders, apps, vouchers
21 changes: 8 additions & 13 deletions cypress/e2e/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,9 @@ import { APP_DETAILS } from "../elements/apps/appDetails";
import { APPS_LIST_SELECTORS } from "../elements/apps/appsList";
import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
import {
appDetailsUrl,
urlList,
} from "../fixtures/urlList";
import { appDetailsUrl, urlList } from "../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../fixtures/users";
import {
createApp,
getApp,
updateApp,
} from "../support/api/requests/Apps";
import { createApp, getApp, updateApp } from "../support/api/requests/Apps";
import {
addShippingMethod,
createCheckout,
Expand All @@ -25,9 +18,7 @@ import {
import { createVoucher } from "../support/api/requests/Discounts/Vouchers";
import { createGiftCard } from "../support/api/requests/GiftCard";
import { getDefaultChannel } from "../support/api/utils/channelsUtils";
import {
getShippingMethodIdFromCheckout,
} from "../support/api/utils/ordersUtils";
import { getShippingMethodIdFromCheckout } from "../support/api/utils/ordersUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
Expand Down Expand Up @@ -148,7 +139,11 @@ describe("As a staff user I want to manage apps", () => {
.get(WEBHOOK_DETAILS.nameInput)
.type(randomWebhookName)
.get(WEBHOOK_DETAILS.targetUrlInput)
.type(targetUrl)
.type(targetUrl);
cy.get(WEBHOOK_DETAILS.webhookObjects).first().click();
cy.get(WEBHOOK_DETAILS.webhookEventsCheckboxes)
.first()
.click()
.get(BUTTON_SELECTORS.confirm)
.click()
.confirmationMessageShouldDisappear();
Expand Down
20 changes: 5 additions & 15 deletions cypress/e2e/discounts/vouchers/updateVouchers.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,11 @@ import faker from "faker";
import { VOUCHERS_SELECTORS } from "../../../elements/discounts/vouchers";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { voucherDetailsUrl } from "../../../fixtures/urlList";
import {
createVoucherInChannel,
} from "../../../support/api/utils/discounts/vouchersUtils";
import {
createCheckoutWithVoucher,
} from "../../../support/api/utils/ordersUtils";
import * as productsUtils
from "../../../support/api/utils/products/productsUtils";
import {
updateTaxConfigurationForChannel,
} from "../../../support/api/utils/taxesUtils";
import {
formatDate,
formatTime,
} from "../../../support/formatData/formatDate";
import { createVoucherInChannel } from "../../../support/api/utils/discounts/vouchersUtils";
import { createCheckoutWithVoucher } from "../../../support/api/utils/ordersUtils";
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils";
import { formatDate, formatTime } from "../../../support/formatData/formatDate";
import { setVoucherDate } from "../../../support/pages/discounts/vouchersPage";

describe("As an admin I want to update vouchers", () => {
Expand Down
4 changes: 3 additions & 1 deletion cypress/elements/apps/webhookDetails.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
export const WEBHOOK_DETAILS = {
nameInput: '[name="name"]',
targetUrlInput: '[name="targetUrl"]'
targetUrlInput: '[name="targetUrl"]',
webhookObjects: '[data-test-id="webhook-objects-items"]',
webhookEventsCheckboxes: '[data-test-id="events-checkbox"]',
};
4 changes: 2 additions & 2 deletions cypress/support/api/requests/Channels.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ export function updateChannelOrderSettings({
automaticallyFulfillNonShippableGiftCard: ${automaticallyFulfillNonShippableGiftCard},
expireOrdersAfter: ${expireOrdersAfter},
markAsPaidStrategy: ${markAsPaidStrategy},
defaultTransactionFlowStrategy: ${defaultTransactionFlowStrategy}
}}){
}paymentSettings:{ defaultTransactionFlowStrategy: ${defaultTransactionFlowStrategy}
}}){
errors{
field
message
Expand Down
2 changes: 1 addition & 1 deletion cypress/support/pages/discounts/vouchersPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function setVoucherDate({
}
if (endDate) {
if (hasEndDate) {
cy.get(VOUCHERS_SELECTORS.hasEndDateCheckbox).click();
cy.get(VOUCHERS_SELECTORS.hasEndDateCheckbox).click({ force: true });
}
cy.get(VOUCHERS_SELECTORS.endDateInput)
.type(endDate)
Expand Down
2 changes: 2 additions & 0 deletions src/custom-apps/components/WebhookEvents/WebhookEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const WebhookEvents: React.FC<WebhookEventsProps> = ({
<ListBody className={classes.listBody}>
{Object.keys(EventTypes[tab]).map((object, idx) => (
<ListItem
data-test-id="webhook-objects-items"
key={idx}
className={classes.listItem}
onClick={() => setObject(object)}
Expand Down Expand Up @@ -171,6 +172,7 @@ const WebhookEvents: React.FC<WebhookEventsProps> = ({
)}
</strong>
<Checkbox
data-test-id="events-checkbox"
name={`${tab}Events`}
checked={data[`${tab}Events`].includes(
getEventName(object, event),
Expand Down

0 comments on commit b7ed22f

Please sign in to comment.