@shopware-ag/acceptance-test-suite 12.24.0 → 12.24.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.mjs +39 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1187,6 +1187,14 @@ declare class TestDataService {
|
|
|
1187
1187
|
* Will delete all entities created by the data service via sync API.
|
|
1188
1188
|
*/
|
|
1189
1189
|
cleanUp(): Promise<playwright_core.APIResponse | null>;
|
|
1190
|
+
/**
|
|
1191
|
+
* Deletes all documents of the given orders.
|
|
1192
|
+
* Documents restrict the deletion of their order, so the cleanup calls this before deleting created orders.
|
|
1193
|
+
* Dependent documents (e.g. credit notes, cancellation invoices) are deleted before the documents they reference.
|
|
1194
|
+
*
|
|
1195
|
+
* @param orderIds - The ids of the orders whose documents should be deleted.
|
|
1196
|
+
*/
|
|
1197
|
+
deleteOrderDocuments(orderIds: string[]): Promise<void>;
|
|
1190
1198
|
isProduct(item: Product | Promotion): item is Product;
|
|
1191
1199
|
isPromotion(item: Product | Promotion): item is Promotion;
|
|
1192
1200
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1187,6 +1187,14 @@ declare class TestDataService {
|
|
|
1187
1187
|
* Will delete all entities created by the data service via sync API.
|
|
1188
1188
|
*/
|
|
1189
1189
|
cleanUp(): Promise<playwright_core.APIResponse | null>;
|
|
1190
|
+
/**
|
|
1191
|
+
* Deletes all documents of the given orders.
|
|
1192
|
+
* Documents restrict the deletion of their order, so the cleanup calls this before deleting created orders.
|
|
1193
|
+
* Dependent documents (e.g. credit notes, cancellation invoices) are deleted before the documents they reference.
|
|
1194
|
+
*
|
|
1195
|
+
* @param orderIds - The ids of the orders whose documents should be deleted.
|
|
1196
|
+
*/
|
|
1197
|
+
deleteOrderDocuments(orderIds: string[]): Promise<void>;
|
|
1190
1198
|
isProduct(item: Product | Promotion): item is Product;
|
|
1191
1199
|
isPromotion(item: Product | Promotion): item is Promotion;
|
|
1192
1200
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -5975,6 +5975,8 @@ class TestDataService {
|
|
|
5975
5975
|
expect(salesChannelResponse.ok()).toBeTruthy();
|
|
5976
5976
|
}
|
|
5977
5977
|
}
|
|
5978
|
+
const createdOrderIds = this.createdRecords.filter((record) => record.resource === "order").map((record) => record.payload.id);
|
|
5979
|
+
await this.deleteOrderDocuments(createdOrderIds);
|
|
5978
5980
|
this.createdRecords.forEach((record) => {
|
|
5979
5981
|
if (record.resource === "user") {
|
|
5980
5982
|
if (!deleteUserIds.includes(record.payload.id)) {
|
|
@@ -6035,6 +6037,43 @@ class TestDataService {
|
|
|
6035
6037
|
data: deleteOperations
|
|
6036
6038
|
});
|
|
6037
6039
|
}
|
|
6040
|
+
/**
|
|
6041
|
+
* Deletes all documents of the given orders.
|
|
6042
|
+
* Documents restrict the deletion of their order, so the cleanup calls this before deleting created orders.
|
|
6043
|
+
* Dependent documents (e.g. credit notes, cancellation invoices) are deleted before the documents they reference.
|
|
6044
|
+
*
|
|
6045
|
+
* @param orderIds - The ids of the orders whose documents should be deleted.
|
|
6046
|
+
*/
|
|
6047
|
+
async deleteOrderDocuments(orderIds) {
|
|
6048
|
+
if (orderIds.length === 0) {
|
|
6049
|
+
return;
|
|
6050
|
+
}
|
|
6051
|
+
const documentResponse = await this.AdminApiClient.post("search/document", {
|
|
6052
|
+
data: {
|
|
6053
|
+
filter: [{ type: "equalsAny", field: "orderId", value: orderIds }],
|
|
6054
|
+
includes: { document: ["id", "referencedDocumentId"] }
|
|
6055
|
+
}
|
|
6056
|
+
});
|
|
6057
|
+
expect(documentResponse.ok()).toBeTruthy();
|
|
6058
|
+
const { data: documents } = await documentResponse.json();
|
|
6059
|
+
const dependentDocuments = documents.filter((document) => document.referencedDocumentId);
|
|
6060
|
+
const referencedDocuments = documents.filter((document) => !document.referencedDocumentId);
|
|
6061
|
+
for (const batch of [dependentDocuments, referencedDocuments]) {
|
|
6062
|
+
if (batch.length === 0) {
|
|
6063
|
+
continue;
|
|
6064
|
+
}
|
|
6065
|
+
const deleteResponse = await this.AdminApiClient.post("_action/sync", {
|
|
6066
|
+
data: {
|
|
6067
|
+
"delete-document": {
|
|
6068
|
+
entity: "document",
|
|
6069
|
+
action: "delete",
|
|
6070
|
+
payload: batch.map(({ id }) => ({ id }))
|
|
6071
|
+
}
|
|
6072
|
+
}
|
|
6073
|
+
});
|
|
6074
|
+
expect(deleteResponse.ok()).toBeTruthy();
|
|
6075
|
+
}
|
|
6076
|
+
}
|
|
6038
6077
|
isProduct(item) {
|
|
6039
6078
|
return item.productNumber !== void 0;
|
|
6040
6079
|
}
|