Fix get correct domain from version (#2118)
This commit is contained in:
parent
fd7813692a
commit
9e43dd4ab1
85 changed files with 918 additions and 916 deletions
4
.github/workflows/tests-nightly.yml
vendored
4
.github/workflows/tests-nightly.yml
vendored
|
@ -158,7 +158,9 @@ jobs:
|
||||||
env:
|
env:
|
||||||
version: ${{github.event.client_payload.version}}
|
version: ${{github.event.client_payload.version}}
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=formatted_version::$(echo $version | grep -Eo "\d\.\d" | sed s/\\.// | head -n 1 )"
|
echo "::set-output name=formatted_version::$(echo $version | grep -Eo "\d\.\d" | sed s/\\.// | head -n 1 | { read formatted; echo "$formatted"; })"
|
||||||
|
echo "$formatted_version"
|
||||||
|
|
||||||
- name: Cypress run - automatically
|
- name: Cypress run - automatically
|
||||||
uses: cypress-io/github-action@v4
|
uses: cypress-io/github-action@v4
|
||||||
env:
|
env:
|
||||||
|
|
|
@ -11,7 +11,7 @@ module.exports = defineConfig({
|
||||||
viewportHeight: 660,
|
viewportHeight: 660,
|
||||||
e2e: {
|
e2e: {
|
||||||
env: {
|
env: {
|
||||||
grepFilterSpecs: true
|
grepFilterSpecs: true,
|
||||||
},
|
},
|
||||||
setupNodeEvents(on, config) {
|
setupNodeEvents(on, config) {
|
||||||
config = require("./cypress/support/cypress-grep/plugin")(config);
|
config = require("./cypress/support/cypress-grep/plugin")(config);
|
||||||
|
@ -19,6 +19,6 @@ module.exports = defineConfig({
|
||||||
return config;
|
return config;
|
||||||
},
|
},
|
||||||
baseUrl: "http://localhost:9000/",
|
baseUrl: "http://localhost:9000/",
|
||||||
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}"
|
specPattern: "cypress/e2e/**/*.{js,jsx,ts,tsx}",
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -57,7 +57,7 @@ describe("Tests for apps", () => {
|
||||||
const token = app.tokens.find(element => element.name === "Default");
|
const token = app.tokens.find(element => element.name === "Default");
|
||||||
expect(token).to.be.ok;
|
expect(token).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -81,7 +81,7 @@ describe("Tests for apps", () => {
|
||||||
expect(webhooks[0].name).to.eq(randomName);
|
expect(webhooks[0].name).to.eq(randomName);
|
||||||
expect(webhooks[0].targetUrl).to.eq(targetUrl);
|
expect(webhooks[0].targetUrl).to.eq(targetUrl);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -109,10 +109,10 @@ describe("Tests for apps", () => {
|
||||||
.then(app => {
|
.then(app => {
|
||||||
const token = app.tokens.find(element => element.name === randomName);
|
const token = app.tokens.find(element => element.name === randomName);
|
||||||
const tokenLastFourDigits = expectedToken.slice(
|
const tokenLastFourDigits = expectedToken.slice(
|
||||||
expectedToken.length - 4
|
expectedToken.length - 4,
|
||||||
);
|
);
|
||||||
expect(token.authToken).to.eq(tokenLastFourDigits);
|
expect(token.authToken).to.eq(tokenLastFourDigits);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ import faker from "faker";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
CATEGORIES_LIST,
|
CATEGORIES_LIST,
|
||||||
categoryRow
|
categoryRow,
|
||||||
} from "../../elements/catalog/categories/categories-list";
|
} from "../../elements/catalog/categories/categories-list";
|
||||||
import { CATEGORY_DETAILS } from "../../elements/catalog/categories/category-details";
|
import { CATEGORY_DETAILS } from "../../elements/catalog/categories/category-details";
|
||||||
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
|
||||||
|
@ -13,7 +13,7 @@ import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
|
||||||
import { categoryDetailsUrl, urlList } from "../../fixtures/urlList";
|
import { categoryDetailsUrl, urlList } from "../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createCategory as createCategoryRequest,
|
createCategory as createCategoryRequest,
|
||||||
getCategory
|
getCategory,
|
||||||
} from "../../support/api/requests/Category";
|
} from "../../support/api/requests/Category";
|
||||||
import { deleteCategoriesStartsWith } from "../../support/api/utils/catalog/categoryUtils";
|
import { deleteCategoriesStartsWith } from "../../support/api/utils/catalog/categoryUtils";
|
||||||
import * as channelsUtils from "../../support/api/utils/channelsUtils";
|
import * as channelsUtils from "../../support/api/utils/channelsUtils";
|
||||||
|
@ -21,7 +21,7 @@ import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
|
||||||
import {
|
import {
|
||||||
createCategory,
|
createCategory,
|
||||||
updateCategory
|
updateCategory,
|
||||||
} from "../../support/pages/catalog/categoriesPage";
|
} from "../../support/pages/catalog/categoriesPage";
|
||||||
|
|
||||||
describe("As an admin I want to manage categories", () => {
|
describe("As an admin I want to manage categories", () => {
|
||||||
|
@ -52,7 +52,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
({
|
({
|
||||||
category: categoryResp,
|
category: categoryResp,
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp
|
productType: productTypeResp,
|
||||||
}) => {
|
}) => {
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
|
@ -62,9 +62,9 @@ describe("As an admin I want to manage categories", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(({ product: productResp }) => (product = productResp));
|
.then(({ product: productResp }) => (product = productResp));
|
||||||
});
|
});
|
||||||
|
@ -92,7 +92,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
const descriptionResp = JSON.parse(newCategory.description);
|
const descriptionResp = JSON.parse(newCategory.description);
|
||||||
expect(descriptionResp.blocks[0].data.text).to.eq(categoryName);
|
expect(descriptionResp.blocks[0].data.text).to.eq(categoryName);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -111,7 +111,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
getCategory(category.id).then(categoryResp => {
|
getCategory(category.id).then(categoryResp => {
|
||||||
expect(categoryResp.children.edges[0].node.name).to.eq(categoryName);
|
expect(categoryResp.children.edges[0].node.name).to.eq(categoryName);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -125,7 +125,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
.click()
|
.click()
|
||||||
.url()
|
.url()
|
||||||
.should("include", urlList.addProduct);
|
.should("include", urlList.addProduct);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -150,7 +150,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
getCategory(category.id).then(categoryResp => {
|
getCategory(category.id).then(categoryResp => {
|
||||||
expect(categoryResp.products.edges.length).to.be.eq(0);
|
expect(categoryResp.products.edges.length).to.be.eq(0);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -162,7 +162,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
.type(category.name);
|
.type(category.name);
|
||||||
cy.contains(SHARED_ELEMENTS.tableRow, category.name).click();
|
cy.contains(SHARED_ELEMENTS.tableRow, category.name).click();
|
||||||
cy.contains(SHARED_ELEMENTS.header, category.name).should("be.visible");
|
cy.contains(SHARED_ELEMENTS.header, category.name).should("be.visible");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -172,7 +172,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
const categoryName = `${startsWith}${faker.datatype.number()}`;
|
const categoryName = `${startsWith}${faker.datatype.number()}`;
|
||||||
|
|
||||||
createCategoryRequest({
|
createCategoryRequest({
|
||||||
name: categoryName
|
name: categoryName,
|
||||||
}).then(categoryResp => {
|
}).then(categoryResp => {
|
||||||
cy.visit(categoryDetailsUrl(categoryResp.id))
|
cy.visit(categoryDetailsUrl(categoryResp.id))
|
||||||
.get(BUTTON_SELECTORS.deleteButton)
|
.get(BUTTON_SELECTORS.deleteButton)
|
||||||
|
@ -183,7 +183,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
.waitForRequestAndCheckIfNoErrors("@CategoryDelete");
|
.waitForRequestAndCheckIfNoErrors("@CategoryDelete");
|
||||||
getCategory(categoryResp.id).should("be.null");
|
getCategory(categoryResp.id).should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -194,11 +194,11 @@ describe("As an admin I want to manage categories", () => {
|
||||||
const updatedName = `${startsWith}updatedCategory`;
|
const updatedName = `${startsWith}updatedCategory`;
|
||||||
|
|
||||||
createCategoryRequest({
|
createCategoryRequest({
|
||||||
name: categoryName
|
name: categoryName,
|
||||||
})
|
})
|
||||||
.then(categoryResp => {
|
.then(categoryResp => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
categoryDetailsUrl(categoryResp.id)
|
categoryDetailsUrl(categoryResp.id),
|
||||||
);
|
);
|
||||||
updateCategory({ name: updatedName, description: updatedName });
|
updateCategory({ name: updatedName, description: updatedName });
|
||||||
getCategory(categoryResp.id);
|
getCategory(categoryResp.id);
|
||||||
|
@ -209,7 +209,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
const descriptionText = descriptionJson.blocks[0].data.text;
|
const descriptionText = descriptionJson.blocks[0].data.text;
|
||||||
expect(descriptionText).to.eq(updatedName);
|
expect(descriptionText).to.eq(updatedName);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -222,13 +222,13 @@ describe("As an admin I want to manage categories", () => {
|
||||||
let secondCategory;
|
let secondCategory;
|
||||||
|
|
||||||
createCategoryRequest({
|
createCategoryRequest({
|
||||||
name: firstCategoryName
|
name: firstCategoryName,
|
||||||
}).then(categoryResp => {
|
}).then(categoryResp => {
|
||||||
firstCategory = categoryResp;
|
firstCategory = categoryResp;
|
||||||
});
|
});
|
||||||
|
|
||||||
createCategoryRequest({
|
createCategoryRequest({
|
||||||
name: secondCategoryName
|
name: secondCategoryName,
|
||||||
}).then(categoryResp => {
|
}).then(categoryResp => {
|
||||||
secondCategory = categoryResp;
|
secondCategory = categoryResp;
|
||||||
cy.visit(urlList.categories)
|
cy.visit(urlList.categories)
|
||||||
|
@ -248,7 +248,7 @@ describe("As an admin I want to manage categories", () => {
|
||||||
getCategory(firstCategory.id).should("be.null");
|
getCategory(firstCategory.id).should("be.null");
|
||||||
getCategory(secondCategory.id).should("be.null");
|
getCategory(secondCategory.id).should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -261,13 +261,13 @@ describe("As an admin I want to manage categories", () => {
|
||||||
let mainCategory;
|
let mainCategory;
|
||||||
|
|
||||||
createCategoryRequest({
|
createCategoryRequest({
|
||||||
name: mainCategoryName
|
name: mainCategoryName,
|
||||||
})
|
})
|
||||||
.then(categoryResp => {
|
.then(categoryResp => {
|
||||||
mainCategory = categoryResp;
|
mainCategory = categoryResp;
|
||||||
createCategoryRequest({
|
createCategoryRequest({
|
||||||
name: subCategoryName,
|
name: subCategoryName,
|
||||||
parent: mainCategory.id
|
parent: mainCategory.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(categoryResp => {
|
.then(categoryResp => {
|
||||||
|
@ -288,6 +288,6 @@ describe("As an admin I want to manage categories", () => {
|
||||||
.then(categoryResp => {
|
.then(categoryResp => {
|
||||||
expect(categoryResp.children.edges).to.be.empty;
|
expect(categoryResp.children.edges).to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { collectionDetailsUrl, urlList } from "../../fixtures/urlList";
|
||||||
import { createChannel } from "../../support/api/requests/Channels";
|
import { createChannel } from "../../support/api/requests/Channels";
|
||||||
import {
|
import {
|
||||||
addProductToCollection,
|
addProductToCollection,
|
||||||
createCollection as createCollectionRequest
|
createCollection as createCollectionRequest,
|
||||||
} from "../../support/api/requests/Collections";
|
} from "../../support/api/requests/Collections";
|
||||||
import { updateChannelInProduct } from "../../support/api/requests/Product";
|
import { updateChannelInProduct } from "../../support/api/requests/Product";
|
||||||
import { getCollection } from "../../support/api/requests/storeFront/Collections";
|
import { getCollection } from "../../support/api/requests/storeFront/Collections";
|
||||||
|
@ -21,7 +21,7 @@ import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
|
||||||
import {
|
import {
|
||||||
isCollectionVisible,
|
isCollectionVisible,
|
||||||
isProductInCollectionVisible
|
isProductInCollectionVisible,
|
||||||
} from "../../support/api/utils/storeFront/collectionsUtils";
|
} from "../../support/api/utils/storeFront/collectionsUtils";
|
||||||
import { isProductVisibleInSearchResult } from "../../support/api/utils/storeFront/storeFrontProductUtils";
|
import { isProductVisibleInSearchResult } from "../../support/api/utils/storeFront/storeFrontProductUtils";
|
||||||
import filterTests from "../../support/filterTests";
|
import filterTests from "../../support/filterTests";
|
||||||
|
@ -29,7 +29,7 @@ import {
|
||||||
assignProductsToCollection,
|
assignProductsToCollection,
|
||||||
createCollection,
|
createCollection,
|
||||||
removeProductsFromCollection,
|
removeProductsFromCollection,
|
||||||
updateCollection
|
updateCollection,
|
||||||
} from "../../support/pages/catalog/collectionsPage";
|
} from "../../support/pages/catalog/collectionsPage";
|
||||||
|
|
||||||
filterTests({ definedTags: ["all"] }, () => {
|
filterTests({ definedTags: ["all"] }, () => {
|
||||||
|
@ -61,7 +61,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
|
@ -71,9 +71,9 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(({ product: productResp }) => (product = productResp));
|
.then(({ product: productResp }) => (product = productResp));
|
||||||
});
|
});
|
||||||
|
@ -100,14 +100,14 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getCollection({
|
getCollection({
|
||||||
collectionId: collection.id,
|
collectionId: collection.id,
|
||||||
channelSlug: defaultChannel.slug
|
channelSlug: defaultChannel.slug,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ collection: resp }) => {
|
.then(({ collection: resp }) => {
|
||||||
const isVisible = isCollectionVisible(resp, collection.id);
|
const isVisible = isCollectionVisible(resp, collection.id);
|
||||||
expect(isVisible).to.equal(false);
|
expect(isVisible).to.equal(false);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -126,14 +126,14 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
assignProductsToCollection(name);
|
assignProductsToCollection(name);
|
||||||
getCollection({
|
getCollection({
|
||||||
collectionId: collection.id,
|
collectionId: collection.id,
|
||||||
channelSlug: defaultChannel.slug
|
channelSlug: defaultChannel.slug,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ collection: resp }) => {
|
.then(({ collection: resp }) => {
|
||||||
const isVisible = isCollectionVisible(resp, collection.id);
|
const isVisible = isCollectionVisible(resp, collection.id);
|
||||||
expect(isVisible).to.equal(true);
|
expect(isVisible).to.equal(true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -159,14 +159,14 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
assignProductsToCollection(name);
|
assignProductsToCollection(name);
|
||||||
getCollection({
|
getCollection({
|
||||||
collectionId: collection.id,
|
collectionId: collection.id,
|
||||||
channelSlug: defaultChannel.slug
|
channelSlug: defaultChannel.slug,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ collection: resp }) => {
|
.then(({ collection: resp }) => {
|
||||||
const isVisible = isCollectionVisible(resp, collection.id);
|
const isVisible = isCollectionVisible(resp, collection.id);
|
||||||
expect(isVisible).to.equal(false);
|
expect(isVisible).to.equal(false);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -186,7 +186,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
visibleInListings: false
|
visibleInListings: false,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => (createdProduct = productResp));
|
.then(({ product: productResp }) => (createdProduct = productResp));
|
||||||
cy.visit(urlList.collections);
|
cy.visit(urlList.collections);
|
||||||
|
@ -199,13 +199,13 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getCollection({
|
getCollection({
|
||||||
collectionId: collection.id,
|
collectionId: collection.id,
|
||||||
channelSlug: defaultChannel.slug
|
channelSlug: defaultChannel.slug,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ collection: resp }) => {
|
.then(({ collection: resp }) => {
|
||||||
const isVisible = isProductInCollectionVisible(
|
const isVisible = isProductInCollectionVisible(
|
||||||
resp,
|
resp,
|
||||||
createdProduct.id
|
createdProduct.id,
|
||||||
);
|
);
|
||||||
expect(isVisible).to.equal(true);
|
expect(isVisible).to.equal(true);
|
||||||
})
|
})
|
||||||
|
@ -215,11 +215,11 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
const isVisible = isProductVisibleInSearchResult(
|
const isVisible = isProductVisibleInSearchResult(
|
||||||
resp,
|
resp,
|
||||||
createdProduct.name
|
createdProduct.name,
|
||||||
);
|
);
|
||||||
expect(isVisible).to.equal(false);
|
expect(isVisible).to.equal(false);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -240,7 +240,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.its("collection")
|
.its("collection")
|
||||||
.should("be.null");
|
.should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -281,7 +281,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.its("collection")
|
.its("collection")
|
||||||
.should("be.null");
|
.should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -304,7 +304,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
visibleInListings: false
|
visibleInListings: false,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
productToAssign = productResp;
|
productToAssign = productResp;
|
||||||
|
@ -320,7 +320,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -342,14 +342,14 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
visibleInListings: false
|
visibleInListings: false,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
productToAssign = productResp;
|
productToAssign = productResp;
|
||||||
|
|
||||||
addProductToCollection({
|
addProductToCollection({
|
||||||
collectionId: collection.id,
|
collectionId: collection.id,
|
||||||
productId: productToAssign.id
|
productId: productToAssign.id,
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.visit(collectionDetailsUrl(collection.id));
|
cy.visit(collectionDetailsUrl(collection.id));
|
||||||
|
@ -369,7 +369,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.should("be.empty");
|
.should("be.empty");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -382,7 +382,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
createCollectionRequest(collectionName)
|
createCollectionRequest(collectionName)
|
||||||
.then(collectionResp => {
|
.then(collectionResp => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
collectionDetailsUrl(collectionResp.id)
|
collectionDetailsUrl(collectionResp.id),
|
||||||
);
|
);
|
||||||
updateCollection({ name: updatedName, description: updatedName });
|
updateCollection({ name: updatedName, description: updatedName });
|
||||||
getCollection({ collectionId: collectionResp.id, auth: "auth" });
|
getCollection({ collectionId: collectionResp.id, auth: "auth" });
|
||||||
|
@ -393,7 +393,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
const descriptionText = descriptionJson.blocks[0].data.text;
|
const descriptionText = descriptionJson.blocks[0].data.text;
|
||||||
expect(descriptionText).to.eq(updatedName);
|
expect(descriptionText).to.eq(updatedName);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,24 +5,24 @@ import { GIFT_CARD_LIST } from "../../../elements/catalog/giftCard/giftCardList"
|
||||||
import { completeCheckout } from "../../../support/api/requests/Checkout";
|
import { completeCheckout } from "../../../support/api/requests/Checkout";
|
||||||
import {
|
import {
|
||||||
createGiftCard,
|
createGiftCard,
|
||||||
giftCardDeactivate
|
giftCardDeactivate,
|
||||||
} from "../../../support/api/requests/GiftCard";
|
} from "../../../support/api/requests/GiftCard";
|
||||||
import {
|
import {
|
||||||
createCheckoutWithDisabledGiftCard,
|
createCheckoutWithDisabledGiftCard,
|
||||||
deleteGiftCardsWithTagStartsWith,
|
deleteGiftCardsWithTagStartsWith,
|
||||||
isGiftCardDataAsExpected,
|
isGiftCardDataAsExpected,
|
||||||
purchaseProductWithActiveGiftCard
|
purchaseProductWithActiveGiftCard,
|
||||||
} from "../../../support/api/utils/catalog/giftCardUtils";
|
} from "../../../support/api/utils/catalog/giftCardUtils";
|
||||||
import * as channelsUtils from "../../../support/api/utils/channelsUtils";
|
import * as channelsUtils from "../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
addPayment,
|
addPayment,
|
||||||
purchaseProductWithPromoCode
|
purchaseProductWithPromoCode,
|
||||||
} from "../../../support/api/utils/ordersUtils";
|
} from "../../../support/api/utils/ordersUtils";
|
||||||
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||||
import {
|
import {
|
||||||
changeGiftCardActiveStatus,
|
changeGiftCardActiveStatus,
|
||||||
enterAndSelectGiftCards
|
enterAndSelectGiftCards,
|
||||||
} from "../../../support/pages/catalog/giftCardPage";
|
} from "../../../support/pages/catalog/giftCardPage";
|
||||||
|
|
||||||
describe("As a admin I want to use enabled gift card in checkout", () => {
|
describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
|
@ -32,7 +32,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
const email = "example@example.com";
|
const email = "example@example.com";
|
||||||
const giftCardData = {
|
const giftCardData = {
|
||||||
amount: 150,
|
amount: 150,
|
||||||
currency: "USD"
|
currency: "USD",
|
||||||
};
|
};
|
||||||
|
|
||||||
let defaultChannel;
|
let defaultChannel;
|
||||||
|
@ -61,7 +61,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
auth: "token",
|
auth: "token",
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
shippingMethodName: resp.shippingMethod.name,
|
shippingMethodName: resp.shippingMethod.name,
|
||||||
variantsList: resp.variantsList
|
variantsList: resp.variantsList,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -97,13 +97,13 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
giftCardId: giftCard.id,
|
giftCardId: giftCard.id,
|
||||||
expectedAmount: expectedGiftCardBalance,
|
expectedAmount: expectedGiftCardBalance,
|
||||||
userEmail: email,
|
userEmail: email,
|
||||||
initialBalance: giftCardData.amount
|
initialBalance: giftCardData.amount,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(dataAsExpected => {
|
.then(dataAsExpected => {
|
||||||
expect(dataAsExpected).to.be.true;
|
expect(dataAsExpected).to.be.true;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -127,13 +127,13 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
isGiftCardDataAsExpected({
|
isGiftCardDataAsExpected({
|
||||||
giftCardId: giftCard.id,
|
giftCardId: giftCard.id,
|
||||||
expectedAmount: giftCardData.amount
|
expectedAmount: giftCardData.amount,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(dataAsExpected => {
|
.then(dataAsExpected => {
|
||||||
expect(dataAsExpected).to.be.true;
|
expect(dataAsExpected).to.be.true;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -149,14 +149,14 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
createGiftCard({
|
createGiftCard({
|
||||||
tag: firstGiftCardName,
|
tag: firstGiftCardName,
|
||||||
amount,
|
amount,
|
||||||
currency: "USD"
|
currency: "USD",
|
||||||
})
|
})
|
||||||
.then(giftCard => {
|
.then(giftCard => {
|
||||||
firstGiftCard = giftCard;
|
firstGiftCard = giftCard;
|
||||||
createGiftCard({
|
createGiftCard({
|
||||||
tag: secondGiftCardName,
|
tag: secondGiftCardName,
|
||||||
amount,
|
amount,
|
||||||
currency: "USD"
|
currency: "USD",
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(giftCard => {
|
.then(giftCard => {
|
||||||
|
@ -180,14 +180,14 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
isGiftCardDataAsExpected({
|
isGiftCardDataAsExpected({
|
||||||
giftCardId: firstGiftCard.id,
|
giftCardId: firstGiftCard.id,
|
||||||
expectedAmount: amount
|
expectedAmount: amount,
|
||||||
}).then(dataAsExpected => expect(dataAsExpected).to.be.true);
|
}).then(dataAsExpected => expect(dataAsExpected).to.be.true);
|
||||||
isGiftCardDataAsExpected({
|
isGiftCardDataAsExpected({
|
||||||
giftCardId: secondGiftCard.id,
|
giftCardId: secondGiftCard.id,
|
||||||
expectedAmount: amount
|
expectedAmount: amount,
|
||||||
}).then(dataAsExpected => expect(dataAsExpected).to.be.true);
|
}).then(dataAsExpected => expect(dataAsExpected).to.be.true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -205,7 +205,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
tag: firstGiftCardName,
|
tag: firstGiftCardName,
|
||||||
amount,
|
amount,
|
||||||
currency: "USD",
|
currency: "USD",
|
||||||
isActive: false
|
isActive: false,
|
||||||
})
|
})
|
||||||
.then(giftCard => {
|
.then(giftCard => {
|
||||||
firstGiftCard = giftCard;
|
firstGiftCard = giftCard;
|
||||||
|
@ -213,7 +213,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
tag: secondGiftCardName,
|
tag: secondGiftCardName,
|
||||||
amount,
|
amount,
|
||||||
currency: "USD",
|
currency: "USD",
|
||||||
isActive: false
|
isActive: false,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(giftCard => {
|
.then(giftCard => {
|
||||||
|
@ -230,7 +230,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
expectedAmount: 0,
|
expectedAmount: 0,
|
||||||
initialAmount: amount,
|
initialAmount: amount,
|
||||||
dataForCheckout,
|
dataForCheckout,
|
||||||
expectedOrderPrice
|
expectedOrderPrice,
|
||||||
}).then(isDataAsExpected => expect(isDataAsExpected).to.be.true);
|
}).then(isDataAsExpected => expect(isDataAsExpected).to.be.true);
|
||||||
dataForCheckout.voucherCode = secondGiftCard.code;
|
dataForCheckout.voucherCode = secondGiftCard.code;
|
||||||
purchaseProductWithActiveGiftCard({
|
purchaseProductWithActiveGiftCard({
|
||||||
|
@ -238,9 +238,9 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
|
||||||
expectedAmount: 0,
|
expectedAmount: 0,
|
||||||
initialAmount: amount,
|
initialAmount: amount,
|
||||||
dataForCheckout,
|
dataForCheckout,
|
||||||
expectedOrderPrice
|
expectedOrderPrice,
|
||||||
}).then(isDataAsExpected => expect(isDataAsExpected).to.be.true);
|
}).then(isDataAsExpected => expect(isDataAsExpected).to.be.true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
openAndFillUpCreateGiftCardDialog,
|
openAndFillUpCreateGiftCardDialog,
|
||||||
saveGiftCard,
|
saveGiftCard,
|
||||||
setExpiryDate,
|
setExpiryDate,
|
||||||
setExpiryPeriod
|
setExpiryPeriod,
|
||||||
} from "../../../support/pages/catalog/giftCardPage";
|
} from "../../../support/pages/catalog/giftCardPage";
|
||||||
|
|
||||||
describe("As an admin I want to create gift card", () => {
|
describe("As an admin I want to create gift card", () => {
|
||||||
|
@ -40,7 +40,7 @@ describe("As an admin I want to create gift card", () => {
|
||||||
note: name,
|
note: name,
|
||||||
tag: name,
|
tag: name,
|
||||||
amount,
|
amount,
|
||||||
currency
|
currency,
|
||||||
});
|
});
|
||||||
saveGiftCard()
|
saveGiftCard()
|
||||||
.then(giftCardResp => {
|
.then(giftCardResp => {
|
||||||
|
@ -52,7 +52,7 @@ describe("As an admin I want to create gift card", () => {
|
||||||
expect(giftCardsResp[0].node.initialBalance.amount).to.eq(amount);
|
expect(giftCardsResp[0].node.initialBalance.amount).to.eq(amount);
|
||||||
expect(giftCardsResp[0].node.initialBalance.currency).to.eq(currency);
|
expect(giftCardsResp[0].node.initialBalance.currency).to.eq(currency);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -67,7 +67,7 @@ describe("As an admin I want to create gift card", () => {
|
||||||
note: name,
|
note: name,
|
||||||
tag: name,
|
tag: name,
|
||||||
amount,
|
amount,
|
||||||
currency
|
currency,
|
||||||
});
|
});
|
||||||
setExpiryPeriod(2, expiryPeriods.MONTH);
|
setExpiryPeriod(2, expiryPeriods.MONTH);
|
||||||
saveGiftCard()
|
saveGiftCard()
|
||||||
|
@ -81,7 +81,7 @@ describe("As an admin I want to create gift card", () => {
|
||||||
expect(giftCardsResp[0].node.initialBalance.currency).to.eq(currency);
|
expect(giftCardsResp[0].node.initialBalance.currency).to.eq(currency);
|
||||||
expect(giftCardsResp[0].node.expiryDate).to.eq(expectedExpiryDate);
|
expect(giftCardsResp[0].node.expiryDate).to.eq(expectedExpiryDate);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -96,7 +96,7 @@ describe("As an admin I want to create gift card", () => {
|
||||||
note: name,
|
note: name,
|
||||||
tag: name,
|
tag: name,
|
||||||
amount,
|
amount,
|
||||||
currency
|
currency,
|
||||||
});
|
});
|
||||||
setExpiryDate(date);
|
setExpiryDate(date);
|
||||||
saveGiftCard()
|
saveGiftCard()
|
||||||
|
@ -110,6 +110,6 @@ describe("As an admin I want to create gift card", () => {
|
||||||
expect(giftCardsResp[0].node.initialBalance.currency).to.eq(currency);
|
expect(giftCardsResp[0].node.initialBalance.currency).to.eq(currency);
|
||||||
expect(giftCardsResp[0].node.expiryDate).to.eq(date);
|
expect(giftCardsResp[0].node.expiryDate).to.eq(date);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersU
|
||||||
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../../support/api/utils/shippingUtils";
|
} from "../../../support/api/utils/shippingUtils";
|
||||||
|
|
||||||
describe("As a customer I should be able to purchase gift card as a product", () => {
|
describe("As a customer I should be able to purchase gift card as a product", () => {
|
||||||
|
@ -25,7 +25,7 @@ describe("As a customer I should be able to purchase gift card as a product", ()
|
||||||
let address;
|
let address;
|
||||||
const giftCardData = {
|
const giftCardData = {
|
||||||
amount: 150,
|
amount: 150,
|
||||||
currency: "USD"
|
currency: "USD",
|
||||||
};
|
};
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
|
@ -43,14 +43,14 @@ describe("As a customer I should be able to purchase gift card as a product", ()
|
||||||
({
|
({
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
|
|
||||||
channelsUtils.getDefaultChannel();
|
channelsUtils.getDefaultChannel();
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
|
@ -62,7 +62,7 @@ describe("As a customer I should be able to purchase gift card as a product", ()
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address,
|
address,
|
||||||
price: shippingPrice
|
price: shippingPrice,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ shippingMethod: shippingMethodResp, warehouse: warehouse }) => {
|
.then(({ shippingMethod: shippingMethodResp, warehouse: warehouse }) => {
|
||||||
|
@ -74,7 +74,7 @@ describe("As a customer I should be able to purchase gift card as a product", ()
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: productPrice
|
price: productPrice,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ variantsList: variantsResp }) => {
|
.then(({ variantsList: variantsResp }) => {
|
||||||
|
@ -97,10 +97,10 @@ describe("As a customer I should be able to purchase gift card as a product", ()
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email,
|
email,
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
variantsList: variants
|
variantsList: variants,
|
||||||
}).then(({ order }) => {
|
}).then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||||
import { giftCardDetailsUrl } from "../../../fixtures/urlList";
|
import { giftCardDetailsUrl } from "../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createGiftCard,
|
createGiftCard,
|
||||||
getGiftCardWithId
|
getGiftCardWithId,
|
||||||
} from "../../../support/api/requests/GiftCard";
|
} from "../../../support/api/requests/GiftCard";
|
||||||
import { deleteGiftCardsWithTagStartsWith } from "../../../support/api/utils/catalog/giftCardUtils";
|
import { deleteGiftCardsWithTagStartsWith } from "../../../support/api/utils/catalog/giftCardUtils";
|
||||||
import { formatDate } from "../../../support/formatData/formatDate";
|
import { formatDate } from "../../../support/formatData/formatDate";
|
||||||
|
@ -34,7 +34,7 @@ describe("As an admin I want to update gift card", () => {
|
||||||
createGiftCard({
|
createGiftCard({
|
||||||
tag: name,
|
tag: name,
|
||||||
amount: 10,
|
amount: 10,
|
||||||
currency: "USD"
|
currency: "USD",
|
||||||
}).then(giftCard => {
|
}).then(giftCard => {
|
||||||
cy.visit(giftCardDetailsUrl(giftCard.id))
|
cy.visit(giftCardDetailsUrl(giftCard.id))
|
||||||
.get(BUTTON_SELECTORS.deleteButton)
|
.get(BUTTON_SELECTORS.deleteButton)
|
||||||
|
@ -47,7 +47,7 @@ describe("As an admin I want to update gift card", () => {
|
||||||
.waitForRequestAndCheckIfNoErrors("@DeleteGiftCard");
|
.waitForRequestAndCheckIfNoErrors("@DeleteGiftCard");
|
||||||
getGiftCardWithId(giftCard.id).should("be.null");
|
getGiftCardWithId(giftCard.id).should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -61,7 +61,7 @@ describe("As an admin I want to update gift card", () => {
|
||||||
createGiftCard({
|
createGiftCard({
|
||||||
tag: name,
|
tag: name,
|
||||||
amount: 10,
|
amount: 10,
|
||||||
currency: "USD"
|
currency: "USD",
|
||||||
})
|
})
|
||||||
.then(giftCard => {
|
.then(giftCard => {
|
||||||
cy.visit(giftCardDetailsUrl(giftCard.id))
|
cy.visit(giftCardDetailsUrl(giftCard.id))
|
||||||
|
@ -86,10 +86,10 @@ describe("As an admin I want to update gift card", () => {
|
||||||
})
|
})
|
||||||
.then(giftCard => {
|
.then(giftCard => {
|
||||||
expect(giftCard.tags[0].name.toLowerCase()).to.eq(
|
expect(giftCard.tags[0].name.toLowerCase()).to.eq(
|
||||||
updatedName.toLowerCase()
|
updatedName.toLowerCase(),
|
||||||
);
|
);
|
||||||
expect(giftCard.expiryDate).to.eq(date);
|
expect(giftCard.expiryDate).to.eq(date);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { WAREHOUSES_DETAILS } from "../../elements/warehouses/warehouse-details"
|
||||||
import {
|
import {
|
||||||
completeCheckout,
|
completeCheckout,
|
||||||
createCheckout,
|
createCheckout,
|
||||||
deliveryMethodUpdate
|
deliveryMethodUpdate,
|
||||||
} from "../../support/api/requests/Checkout";
|
} from "../../support/api/requests/Checkout";
|
||||||
import { getOrder } from "../../support/api/requests/Order";
|
import { getOrder } from "../../support/api/requests/Order";
|
||||||
import { updateWarehouse } from "../../support/api/requests/Warehouse";
|
import { updateWarehouse } from "../../support/api/requests/Warehouse";
|
||||||
|
@ -16,17 +16,17 @@ import { addPayment } from "../../support/api/utils/ordersUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../support/api/utils/products/productsUtils";
|
} from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
import {
|
import {
|
||||||
createWarehouse,
|
createWarehouse,
|
||||||
pickupOptions,
|
pickupOptions,
|
||||||
visitAndEnablePickup,
|
visitAndEnablePickup,
|
||||||
visitSetPublicStockAndEnablePickup
|
visitSetPublicStockAndEnablePickup,
|
||||||
} from "../../support/pages/warehousePage";
|
} from "../../support/pages/warehousePage";
|
||||||
|
|
||||||
describe("Warehouses in checkout", () => {
|
describe("Warehouses in checkout", () => {
|
||||||
|
@ -60,18 +60,18 @@ describe("Warehouses in checkout", () => {
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
quantityInWarehouse: 100
|
quantityInWarehouse: 100,
|
||||||
};
|
};
|
||||||
checkoutData = {
|
checkoutData = {
|
||||||
returnAvailableCollectionPoints: true,
|
returnAvailableCollectionPoints: true,
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
address: secondUsAddress
|
address: secondUsAddress,
|
||||||
};
|
};
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name: startsWith,
|
name: startsWith,
|
||||||
address: secondUsAddress
|
address: secondUsAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
|
@ -99,7 +99,7 @@ describe("Warehouses in checkout", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address: secondUsAddress
|
address: secondUsAddress,
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
|
@ -110,20 +110,20 @@ describe("Warehouses in checkout", () => {
|
||||||
})
|
})
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
checkoutData.variantsList = variantsList.concat(
|
checkoutData.variantsList = variantsList.concat(
|
||||||
variantsInOtherWarehouse
|
variantsInOtherWarehouse,
|
||||||
);
|
);
|
||||||
createCheckout(checkoutData);
|
createCheckout(checkoutData);
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
const clickAndCollectOption = checkout.availableCollectionPoints.find(
|
const clickAndCollectOption = checkout.availableCollectionPoints.find(
|
||||||
element => element.id === warehouse.id
|
element => element.id === warehouse.id,
|
||||||
);
|
);
|
||||||
expect(clickAndCollectOption.clickAndCollectOption).to.eq("ALL");
|
expect(clickAndCollectOption.clickAndCollectOption).to.eq("ALL");
|
||||||
expect(clickAndCollectOption.id).to.eq(warehouse.id);
|
expect(clickAndCollectOption.id).to.eq(warehouse.id);
|
||||||
expect(clickAndCollectOption.isPrivate).to.eq(true);
|
expect(clickAndCollectOption.isPrivate).to.eq(true);
|
||||||
expect(clickAndCollectOption.name).to.eq(warehouse.name);
|
expect(clickAndCollectOption.name).to.eq(warehouse.name);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -136,7 +136,7 @@ describe("Warehouses in checkout", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address: secondUsAddress
|
address: secondUsAddress,
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
|
@ -147,20 +147,20 @@ describe("Warehouses in checkout", () => {
|
||||||
})
|
})
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
checkoutData.variantsList = variantsList.concat(
|
checkoutData.variantsList = variantsList.concat(
|
||||||
variantsInOtherWarehouse
|
variantsInOtherWarehouse,
|
||||||
);
|
);
|
||||||
createCheckout(checkoutData);
|
createCheckout(checkoutData);
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
const clickAndCollectOption = checkout.availableCollectionPoints.find(
|
const clickAndCollectOption = checkout.availableCollectionPoints.find(
|
||||||
element => element.id === warehouse.id
|
element => element.id === warehouse.id,
|
||||||
);
|
);
|
||||||
expect(clickAndCollectOption.clickAndCollectOption).to.eq("ALL");
|
expect(clickAndCollectOption.clickAndCollectOption).to.eq("ALL");
|
||||||
expect(clickAndCollectOption.id).to.eq(warehouse.id);
|
expect(clickAndCollectOption.id).to.eq(warehouse.id);
|
||||||
expect(clickAndCollectOption.isPrivate).to.eq(false);
|
expect(clickAndCollectOption.isPrivate).to.eq(false);
|
||||||
expect(clickAndCollectOption.name).to.eq(warehouse.name);
|
expect(clickAndCollectOption.name).to.eq(warehouse.name);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -174,7 +174,7 @@ describe("Warehouses in checkout", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address: secondUsAddress
|
address: secondUsAddress,
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
|
@ -186,14 +186,14 @@ describe("Warehouses in checkout", () => {
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
variantsInLocalStock = variantsList;
|
variantsInLocalStock = variantsList;
|
||||||
checkoutData.variantsList = variantsInLocalStock.concat(
|
checkoutData.variantsList = variantsInLocalStock.concat(
|
||||||
variantsInOtherWarehouse
|
variantsInOtherWarehouse,
|
||||||
);
|
);
|
||||||
createCheckout(checkoutData);
|
createCheckout(checkoutData);
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
expect(checkout.availableCollectionPoints).to.have.length(
|
expect(checkout.availableCollectionPoints).to.have.length(
|
||||||
1,
|
1,
|
||||||
"there should be no available collection point for local stock"
|
"there should be no available collection point for local stock",
|
||||||
);
|
);
|
||||||
checkoutData.variantsList = variantsInLocalStock;
|
checkoutData.variantsList = variantsInLocalStock;
|
||||||
createCheckout(checkoutData);
|
createCheckout(checkoutData);
|
||||||
|
@ -205,7 +205,7 @@ describe("Warehouses in checkout", () => {
|
||||||
expect(clickAndCollectOption.isPrivate).to.eq(false);
|
expect(clickAndCollectOption.isPrivate).to.eq(false);
|
||||||
expect(clickAndCollectOption.name).to.eq(warehouse.name);
|
expect(clickAndCollectOption.name).to.eq(warehouse.name);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -215,9 +215,9 @@ describe("Warehouses in checkout", () => {
|
||||||
const name = `${startsWith}${faker.datatype.number()}`;
|
const name = `${startsWith}${faker.datatype.number()}`;
|
||||||
createWarehouse({ name, address: usAddress });
|
createWarehouse({ name, address: usAddress });
|
||||||
cy.get(WAREHOUSES_DETAILS.clickAndCollectLocalStockRadioButton).should(
|
cy.get(WAREHOUSES_DETAILS.clickAndCollectLocalStockRadioButton).should(
|
||||||
"not.exist"
|
"not.exist",
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -245,6 +245,6 @@ describe("Warehouses in checkout", () => {
|
||||||
cy.expectCorrectBasicAddress(order.shippingAddress, secondUsAddress);
|
cy.expectCorrectBasicAddress(order.shippingAddress, secondUsAddress);
|
||||||
cy.expectCorrectBasicAddress(order.billingAddress, usAddress);
|
cy.expectCorrectBasicAddress(order.billingAddress, usAddress);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,17 +7,17 @@ import { createChannel } from "../../support/api/requests/Channels";
|
||||||
import {
|
import {
|
||||||
addProductsToCheckout,
|
addProductsToCheckout,
|
||||||
addShippingMethod,
|
addShippingMethod,
|
||||||
createCheckout
|
createCheckout,
|
||||||
} from "../../support/api/requests/Checkout";
|
} from "../../support/api/requests/Checkout";
|
||||||
import { deleteChannelsStartsWith } from "../../support/api/utils/channelsUtils";
|
import { deleteChannelsStartsWith } from "../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../support/api/utils/products/productsUtils";
|
} from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
|
|
||||||
describe("Products without shipment option", () => {
|
describe("Products without shipment option", () => {
|
||||||
|
@ -40,7 +40,7 @@ describe("Products without shipment option", () => {
|
||||||
deleteChannelsStartsWith(startsWith);
|
deleteChannelsStartsWith(startsWith);
|
||||||
|
|
||||||
createChannel({
|
createChannel({
|
||||||
name
|
name,
|
||||||
})
|
})
|
||||||
.then(channelResp => {
|
.then(channelResp => {
|
||||||
channel = channelResp;
|
channel = channelResp;
|
||||||
|
@ -52,7 +52,7 @@ describe("Products without shipment option", () => {
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
name,
|
name,
|
||||||
address,
|
address,
|
||||||
minProductPrice: 100
|
minProductPrice: 100,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
|
@ -60,13 +60,13 @@ describe("Products without shipment option", () => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
createTypeAttributeAndCategoryForProduct({ name });
|
createTypeAttributeAndCategoryForProduct({ name });
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
createProductInChannel({
|
createProductInChannel({
|
||||||
attributeId: attributeResp.id,
|
attributeId: attributeResp.id,
|
||||||
|
@ -74,7 +74,7 @@ describe("Products without shipment option", () => {
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
name,
|
name,
|
||||||
productTypeId: productTypeResp.id,
|
productTypeId: productTypeResp.id,
|
||||||
warehouseId: warehouse.id
|
warehouseId: warehouse.id,
|
||||||
}).then(({ variantsList }) => (productWithShipping = variantsList));
|
}).then(({ variantsList }) => (productWithShipping = variantsList));
|
||||||
createProductInChannel({
|
createProductInChannel({
|
||||||
attributeId: attributeResp.id,
|
attributeId: attributeResp.id,
|
||||||
|
@ -82,11 +82,11 @@ describe("Products without shipment option", () => {
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
name: nameProdWithoutShipping,
|
name: nameProdWithoutShipping,
|
||||||
productTypeId: productTypeResp.id,
|
productTypeId: productTypeResp.id,
|
||||||
warehouseId: warehouse.id
|
warehouseId: warehouse.id,
|
||||||
}).then(
|
}).then(
|
||||||
({ variantsList }) => (productWithoutShipping = variantsList)
|
({ variantsList }) => (productWithoutShipping = variantsList),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -99,27 +99,27 @@ describe("Products without shipment option", () => {
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList: productWithoutShipping,
|
variantsList: productWithoutShipping,
|
||||||
address,
|
address,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
expect(
|
expect(
|
||||||
checkout.shippingMethods,
|
checkout.shippingMethods,
|
||||||
"expect no available shipping"
|
"expect no available shipping",
|
||||||
).to.have.length(0);
|
).to.have.length(0);
|
||||||
addProductsToCheckout(checkout.id, productWithShipping, 1);
|
addProductsToCheckout(checkout.id, productWithShipping, 1);
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
expect(
|
expect(
|
||||||
checkout.shippingMethods,
|
checkout.shippingMethods,
|
||||||
"expect no available shipping"
|
"expect no available shipping",
|
||||||
).to.have.length(0);
|
).to.have.length(0);
|
||||||
addShippingMethod(checkout.id, shippingMethod.id);
|
addShippingMethod(checkout.id, shippingMethod.id);
|
||||||
})
|
})
|
||||||
.then(({ errors }) => {
|
.then(({ errors }) => {
|
||||||
expect(errors[0].field, "expect error in shipping method").to.be.eq(
|
expect(errors[0].field, "expect error in shipping method").to.be.eq(
|
||||||
"shippingMethodId"
|
"shippingMethodId",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
checkoutShippingAddressUpdate,
|
checkoutShippingAddressUpdate,
|
||||||
checkoutVariantsUpdate,
|
checkoutVariantsUpdate,
|
||||||
completeCheckout,
|
completeCheckout,
|
||||||
createCheckout
|
createCheckout,
|
||||||
} from "../../support/api/requests/Checkout";
|
} from "../../support/api/requests/Checkout";
|
||||||
import { getOrder } from "../../support/api/requests/Order";
|
import { getOrder } from "../../support/api/requests/Order";
|
||||||
import {
|
import {
|
||||||
|
@ -15,7 +15,7 @@ import {
|
||||||
createAndCompleteCheckoutWithoutShipping,
|
createAndCompleteCheckoutWithoutShipping,
|
||||||
createWaitingForCaptureOrder,
|
createWaitingForCaptureOrder,
|
||||||
getShippingMethodIdFromCheckout,
|
getShippingMethodIdFromCheckout,
|
||||||
updateShippingInCheckout
|
updateShippingInCheckout,
|
||||||
} from "../../support/api/utils/ordersUtils";
|
} from "../../support/api/utils/ordersUtils";
|
||||||
import { createDigitalAndPhysicalProductWithNewDataAndDefaultChannel } from "../../support/api/utils/products/productsUtils";
|
import { createDigitalAndPhysicalProductWithNewDataAndDefaultChannel } from "../../support/api/utils/products/productsUtils";
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
|
||||||
physicalProductName: physicalName,
|
physicalProductName: physicalName,
|
||||||
digitalProductName: digitalName
|
digitalProductName: digitalName,
|
||||||
}).then(resp => {
|
}).then(resp => {
|
||||||
defaultChannel = resp.defaultChannel;
|
defaultChannel = resp.defaultChannel;
|
||||||
address = resp.address;
|
address = resp.address;
|
||||||
|
@ -55,7 +55,7 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
email,
|
email,
|
||||||
billingAddress: address,
|
billingAddress: address,
|
||||||
variantsList: digitalVariants,
|
variantsList: digitalVariants,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
})
|
})
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
getOrder(order.id);
|
getOrder(order.id);
|
||||||
|
@ -63,11 +63,11 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
.then(order => {
|
.then(order => {
|
||||||
expect(
|
expect(
|
||||||
order.isShippingRequired,
|
order.isShippingRequired,
|
||||||
"Check if is shipping required in order"
|
"Check if is shipping required in order",
|
||||||
).to.eq(false);
|
).to.eq(false);
|
||||||
expect(order.status, testsMessage).to.be.eq("UNFULFILLED");
|
expect(order.status, testsMessage).to.be.eq("UNFULFILLED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -79,7 +79,7 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
email,
|
email,
|
||||||
variantsList: physicalVariants,
|
variantsList: physicalVariants,
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
address
|
address,
|
||||||
})
|
})
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
getOrder(order.id);
|
getOrder(order.id);
|
||||||
|
@ -87,11 +87,11 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
.then(order => {
|
.then(order => {
|
||||||
expect(
|
expect(
|
||||||
order.isShippingRequired,
|
order.isShippingRequired,
|
||||||
"Check if is shipping required in order"
|
"Check if is shipping required in order",
|
||||||
).to.eq(true);
|
).to.eq(true);
|
||||||
expect(order.status, testsMessage).to.be.eq("UNFULFILLED");
|
expect(order.status, testsMessage).to.be.eq("UNFULFILLED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -105,7 +105,7 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
email,
|
email,
|
||||||
variantsList: digitalVariants,
|
variantsList: digitalVariants,
|
||||||
billingAddress: address,
|
billingAddress: address,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
})
|
})
|
||||||
.then(({ checkout: checkoutResp }) => {
|
.then(({ checkout: checkoutResp }) => {
|
||||||
checkout = checkoutResp;
|
checkout = checkoutResp;
|
||||||
|
@ -117,11 +117,11 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
.then(() => {
|
.then(() => {
|
||||||
const shippingMethodId = getShippingMethodIdFromCheckout(
|
const shippingMethodId = getShippingMethodIdFromCheckout(
|
||||||
checkout,
|
checkout,
|
||||||
shippingMethod.name
|
shippingMethod.name,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
shippingMethodId,
|
shippingMethodId,
|
||||||
"Should be not possible to add shipping method without shipping address"
|
"Should be not possible to add shipping method without shipping address",
|
||||||
).to.not.be.ok;
|
).to.not.be.ok;
|
||||||
checkoutShippingAddressUpdate(checkout.id, address);
|
checkoutShippingAddressUpdate(checkout.id, address);
|
||||||
})
|
})
|
||||||
|
@ -131,7 +131,7 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
.then(({ errors }) => {
|
.then(({ errors }) => {
|
||||||
expect(
|
expect(
|
||||||
errors,
|
errors,
|
||||||
"Should be not possible to add payment without shipping"
|
"Should be not possible to add payment without shipping",
|
||||||
).to.have.lengthOf(1);
|
).to.have.lengthOf(1);
|
||||||
updateShippingInCheckout(checkout.token, shippingMethod.name);
|
updateShippingInCheckout(checkout.token, shippingMethod.name);
|
||||||
})
|
})
|
||||||
|
@ -147,10 +147,10 @@ describe("As an unlogged customer I want to order physical and digital products"
|
||||||
.then(order => {
|
.then(order => {
|
||||||
expect(
|
expect(
|
||||||
order.isShippingRequired,
|
order.isShippingRequired,
|
||||||
"Check if is shipping required in order"
|
"Check if is shipping required in order",
|
||||||
).to.eq(true);
|
).to.eq(true);
|
||||||
expect(order.status, testsMessage).to.be.eq("UNFULFILLED");
|
expect(order.status, testsMessage).to.be.eq("UNFULFILLED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ import faker from "faker";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
addProductsToCheckout,
|
addProductsToCheckout,
|
||||||
createCheckout
|
createCheckout,
|
||||||
} from "../../support/api/requests/Checkout";
|
} from "../../support/api/requests/Checkout";
|
||||||
import { getVariants } from "../../support/api/requests/Product";
|
import { getVariants } from "../../support/api/requests/Product";
|
||||||
import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils";
|
import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils";
|
||||||
|
@ -29,18 +29,18 @@ describe("Manage products stocks in checkout", () => {
|
||||||
{
|
{
|
||||||
name: "variantsWithLowStock",
|
name: "variantsWithLowStock",
|
||||||
trackInventory: true,
|
trackInventory: true,
|
||||||
quantityInWarehouse: 1
|
quantityInWarehouse: 1,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "variantsWithoutTrackInventory",
|
name: "variantsWithoutTrackInventory",
|
||||||
trackInventory: false,
|
trackInventory: false,
|
||||||
quantityInWarehouse: 0
|
quantityInWarehouse: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "lastVariantInStock",
|
name: "lastVariantInStock",
|
||||||
trackInventory: true,
|
trackInventory: true,
|
||||||
quantityInWarehouse: 1
|
quantityInWarehouse: 1,
|
||||||
}
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
createNewProductWithSeveralVariants(name, variantsData).then(resp => {
|
createNewProductWithSeveralVariants(name, variantsData).then(resp => {
|
||||||
|
@ -48,13 +48,13 @@ describe("Manage products stocks in checkout", () => {
|
||||||
address = resp.address;
|
address = resp.address;
|
||||||
shippingMethod = resp.shippingMethod;
|
shippingMethod = resp.shippingMethod;
|
||||||
variantsWithLowStock = resp.createdVariants.find(
|
variantsWithLowStock = resp.createdVariants.find(
|
||||||
variant => variant.name === "variantsWithLowStock"
|
variant => variant.name === "variantsWithLowStock",
|
||||||
);
|
);
|
||||||
variantsWithoutTrackInventory = resp.createdVariants.find(
|
variantsWithoutTrackInventory = resp.createdVariants.find(
|
||||||
variant => variant.name === "variantsWithoutTrackInventory"
|
variant => variant.name === "variantsWithoutTrackInventory",
|
||||||
);
|
);
|
||||||
lastVariantInStock = resp.createdVariants.find(
|
lastVariantInStock = resp.createdVariants.find(
|
||||||
variant => variant.name === "lastVariantInStock"
|
variant => variant.name === "lastVariantInStock",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -69,7 +69,7 @@ describe("Manage products stocks in checkout", () => {
|
||||||
billingAddress: address,
|
billingAddress: address,
|
||||||
email: "email@example.com",
|
email: "email@example.com",
|
||||||
variantsList: [variantsWithLowStock],
|
variantsList: [variantsWithLowStock],
|
||||||
auth: "token"
|
auth: "token",
|
||||||
})
|
})
|
||||||
.then(({ checkout: checkout }) => {
|
.then(({ checkout: checkout }) => {
|
||||||
addProductsToCheckout(checkout.id, [variantsWithLowStock], 2);
|
addProductsToCheckout(checkout.id, [variantsWithLowStock], 2);
|
||||||
|
@ -77,10 +77,10 @@ describe("Manage products stocks in checkout", () => {
|
||||||
.then(({ errors }) => {
|
.then(({ errors }) => {
|
||||||
expect(
|
expect(
|
||||||
errors[0],
|
errors[0],
|
||||||
"should return error on field quantity"
|
"should return error on field quantity",
|
||||||
).to.have.property("field", "quantity");
|
).to.have.property("field", "quantity");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -92,11 +92,11 @@ describe("Manage products stocks in checkout", () => {
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
variantsList: [variantsWithoutTrackInventory]
|
variantsList: [variantsWithoutTrackInventory],
|
||||||
}).then(({ order }) => {
|
}).then(({ order }) => {
|
||||||
expect(order, "order should be created").to.be.ok;
|
expect(order, "order should be created").to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -108,7 +108,7 @@ describe("Manage products stocks in checkout", () => {
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
variantsList: [lastVariantInStock]
|
variantsList: [lastVariantInStock],
|
||||||
})
|
})
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order, "order should be created").to.be.ok;
|
expect(order, "order should be created").to.be.ok;
|
||||||
|
@ -119,6 +119,6 @@ describe("Manage products stocks in checkout", () => {
|
||||||
expect(variant.node.stocks[0].quantityAllocated).to.eq(1);
|
expect(variant.node.stocks[0].quantityAllocated).to.eq(1);
|
||||||
expect(variant.node.stocks[0].quantity).to.eq(1);
|
expect(variant.node.stocks[0].quantity).to.eq(1);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,11 +8,11 @@ import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../support/api/utils/products/productsUtils";
|
} from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
|
|
||||||
describe("Warehouses in checkout", () => {
|
describe("Warehouses in checkout", () => {
|
||||||
|
@ -41,7 +41,7 @@ describe("Warehouses in checkout", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address: usAddress
|
address: usAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
|
@ -56,7 +56,7 @@ describe("Warehouses in checkout", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
quantityInWarehouse: 100
|
quantityInWarehouse: 100,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
|
@ -64,12 +64,12 @@ describe("Warehouses in checkout", () => {
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList,
|
variantsList,
|
||||||
address: plAddress
|
address: plAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ errors }) => {
|
.then(({ errors }) => {
|
||||||
expect(errors[0]).to.have.property("field", "quantity");
|
expect(errors[0]).to.have.property("field", "quantity");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { getVariant } from "../../../support/api/requests/Product";
|
||||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannelWithoutVariants,
|
createProductInChannelWithoutVariants,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
import { createProductTypeWithNewVariantSelectionAttribute } from "../../../support/api/utils/productTypeUtils";
|
import { createProductTypeWithNewVariantSelectionAttribute } from "../../../support/api/utils/productTypeUtils";
|
||||||
import { fillUpVariantDetails } from "../../../support/pages/catalog/products/VariantsPage";
|
import { fillUpVariantDetails } from "../../../support/pages/catalog/products/VariantsPage";
|
||||||
|
@ -22,7 +22,7 @@ describe("As an admin I want to use attributes in variant selection", () => {
|
||||||
{ key: "MULTISELECT", TC: "SALEOR_0535" },
|
{ key: "MULTISELECT", TC: "SALEOR_0535" },
|
||||||
{ key: "BOOLEAN", TC: "SALEOR_0536" },
|
{ key: "BOOLEAN", TC: "SALEOR_0536" },
|
||||||
{ key: "NUMERIC", TC: "SALEOR_0537" },
|
{ key: "NUMERIC", TC: "SALEOR_0537" },
|
||||||
{ key: "SWATCH", TC: "SALEOR_0538" }
|
{ key: "SWATCH", TC: "SALEOR_0538" },
|
||||||
];
|
];
|
||||||
let channel;
|
let channel;
|
||||||
let category;
|
let category;
|
||||||
|
@ -33,7 +33,7 @@ describe("As an admin I want to use attributes in variant selection", () => {
|
||||||
deleteProductsStartsWith(startsWith);
|
deleteProductsStartsWith(startsWith);
|
||||||
getDefaultChannel().then(defaultChannel => (channel = defaultChannel));
|
getDefaultChannel().then(defaultChannel => (channel = defaultChannel));
|
||||||
createCategory({ name: startsWith }).then(
|
createCategory({ name: startsWith }).then(
|
||||||
categoryResp => (category = categoryResp)
|
categoryResp => (category = categoryResp),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ describe("As an admin I want to use attributes in variant selection", () => {
|
||||||
createProductTypeWithNewVariantSelectionAttribute({
|
createProductTypeWithNewVariantSelectionAttribute({
|
||||||
name,
|
name,
|
||||||
inputType,
|
inputType,
|
||||||
attributeValues
|
attributeValues,
|
||||||
})
|
})
|
||||||
.then(({ productType: productTypeResp }) => {
|
.then(({ productType: productTypeResp }) => {
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
|
@ -65,20 +65,20 @@ describe("As an admin I want to use attributes in variant selection", () => {
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
name,
|
name,
|
||||||
channelId: channel.id
|
channelId: channel.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(productResp => {
|
.then(productResp => {
|
||||||
product = productResp;
|
product = productResp;
|
||||||
|
|
||||||
cy.visit(addVariantUrl(product.id)).addAliasToGraphRequest(
|
cy.visit(addVariantUrl(product.id)).addAliasToGraphRequest(
|
||||||
"VariantCreate"
|
"VariantCreate",
|
||||||
);
|
);
|
||||||
|
|
||||||
fillUpVariantDetails({
|
fillUpVariantDetails({
|
||||||
sku: name,
|
sku: name,
|
||||||
attributeName: attributeValues[0],
|
attributeName: attributeValues[0],
|
||||||
attributeType: inputType
|
attributeType: inputType,
|
||||||
});
|
});
|
||||||
|
|
||||||
cy.wait("@VariantCreate");
|
cy.wait("@VariantCreate");
|
||||||
|
@ -92,7 +92,7 @@ describe("As an admin I want to use attributes in variant selection", () => {
|
||||||
expect(attributes[0].attribute.inputType).to.eq(inputType);
|
expect(attributes[0].attribute.inputType).to.eq(inputType);
|
||||||
cy.confirmationMessageShouldAppear();
|
cy.confirmationMessageShouldAppear();
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -20,26 +20,26 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
{ type: "RICH_TEXT", testCase: "SALEOR_0515" },
|
{ type: "RICH_TEXT", testCase: "SALEOR_0515" },
|
||||||
{ type: "BOOLEAN", testCase: "SALEOR_0516" },
|
{ type: "BOOLEAN", testCase: "SALEOR_0516" },
|
||||||
{ type: "DATE", testCase: "SALEOR_0527" },
|
{ type: "DATE", testCase: "SALEOR_0527" },
|
||||||
{ type: "DATE_TIME", testCase: "SALEOR_0528" }
|
{ type: "DATE_TIME", testCase: "SALEOR_0528" },
|
||||||
];
|
];
|
||||||
const attributeReferenceType = [
|
const attributeReferenceType = [
|
||||||
{ type: "PRODUCT", testCase: "SALEOR_0517" },
|
{ type: "PRODUCT", testCase: "SALEOR_0517" },
|
||||||
{ type: "PAGE", testCase: "SALEOR_0518" }
|
{ type: "PAGE", testCase: "SALEOR_0518" },
|
||||||
];
|
];
|
||||||
const attributeNumericType = [
|
const attributeNumericType = [
|
||||||
{
|
{
|
||||||
unitSystem: "IMPERIAL",
|
unitSystem: "IMPERIAL",
|
||||||
unitsOf: "DISTANCE",
|
unitsOf: "DISTANCE",
|
||||||
unit: "FT",
|
unit: "FT",
|
||||||
testCase: "SALEOR_0519"
|
testCase: "SALEOR_0519",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unitSystem: "METRIC",
|
unitSystem: "METRIC",
|
||||||
unitsOf: "VOLUME",
|
unitsOf: "VOLUME",
|
||||||
unit: "CUBIC_CENTIMETER",
|
unit: "CUBIC_CENTIMETER",
|
||||||
testCase: "SALEOR_0520"
|
testCase: "SALEOR_0520",
|
||||||
},
|
},
|
||||||
{ unitSystem: "without selecting unit", testCase: "SALEOR_0521" }
|
{ unitSystem: "without selecting unit", testCase: "SALEOR_0521" },
|
||||||
];
|
];
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
|
@ -65,7 +65,7 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
const attributeName = `${startsWith}${faker.datatype.number()}`;
|
const attributeName = `${startsWith}${faker.datatype.number()}`;
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType: attributeType.type
|
attributeType: attributeType.type,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -73,10 +73,10 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
.then(attribute => {
|
.then(attribute => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType: attributeType.type
|
attributeType: attributeType.type,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
entityType: entityType.type
|
entityType: entityType.type,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -99,10 +99,10 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
entityType: entityType.type
|
entityType: entityType.type,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
numericSystemType
|
numericSystemType,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -125,10 +125,10 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
unit: numericSystemType.unit
|
unit: numericSystemType.unit,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
valueRequired: false
|
valueRequired: false,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -150,9 +150,9 @@ describe("As an admin I want to create content attribute", () => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
valueRequired: false
|
valueRequired: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,13 +9,13 @@ import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||||
import { attributeDetailsUrl, urlList } from "../../../fixtures/urlList";
|
import { attributeDetailsUrl, urlList } from "../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createAttribute,
|
createAttribute,
|
||||||
getAttribute
|
getAttribute,
|
||||||
} from "../../../support/api/requests/Attribute";
|
} from "../../../support/api/requests/Attribute";
|
||||||
import { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils";
|
import { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils";
|
||||||
import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData";
|
import { expectCorrectDataInAttribute } from "../../../support/api/utils/attributes/checkAttributeData";
|
||||||
import {
|
import {
|
||||||
createAttributeWithInputType,
|
createAttributeWithInputType,
|
||||||
fillUpAttributeNameAndCode
|
fillUpAttributeNameAndCode,
|
||||||
} from "../../../support/pages/attributesPage";
|
} from "../../../support/pages/attributesPage";
|
||||||
|
|
||||||
describe("As an admin I want to create product attribute", () => {
|
describe("As an admin I want to create product attribute", () => {
|
||||||
|
@ -27,26 +27,26 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
{ type: "RICH_TEXT", testCase: "SALEOR_0504" },
|
{ type: "RICH_TEXT", testCase: "SALEOR_0504" },
|
||||||
{ type: "BOOLEAN", testCase: "SALEOR_0505" },
|
{ type: "BOOLEAN", testCase: "SALEOR_0505" },
|
||||||
{ type: "DATE", testCase: "SALEOR_0523" },
|
{ type: "DATE", testCase: "SALEOR_0523" },
|
||||||
{ type: "DATE_TIME", testCase: "SALEOR_0524" }
|
{ type: "DATE_TIME", testCase: "SALEOR_0524" },
|
||||||
];
|
];
|
||||||
const attributeReferenceType = [
|
const attributeReferenceType = [
|
||||||
{ type: "PRODUCT", testCase: "SALEOR_0506" },
|
{ type: "PRODUCT", testCase: "SALEOR_0506" },
|
||||||
{ type: "PAGE", testCase: "SALEOR_0507" }
|
{ type: "PAGE", testCase: "SALEOR_0507" },
|
||||||
];
|
];
|
||||||
const attributeNumericType = [
|
const attributeNumericType = [
|
||||||
{
|
{
|
||||||
unitSystem: "IMPERIAL",
|
unitSystem: "IMPERIAL",
|
||||||
unitsOf: "DISTANCE",
|
unitsOf: "DISTANCE",
|
||||||
unit: "FT",
|
unit: "FT",
|
||||||
testCase: "SALEOR_0508"
|
testCase: "SALEOR_0508",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
unitSystem: "METRIC",
|
unitSystem: "METRIC",
|
||||||
unitsOf: "VOLUME",
|
unitsOf: "VOLUME",
|
||||||
unit: "CUBIC_CENTIMETER",
|
unit: "CUBIC_CENTIMETER",
|
||||||
testCase: "SALEOR_0509"
|
testCase: "SALEOR_0509",
|
||||||
},
|
},
|
||||||
{ unitSystem: "without selecting unit", testCase: "SALEOR_0510" }
|
{ unitSystem: "without selecting unit", testCase: "SALEOR_0510" },
|
||||||
];
|
];
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
|
@ -71,7 +71,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
|
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType: attributeType.type
|
attributeType: attributeType.type,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -79,10 +79,10 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
.then(attribute => {
|
.then(attribute => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType: attributeType.type
|
attributeType: attributeType.type,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
entityType: entityType.type
|
entityType: entityType.type,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -106,10 +106,10 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
entityType: entityType.type
|
entityType: entityType.type,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
numericSystemType
|
numericSystemType,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -133,10 +133,10 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
unit: numericSystemType.unit
|
unit: numericSystemType.unit,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
valueRequired: false
|
valueRequired: false,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -159,10 +159,10 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
valueRequired: false
|
valueRequired: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -173,7 +173,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
const attributeName = `${startsWith}${faker.datatype.number()}`;
|
const attributeName = `${startsWith}${faker.datatype.number()}`;
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType
|
attributeType,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -182,10 +182,10 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
valueRequired: true
|
valueRequired: true,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -198,7 +198,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
createAttributeWithInputType({
|
createAttributeWithInputType({
|
||||||
name: attributeName,
|
name: attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
swatchImage
|
swatchImage,
|
||||||
})
|
})
|
||||||
.then(({ attribute }) => {
|
.then(({ attribute }) => {
|
||||||
getAttribute(attribute.id);
|
getAttribute(attribute.id);
|
||||||
|
@ -207,13 +207,13 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
expectCorrectDataInAttribute(attribute, {
|
expectCorrectDataInAttribute(attribute, {
|
||||||
attributeName,
|
attributeName,
|
||||||
attributeType,
|
attributeType,
|
||||||
valueRequired: true
|
valueRequired: true,
|
||||||
});
|
});
|
||||||
cy.get(ATTRIBUTES_DETAILS.swatchValueImage)
|
cy.get(ATTRIBUTES_DETAILS.swatchValueImage)
|
||||||
.invoke("attr", "style")
|
.invoke("attr", "style")
|
||||||
.should("include", "saleorDemoProductSneakers");
|
.should("include", "saleorDemoProductSneakers");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -223,7 +223,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
const attributeName = `${startsWith}${faker.datatype.number()}`;
|
const attributeName = `${startsWith}${faker.datatype.number()}`;
|
||||||
|
|
||||||
createAttribute({
|
createAttribute({
|
||||||
name: attributeName
|
name: attributeName,
|
||||||
}).then(attribute => {
|
}).then(attribute => {
|
||||||
cy.visit(attributeDetailsUrl(attribute.id))
|
cy.visit(attributeDetailsUrl(attribute.id))
|
||||||
.get(BUTTON_SELECTORS.deleteButton)
|
.get(BUTTON_SELECTORS.deleteButton)
|
||||||
|
@ -234,7 +234,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
.waitForRequestAndCheckIfNoErrors("@AttributeDelete");
|
.waitForRequestAndCheckIfNoErrors("@AttributeDelete");
|
||||||
getAttribute(attribute.id).should("be.null");
|
getAttribute(attribute.id).should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -245,7 +245,7 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
const attributeUpdatedName = `${startsWith}${faker.datatype.number()}`;
|
const attributeUpdatedName = `${startsWith}${faker.datatype.number()}`;
|
||||||
|
|
||||||
createAttribute({
|
createAttribute({
|
||||||
name: attributeName
|
name: attributeName,
|
||||||
})
|
})
|
||||||
.then(attribute => {
|
.then(attribute => {
|
||||||
cy.visit(attributeDetailsUrl(attribute.id));
|
cy.visit(attributeDetailsUrl(attribute.id));
|
||||||
|
@ -260,6 +260,6 @@ describe("As an admin I want to create product attribute", () => {
|
||||||
expect(attribute.name).to.eq(attributeUpdatedName);
|
expect(attribute.name).to.eq(attributeUpdatedName);
|
||||||
expect(attribute.slug).to.eq(attributeUpdatedName);
|
expect(attribute.slug).to.eq(attributeUpdatedName);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||||
import { attributeDetailsUrl } from "../../../fixtures/urlList";
|
import { attributeDetailsUrl } from "../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createAttribute,
|
createAttribute,
|
||||||
getAttribute
|
getAttribute,
|
||||||
} from "../../../support/api/requests/Attribute";
|
} from "../../../support/api/requests/Attribute";
|
||||||
import { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils";
|
import { deleteAttributesStartsWith } from "../../../support/api/utils/attributes/attributeUtils";
|
||||||
import { fillUpAttributeNameAndCode } from "../../../support/pages/attributesPage";
|
import { fillUpAttributeNameAndCode } from "../../../support/pages/attributesPage";
|
||||||
|
@ -25,7 +25,7 @@ describe("As an admin I want to delete and update content attribute", () => {
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
createAttribute({
|
createAttribute({
|
||||||
name: `${startsWith}${faker.datatype.number()}`,
|
name: `${startsWith}${faker.datatype.number()}`,
|
||||||
type: "PAGE_TYPE"
|
type: "PAGE_TYPE",
|
||||||
}).then(attributeResp => {
|
}).then(attributeResp => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
});
|
});
|
||||||
|
@ -43,7 +43,7 @@ describe("As an admin I want to delete and update content attribute", () => {
|
||||||
.click()
|
.click()
|
||||||
.waitForRequestAndCheckIfNoErrors("@AttributeDelete");
|
.waitForRequestAndCheckIfNoErrors("@AttributeDelete");
|
||||||
getAttribute(attribute.id).should("be.null");
|
getAttribute(attribute.id).should("be.null");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -62,6 +62,6 @@ describe("As an admin I want to delete and update content attribute", () => {
|
||||||
expect(attributeResp.name).to.eq(attributeUpdatedName);
|
expect(attributeResp.name).to.eq(attributeUpdatedName);
|
||||||
expect(attributeResp.slug).to.eq(attributeUpdatedName);
|
expect(attributeResp.slug).to.eq(attributeUpdatedName);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,20 +3,20 @@
|
||||||
|
|
||||||
import {
|
import {
|
||||||
getElementByDataTestId,
|
getElementByDataTestId,
|
||||||
SHARED_ELEMENTS
|
SHARED_ELEMENTS,
|
||||||
} from "../../../elements/shared/sharedElements";
|
} from "../../../elements/shared/sharedElements";
|
||||||
import { updateAttribute } from "../../../support/api/requests/Attribute";
|
import { updateAttribute } from "../../../support/api/requests/Attribute";
|
||||||
import { createProduct } from "../../../support/api/requests/Product";
|
import { createProduct } from "../../../support/api/requests/Product";
|
||||||
import {
|
import {
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
import filterTests from "../../../support/filterTests";
|
import filterTests from "../../../support/filterTests";
|
||||||
import { enterAttributeAndChanegeIsFilterableInDashbord } from "../../../support/pages/attributesPage";
|
import { enterAttributeAndChanegeIsFilterableInDashbord } from "../../../support/pages/attributesPage";
|
||||||
import {
|
import {
|
||||||
enterProductListPage,
|
enterProductListPage,
|
||||||
selectAttributeFilter,
|
selectAttributeFilter,
|
||||||
showFilters
|
showFilters,
|
||||||
} from "../../../support/pages/catalog/products/productsListPage";
|
} from "../../../support/pages/catalog/products/productsListPage";
|
||||||
|
|
||||||
xdescribe("Tests for using attributes in filters", () => {
|
xdescribe("Tests for using attributes in filters", () => {
|
||||||
|
@ -29,7 +29,7 @@ xdescribe("Tests for using attributes in filters", () => {
|
||||||
deleteProductsStartsWith(startsWith);
|
deleteProductsStartsWith(startsWith);
|
||||||
createTypeAttributeAndCategoryForProduct({
|
createTypeAttributeAndCategoryForProduct({
|
||||||
name: startsWith,
|
name: startsWith,
|
||||||
attributeValues: [startsWith]
|
attributeValues: [startsWith],
|
||||||
}).then(({ attribute: attributeResp, category, productType }) => {
|
}).then(({ attribute: attributeResp, category, productType }) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
createProduct({
|
createProduct({
|
||||||
|
@ -37,7 +37,7 @@ xdescribe("Tests for using attributes in filters", () => {
|
||||||
attributeValue: startsWith,
|
attributeValue: startsWith,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
name: startsWith
|
name: startsWith,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -52,15 +52,15 @@ xdescribe("Tests for using attributes in filters", () => {
|
||||||
() => {
|
() => {
|
||||||
updateAttribute({
|
updateAttribute({
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
filterableInDashboard: false
|
filterableInDashboard: false,
|
||||||
});
|
});
|
||||||
enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
|
enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
|
||||||
enterProductListPage();
|
enterProductListPage();
|
||||||
selectAttributeFilter(attribute.slug, attribute.name);
|
selectAttributeFilter(attribute.slug, attribute.name);
|
||||||
cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should(
|
cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should(
|
||||||
"be.visible"
|
"be.visible",
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -69,12 +69,12 @@ xdescribe("Tests for using attributes in filters", () => {
|
||||||
() => {
|
() => {
|
||||||
updateAttribute({
|
updateAttribute({
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
filterableInDashboard: true
|
filterableInDashboard: true,
|
||||||
});
|
});
|
||||||
enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
|
enterAttributeAndChanegeIsFilterableInDashbord(attribute.id);
|
||||||
enterProductListPage();
|
enterProductListPage();
|
||||||
showFilters();
|
showFilters();
|
||||||
cy.get(getElementByDataTestId(attribute.name)).should("not.exist");
|
cy.get(getElementByDataTestId(attribute.name)).should("not.exist");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,7 +14,7 @@ import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
|
||||||
import { createChannel } from "../../../support/api/requests/Channels";
|
import { createChannel } from "../../../support/api/requests/Channels";
|
||||||
import {
|
import {
|
||||||
createShippingZone,
|
createShippingZone,
|
||||||
getShippingZone
|
getShippingZone,
|
||||||
} from "../../../support/api/requests/ShippingMethod";
|
} from "../../../support/api/requests/ShippingMethod";
|
||||||
import { deleteChannelsStartsWith } from "../../../support/api/utils/channelsUtils";
|
import { deleteChannelsStartsWith } from "../../../support/api/utils/channelsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||||
|
@ -38,7 +38,7 @@ describe("Channels", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.channel
|
ONE_PERMISSION_USERS.channel,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ describe("Channels", () => {
|
||||||
.click()
|
.click()
|
||||||
.get(SELECT_CHANNELS_TO_ASSIGN.listOfChannels)
|
.get(SELECT_CHANNELS_TO_ASSIGN.listOfChannels)
|
||||||
.contains(randomChannel);
|
.contains(randomChannel);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -101,16 +101,16 @@ describe("Channels", () => {
|
||||||
createChannelByView({
|
createChannelByView({
|
||||||
name: randomChannel,
|
name: randomChannel,
|
||||||
currency,
|
currency,
|
||||||
shippingZone: shippingZone.name
|
shippingZone: shippingZone.name,
|
||||||
});
|
});
|
||||||
cy.waitForRequestAndCheckIfNoErrors("@Channel");
|
cy.waitForRequestAndCheckIfNoErrors("@Channel");
|
||||||
getShippingZone(shippingZone.id).then(shippingZoneResp => {
|
getShippingZone(shippingZone.id).then(shippingZoneResp => {
|
||||||
const assignedChannel = shippingZoneResp.channels.find(
|
const assignedChannel = shippingZoneResp.channels.find(
|
||||||
channel => channel.name === randomChannel
|
channel => channel.name === randomChannel,
|
||||||
);
|
);
|
||||||
expect(assignedChannel).to.be.ok;
|
expect(assignedChannel).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -122,15 +122,15 @@ describe("Channels", () => {
|
||||||
isActive: false,
|
isActive: false,
|
||||||
name: randomChannel,
|
name: randomChannel,
|
||||||
slug: randomChannel,
|
slug: randomChannel,
|
||||||
currencyCode: currency
|
currencyCode: currency,
|
||||||
});
|
});
|
||||||
cy.visit(urlList.channels);
|
cy.visit(urlList.channels);
|
||||||
cy.expectSkeletonIsVisible();
|
cy.expectSkeletonIsVisible();
|
||||||
createChannelByView({ name: randomChannel, currency });
|
createChannelByView({ name: randomChannel, currency });
|
||||||
cy.get(ADD_CHANNEL_FORM_SELECTORS.slugValidationMessage).should(
|
cy.get(ADD_CHANNEL_FORM_SELECTORS.slugValidationMessage).should(
|
||||||
"be.visible"
|
"be.visible",
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -142,12 +142,12 @@ describe("Channels", () => {
|
||||||
cy.expectSkeletonIsVisible();
|
cy.expectSkeletonIsVisible();
|
||||||
createChannelByView({
|
createChannelByView({
|
||||||
name: randomChannel,
|
name: randomChannel,
|
||||||
currency: "notExistingCurrency"
|
currency: "notExistingCurrency",
|
||||||
});
|
});
|
||||||
cy.get(ADD_CHANNEL_FORM_SELECTORS.currencyValidationMessage).should(
|
cy.get(ADD_CHANNEL_FORM_SELECTORS.currencyValidationMessage).should(
|
||||||
"be.visible"
|
"be.visible",
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -159,7 +159,7 @@ describe("Channels", () => {
|
||||||
isActive: false,
|
isActive: false,
|
||||||
name: randomChannelToDelete,
|
name: randomChannelToDelete,
|
||||||
slug: randomChannelToDelete,
|
slug: randomChannelToDelete,
|
||||||
currencyCode: currency
|
currencyCode: currency,
|
||||||
});
|
});
|
||||||
cy.addAliasToGraphRequest("Channels");
|
cy.addAliasToGraphRequest("Channels");
|
||||||
cy.visit(urlList.channels);
|
cy.visit(urlList.channels);
|
||||||
|
@ -176,6 +176,6 @@ describe("Channels", () => {
|
||||||
cy.get(CHANNELS_SELECTORS.channelName)
|
cy.get(CHANNELS_SELECTORS.channelName)
|
||||||
.contains(randomChannelToDelete)
|
.contains(randomChannelToDelete)
|
||||||
.should("not.exist");
|
.should("not.exist");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,18 +9,18 @@ import { ORDERS_SELECTORS } from "../../../elements/orders/orders-selectors";
|
||||||
import { urlList } from "../../../fixtures/urlList";
|
import { urlList } from "../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
activateChannel,
|
activateChannel,
|
||||||
createChannel
|
createChannel,
|
||||||
} from "../../../support/api/requests/Channels";
|
} from "../../../support/api/requests/Channels";
|
||||||
import { createCheckout } from "../../../support/api/requests/Checkout";
|
import { createCheckout } from "../../../support/api/requests/Checkout";
|
||||||
import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails";
|
import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails";
|
||||||
import {
|
import {
|
||||||
deleteChannelsStartsWith,
|
deleteChannelsStartsWith,
|
||||||
getDefaultChannel
|
getDefaultChannel,
|
||||||
} from "../../../support/api/utils/channelsUtils";
|
} from "../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
|
import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ describe("Tests on inactive channel", () => {
|
||||||
isActive: false,
|
isActive: false,
|
||||||
name: randomName,
|
name: randomName,
|
||||||
slug: randomName,
|
slug: randomName,
|
||||||
currencyCode: currency
|
currencyCode: currency,
|
||||||
}).then(channel => {
|
}).then(channel => {
|
||||||
newChannel = channel;
|
newChannel = channel;
|
||||||
});
|
});
|
||||||
|
@ -76,7 +76,7 @@ describe("Tests on inactive channel", () => {
|
||||||
})
|
})
|
||||||
.get(DRAFT_ORDER_SELECTORS.addProducts)
|
.get(DRAFT_ORDER_SELECTORS.addProducts)
|
||||||
.should("not.exist");
|
.should("not.exist");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -91,7 +91,7 @@ describe("Tests on inactive channel", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
|
@ -99,16 +99,16 @@ describe("Tests on inactive channel", () => {
|
||||||
channelSlug: newChannel.slug,
|
channelSlug: newChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList,
|
variantsList,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ errors }) => {
|
.then(({ errors }) => {
|
||||||
expect(
|
expect(
|
||||||
errors[0],
|
errors[0],
|
||||||
"checkout shouldn't be created with error in field channel"
|
"checkout shouldn't be created with error in field channel",
|
||||||
).to.have.property("field", "channel");
|
).to.have.property("field", "channel");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -123,7 +123,7 @@ describe("Tests on inactive channel", () => {
|
||||||
isActive: false,
|
isActive: false,
|
||||||
name: randomChannel,
|
name: randomChannel,
|
||||||
slug: randomChannel,
|
slug: randomChannel,
|
||||||
currencyCode: currency
|
currencyCode: currency,
|
||||||
})
|
})
|
||||||
.then(channelResp => {
|
.then(channelResp => {
|
||||||
channel = channelResp;
|
channel = channelResp;
|
||||||
|
@ -135,7 +135,7 @@ describe("Tests on inactive channel", () => {
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
|
@ -146,7 +146,7 @@ describe("Tests on inactive channel", () => {
|
||||||
const isVisible = isProductVisible(resp, randomChannel);
|
const isVisible = isProductVisible(resp, randomChannel);
|
||||||
expect(
|
expect(
|
||||||
isVisible,
|
isVisible,
|
||||||
"product with inactive channel shouldn't be visible"
|
"product with inactive channel shouldn't be visible",
|
||||||
).to.be.eq(false);
|
).to.be.eq(false);
|
||||||
activateChannel(channel.id);
|
activateChannel(channel.id);
|
||||||
})
|
})
|
||||||
|
@ -157,9 +157,9 @@ describe("Tests on inactive channel", () => {
|
||||||
const isVisible = isProductVisible(resp, randomChannel);
|
const isVisible = isProductVisible(resp, randomChannel);
|
||||||
expect(
|
expect(
|
||||||
isVisible,
|
isVisible,
|
||||||
"product with active channel should be visible"
|
"product with active channel should be visible",
|
||||||
).to.be.eq(true);
|
).to.be.eq(true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@ import {
|
||||||
addressCreate,
|
addressCreate,
|
||||||
createCustomer,
|
createCustomer,
|
||||||
deleteCustomersStartsWith,
|
deleteCustomersStartsWith,
|
||||||
getCustomer
|
getCustomer,
|
||||||
} from "../../support/api/requests/Customer";
|
} from "../../support/api/requests/Customer";
|
||||||
|
|
||||||
describe("Tests for customer", () => {
|
describe("Tests for customer", () => {
|
||||||
|
@ -66,16 +66,16 @@ describe("Tests for customer", () => {
|
||||||
})
|
})
|
||||||
.then(customer => {
|
.then(customer => {
|
||||||
expect(customer.firstName, "Expect correct first name").to.eq(
|
expect(customer.firstName, "Expect correct first name").to.eq(
|
||||||
randomName
|
randomName,
|
||||||
);
|
);
|
||||||
expect(customer.lastName, "Expect correct last name").to.eq(
|
expect(customer.lastName, "Expect correct last name").to.eq(
|
||||||
randomName
|
randomName,
|
||||||
);
|
);
|
||||||
expect(customer.email, "Expect correct email").to.eq(email);
|
expect(customer.email, "Expect correct email").to.eq(email);
|
||||||
expect(customer.note, "Expect correct note").to.eq(note);
|
expect(customer.note, "Expect correct note").to.eq(note);
|
||||||
cy.expectCorrectFullAddress(customer.addresses[0], address);
|
cy.expectCorrectFullAddress(customer.addresses[0], address);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -99,7 +99,7 @@ describe("Tests for customer", () => {
|
||||||
cy.expectCorrectFullAddress(addresses[0], secondAddress);
|
cy.expectCorrectFullAddress(addresses[0], secondAddress);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -128,7 +128,7 @@ describe("Tests for customer", () => {
|
||||||
expect(addresses).to.have.length(1);
|
expect(addresses).to.have.length(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -172,7 +172,7 @@ describe("Tests for customer", () => {
|
||||||
.then(({ addresses }) => {
|
.then(({ addresses }) => {
|
||||||
expect(addresses[0].isDefaultBillingAddress).to.be.true;
|
expect(addresses[0].isDefaultBillingAddress).to.be.true;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -199,12 +199,12 @@ describe("Tests for customer", () => {
|
||||||
expect(addresses).to.have.length(2);
|
expect(addresses).to.have.length(2);
|
||||||
const addedAddress = addresses.find(
|
const addedAddress = addresses.find(
|
||||||
element =>
|
element =>
|
||||||
element.city.toUpperCase() === secondAddress.city.toUpperCase()
|
element.city.toUpperCase() === secondAddress.city.toUpperCase(),
|
||||||
);
|
);
|
||||||
cy.expectCorrectFullAddress(addedAddress, secondAddress);
|
cy.expectCorrectFullAddress(addedAddress, secondAddress);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -224,7 +224,7 @@ describe("Tests for customer", () => {
|
||||||
.wait("@RemoveCustomer");
|
.wait("@RemoveCustomer");
|
||||||
getCustomer(user.id).should("be.null");
|
getCustomer(user.id).should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -246,7 +246,7 @@ describe("Tests for customer", () => {
|
||||||
expect(isActive).to.be.false;
|
expect(isActive).to.be.false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -273,15 +273,15 @@ describe("Tests for customer", () => {
|
||||||
.wait("@UpdateCustomer");
|
.wait("@UpdateCustomer");
|
||||||
getCustomer(user.id).then(user => {
|
getCustomer(user.id).then(user => {
|
||||||
expect(user.firstName, "Expect correct first name").to.eq(
|
expect(user.firstName, "Expect correct first name").to.eq(
|
||||||
updatedName
|
updatedName,
|
||||||
);
|
);
|
||||||
expect(user.lastName, "Expect correct last name").to.eq(updatedName);
|
expect(user.lastName, "Expect correct last name").to.eq(updatedName);
|
||||||
expect(user.email, "Expect correct email").to.eq(
|
expect(user.email, "Expect correct email").to.eq(
|
||||||
`${updatedName}@example.com`
|
`${updatedName}@example.com`,
|
||||||
);
|
);
|
||||||
expect(user.note, "Expect correct note").to.eq(updatedName);
|
expect(user.note, "Expect correct note").to.eq(updatedName);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,13 +5,13 @@ import faker from "faker";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createMenu as createMenuViaApi,
|
createMenu as createMenuViaApi,
|
||||||
getMenu
|
getMenu,
|
||||||
} from "../../support/api/requests/Menu";
|
} from "../../support/api/requests/Menu";
|
||||||
import { deleteMenusStartsWith } from "../../support/api/utils/navigationUtils";
|
import { deleteMenusStartsWith } from "../../support/api/utils/navigationUtils";
|
||||||
import {
|
import {
|
||||||
createMenu,
|
createMenu,
|
||||||
createNewMenuItem,
|
createNewMenuItem,
|
||||||
MENU_ITEM_TYPES
|
MENU_ITEM_TYPES,
|
||||||
} from "../../support/pages/navigationPage";
|
} from "../../support/pages/navigationPage";
|
||||||
|
|
||||||
describe("Tests for menu navigation", () => {
|
describe("Tests for menu navigation", () => {
|
||||||
|
@ -25,7 +25,7 @@ describe("Tests for menu navigation", () => {
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
deleteMenusStartsWith(startsWith);
|
deleteMenusStartsWith(startsWith);
|
||||||
createMenuViaApi(randomName).then(
|
createMenuViaApi(randomName).then(
|
||||||
({ menu: menuResp }) => (menu = menuResp)
|
({ menu: menuResp }) => (menu = menuResp),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ describe("Tests for menu navigation", () => {
|
||||||
.then(menuResp => {
|
.then(menuResp => {
|
||||||
expect(menuResp.name).to.eq(name);
|
expect(menuResp.name).to.eq(name);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
["category", "collection", "page"].forEach(itemType => {
|
["category", "collection", "page"].forEach(itemType => {
|
||||||
|
@ -61,7 +61,7 @@ describe("Tests for menu navigation", () => {
|
||||||
createNewMenuItem({
|
createNewMenuItem({
|
||||||
menuId: menu.id,
|
menuId: menu.id,
|
||||||
name: itemName,
|
name: itemName,
|
||||||
menuItemType: MENU_ITEM_TYPES[itemType]
|
menuItemType: MENU_ITEM_TYPES[itemType],
|
||||||
})
|
})
|
||||||
.then(selectedItemResp => {
|
.then(selectedItemResp => {
|
||||||
selectedItem = selectedItemResp;
|
selectedItem = selectedItemResp;
|
||||||
|
@ -73,7 +73,7 @@ describe("Tests for menu navigation", () => {
|
||||||
const name = itemType !== "page" ? "name" : "title";
|
const name = itemType !== "page" ? "name" : "title";
|
||||||
expect(itemOfType[name]).to.eq(selectedItem);
|
expect(itemOfType[name]).to.eq(selectedItem);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,12 +10,12 @@ import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
|
||||||
import {
|
import {
|
||||||
permissionGroupDetails,
|
permissionGroupDetails,
|
||||||
staffMemberDetailsUrl,
|
staffMemberDetailsUrl,
|
||||||
urlList
|
urlList,
|
||||||
} from "../../fixtures/urlList";
|
} from "../../fixtures/urlList";
|
||||||
import { TEST_ADMIN_USER } from "../../fixtures/users.js";
|
import { TEST_ADMIN_USER } from "../../fixtures/users.js";
|
||||||
import {
|
import {
|
||||||
createPermissionGroup,
|
createPermissionGroup,
|
||||||
getPermissionGroup
|
getPermissionGroup,
|
||||||
} from "../../support/api/requests/PermissionGroup.js";
|
} from "../../support/api/requests/PermissionGroup.js";
|
||||||
import { getStaffMembersStartsWith } from "../../support/api/requests/StaffMembers";
|
import { getStaffMembersStartsWith } from "../../support/api/requests/StaffMembers";
|
||||||
import { deletePermissionGroupsStartsWith } from "../../support/api/utils/permissionGroupUtils.js";
|
import { deletePermissionGroupsStartsWith } from "../../support/api/utils/permissionGroupUtils.js";
|
||||||
|
@ -47,7 +47,7 @@ describe("Permissions groups", () => {
|
||||||
.get(PERMISSION_GROUP_DETAILS.productsPermissionCheckbox)
|
.get(PERMISSION_GROUP_DETAILS.productsPermissionCheckbox)
|
||||||
.click()
|
.click()
|
||||||
.get(
|
.get(
|
||||||
PERMISSION_GROUP_DETAILS.productsTypesAndAttributesPermissionCheckbox
|
PERMISSION_GROUP_DETAILS.productsTypesAndAttributesPermissionCheckbox,
|
||||||
)
|
)
|
||||||
.click()
|
.click()
|
||||||
.get(BUTTON_SELECTORS.confirm)
|
.get(BUTTON_SELECTORS.confirm)
|
||||||
|
@ -59,9 +59,9 @@ describe("Permissions groups", () => {
|
||||||
.waitForProgressBarToNotExist();
|
.waitForProgressBarToNotExist();
|
||||||
cy.contains(
|
cy.contains(
|
||||||
PERMISSION_GROUP_LIST.permissionGroupRow,
|
PERMISSION_GROUP_LIST.permissionGroupRow,
|
||||||
permissionName
|
permissionName,
|
||||||
).should("be.visible");
|
).should("be.visible");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -77,7 +77,7 @@ describe("Permissions groups", () => {
|
||||||
createPermissionGroup({
|
createPermissionGroup({
|
||||||
name: permissionName,
|
name: permissionName,
|
||||||
userIdsArray: `["${staffMember.id}"]`,
|
userIdsArray: `["${staffMember.id}"]`,
|
||||||
permissionsArray: "[MANAGE_PRODUCTS]"
|
permissionsArray: "[MANAGE_PRODUCTS]",
|
||||||
});
|
});
|
||||||
cy.visit(urlList.permissionsGroups);
|
cy.visit(urlList.permissionsGroups);
|
||||||
cy.contains(PERMISSION_GROUP_LIST.permissionGroupRow, permissionName)
|
cy.contains(PERMISSION_GROUP_LIST.permissionGroupRow, permissionName)
|
||||||
|
@ -92,7 +92,7 @@ describe("Permissions groups", () => {
|
||||||
cy.get(SHARED_ELEMENTS.header).should("be.visible");
|
cy.get(SHARED_ELEMENTS.header).should("be.visible");
|
||||||
cy.contains(permissionName).should("not.exist");
|
cy.contains(permissionName).should("not.exist");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -102,7 +102,7 @@ describe("Permissions groups", () => {
|
||||||
const permissionName = `${startsWith}${faker.datatype.number()}`;
|
const permissionName = `${startsWith}${faker.datatype.number()}`;
|
||||||
createPermissionGroup({
|
createPermissionGroup({
|
||||||
name: permissionName,
|
name: permissionName,
|
||||||
permissionsArray: "[MANAGE_PRODUCTS]"
|
permissionsArray: "[MANAGE_PRODUCTS]",
|
||||||
})
|
})
|
||||||
.then(({ group }) => {
|
.then(({ group }) => {
|
||||||
cy.visit(permissionGroupDetails(group.id))
|
cy.visit(permissionGroupDetails(group.id))
|
||||||
|
@ -112,7 +112,7 @@ describe("Permissions groups", () => {
|
||||||
.type(TEST_ADMIN_USER.email);
|
.type(TEST_ADMIN_USER.email);
|
||||||
cy.contains(
|
cy.contains(
|
||||||
PERMISSION_GROUP_DETAILS.userRow,
|
PERMISSION_GROUP_DETAILS.userRow,
|
||||||
`${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}`
|
`${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}`,
|
||||||
)
|
)
|
||||||
.should("have.length", 1)
|
.should("have.length", 1)
|
||||||
.find(BUTTON_SELECTORS.checkbox)
|
.find(BUTTON_SELECTORS.checkbox)
|
||||||
|
@ -129,7 +129,7 @@ describe("Permissions groups", () => {
|
||||||
expect(resp.users).to.have.length(1);
|
expect(resp.users).to.have.length(1);
|
||||||
expect(resp.users[0].email).to.be.eq(TEST_ADMIN_USER.email);
|
expect(resp.users[0].email).to.be.eq(TEST_ADMIN_USER.email);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -145,7 +145,7 @@ describe("Permissions groups", () => {
|
||||||
createPermissionGroup({
|
createPermissionGroup({
|
||||||
name: permissionName,
|
name: permissionName,
|
||||||
userIdsArray: `["${staffMember.id}"]`,
|
userIdsArray: `["${staffMember.id}"]`,
|
||||||
permissionsArray: "[MANAGE_PRODUCTS]"
|
permissionsArray: "[MANAGE_PRODUCTS]",
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ group }) => {
|
.then(({ group }) => {
|
||||||
|
@ -162,6 +162,6 @@ describe("Permissions groups", () => {
|
||||||
cy.get(SHARED_ELEMENTS.header).should("be.visible");
|
cy.get(SHARED_ELEMENTS.header).should("be.visible");
|
||||||
cy.contains(permissionName).should("not.exist");
|
cy.contains(permissionName).should("not.exist");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,22 +6,22 @@ import faker from "faker";
|
||||||
import {
|
import {
|
||||||
addShippingMethod,
|
addShippingMethod,
|
||||||
completeCheckout,
|
completeCheckout,
|
||||||
createCheckout
|
createCheckout,
|
||||||
} from "../../../support/api/requests/Checkout";
|
} from "../../../support/api/requests/Checkout";
|
||||||
import { getOrder } from "../../../support/api/requests/Order";
|
import { getOrder } from "../../../support/api/requests/Order";
|
||||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
addAdyenPayment,
|
addAdyenPayment,
|
||||||
getShippingMethodIdFromCheckout
|
getShippingMethodIdFromCheckout,
|
||||||
} from "../../../support/api/utils/ordersUtils";
|
} from "../../../support/api/utils/ordersUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../../support/api/utils/shippingUtils";
|
} from "../../../support/api/utils/shippingUtils";
|
||||||
|
|
||||||
describe("Adyen payments", () => {
|
describe("Adyen payments", () => {
|
||||||
|
@ -48,7 +48,7 @@ describe("Adyen payments", () => {
|
||||||
clientData: paymentCards.clientData,
|
clientData: paymentCards.clientData,
|
||||||
encryptedExpiryMonth: paymentCards.encryptedExpiryMonth,
|
encryptedExpiryMonth: paymentCards.encryptedExpiryMonth,
|
||||||
encryptedExpiryYear: paymentCards.encryptedExpiryYear,
|
encryptedExpiryYear: paymentCards.encryptedExpiryYear,
|
||||||
encryptedSecurityCode: paymentCards.encryptedSecurityCodes.matches
|
encryptedSecurityCode: paymentCards.encryptedSecurityCodes.matches,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
cy.fixture("addresses")
|
cy.fixture("addresses")
|
||||||
|
@ -62,18 +62,18 @@ describe("Adyen payments", () => {
|
||||||
channelId: channelResp.id,
|
channelId: channelResp.id,
|
||||||
name,
|
name,
|
||||||
address,
|
address,
|
||||||
price: 10
|
price: 10,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
warehouse: warehouseResp,
|
warehouse: warehouseResp,
|
||||||
shippingZone: shippingZoneResp,
|
shippingZone: shippingZoneResp,
|
||||||
shippingMethod: shippingMethodResp
|
shippingMethod: shippingMethodResp,
|
||||||
}) => {
|
}) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
createTypeAttributeAndCategoryForProduct({ name })
|
createTypeAttributeAndCategoryForProduct({ name })
|
||||||
.then(({ productType, attribute, category }) => {
|
.then(({ productType, attribute, category }) => {
|
||||||
|
@ -83,7 +83,7 @@ describe("Adyen payments", () => {
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ variantsList: variants }) => (variantsList = variants));
|
.then(({ variantsList: variants }) => (variantsList = variants));
|
||||||
|
@ -97,12 +97,12 @@ describe("Adyen payments", () => {
|
||||||
variantsList,
|
variantsList,
|
||||||
address,
|
address,
|
||||||
billingAddress: address,
|
billingAddress: address,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
})
|
})
|
||||||
.then(({ checkout: checkoutResp }) => {
|
.then(({ checkout: checkoutResp }) => {
|
||||||
const shippingMethodId = getShippingMethodIdFromCheckout(
|
const shippingMethodId = getShippingMethodIdFromCheckout(
|
||||||
checkoutResp,
|
checkoutResp,
|
||||||
shippingMethod.name
|
shippingMethod.name,
|
||||||
);
|
);
|
||||||
checkout = checkoutResp;
|
checkout = checkoutResp;
|
||||||
addShippingMethod(checkout.id, shippingMethodId);
|
addShippingMethod(checkout.id, shippingMethodId);
|
||||||
|
@ -127,7 +127,7 @@ describe("Adyen payments", () => {
|
||||||
.then(order => {
|
.then(order => {
|
||||||
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -145,7 +145,7 @@ describe("Adyen payments", () => {
|
||||||
.then(order => {
|
.then(order => {
|
||||||
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -164,7 +164,7 @@ describe("Adyen payments", () => {
|
||||||
.then(order => {
|
.then(order => {
|
||||||
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -180,7 +180,7 @@ describe("Adyen payments", () => {
|
||||||
completeCheckout(checkout.id, simpleCard).then(({ errors }) => {
|
completeCheckout(checkout.id, simpleCard).then(({ errors }) => {
|
||||||
expect(errors).to.have.length(1);
|
expect(errors).to.have.length(1);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -194,7 +194,7 @@ describe("Adyen payments", () => {
|
||||||
completeCheckout(checkout.id, errorCard).then(({ errors }) => {
|
completeCheckout(checkout.id, errorCard).then(({ errors }) => {
|
||||||
expect(errors).to.have.length(1);
|
expect(errors).to.have.length(1);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -208,6 +208,6 @@ describe("Adyen payments", () => {
|
||||||
completeCheckout(checkout.id, closeAccount).then(({ errors }) => {
|
completeCheckout(checkout.id, closeAccount).then(({ errors }) => {
|
||||||
expect(errors).to.have.length(1);
|
expect(errors).to.have.length(1);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,15 +11,15 @@ import { createChannel } from "../../../support/api/requests/Channels";
|
||||||
import {
|
import {
|
||||||
customerRegistration,
|
customerRegistration,
|
||||||
deleteCustomersStartsWith,
|
deleteCustomersStartsWith,
|
||||||
requestPasswordReset
|
requestPasswordReset,
|
||||||
} from "../../../support/api/requests/Customer";
|
} from "../../../support/api/requests/Customer";
|
||||||
import {
|
import {
|
||||||
deleteChannelsStartsWith,
|
deleteChannelsStartsWith,
|
||||||
getDefaultChannel
|
getDefaultChannel,
|
||||||
} from "../../../support/api/utils/channelsUtils";
|
} from "../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
getMailActivationLinkForUserAndSubject,
|
getMailActivationLinkForUserAndSubject,
|
||||||
getMailsForUser
|
getMailsForUser,
|
||||||
} from "../../../support/api/utils/users";
|
} from "../../../support/api/utils/users";
|
||||||
|
|
||||||
describe("Plugins", () => {
|
describe("Plugins", () => {
|
||||||
|
@ -54,7 +54,7 @@ describe("Plugins", () => {
|
||||||
.confirmationMessageShouldDisappear();
|
.confirmationMessageShouldDisappear();
|
||||||
customerRegistration({
|
customerRegistration({
|
||||||
email: customerEmail,
|
email: customerEmail,
|
||||||
channel: defaultChannel.slug
|
channel: defaultChannel.slug,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getMailsForUser(customerEmail);
|
getMailsForUser(customerEmail);
|
||||||
|
@ -82,12 +82,12 @@ describe("Plugins", () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getMailActivationLinkForUserAndSubject(
|
getMailActivationLinkForUserAndSubject(
|
||||||
Cypress.env("USER_NAME"),
|
Cypress.env("USER_NAME"),
|
||||||
randomName
|
randomName,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(link => {
|
.then(link => {
|
||||||
expect(link).to.be.ok;
|
expect(link).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,13 +4,13 @@
|
||||||
import {
|
import {
|
||||||
addShippingMethod,
|
addShippingMethod,
|
||||||
completeCheckout,
|
completeCheckout,
|
||||||
createCheckout
|
createCheckout,
|
||||||
} from "../../../support/api/requests/Checkout";
|
} from "../../../support/api/requests/Checkout";
|
||||||
import { getOrder } from "../../../support/api/requests/Order";
|
import { getOrder } from "../../../support/api/requests/Order";
|
||||||
import { confirmThreeDSecure } from "../../../support/api/requests/stripe";
|
import { confirmThreeDSecure } from "../../../support/api/requests/stripe";
|
||||||
import {
|
import {
|
||||||
addStripePaymentAndGetConfirmationData,
|
addStripePaymentAndGetConfirmationData,
|
||||||
getShippingMethodIdFromCheckout
|
getShippingMethodIdFromCheckout,
|
||||||
} from "../../../support/api/utils/ordersUtils";
|
} from "../../../support/api/utils/ordersUtils";
|
||||||
import { createProductWithShipping } from "../../../support/api/utils/products/productsUtils";
|
import { createProductWithShipping } from "../../../support/api/utils/products/productsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||||
|
@ -36,7 +36,7 @@ describe("Stripe payments", () => {
|
||||||
publicKey: paymentCards.publicApiKey,
|
publicKey: paymentCards.publicApiKey,
|
||||||
cvc: 123,
|
cvc: 123,
|
||||||
expMonth: 10,
|
expMonth: 10,
|
||||||
expYear: 50
|
expYear: 50,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
createProductWithShipping({ name: startsWith }).then(values => {
|
createProductWithShipping({ name: startsWith }).then(values => {
|
||||||
|
@ -55,13 +55,13 @@ describe("Stripe payments", () => {
|
||||||
variantsList,
|
variantsList,
|
||||||
address,
|
address,
|
||||||
billingAddress: address,
|
billingAddress: address,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
})
|
})
|
||||||
.then(({ checkout: checkoutResp }) => {
|
.then(({ checkout: checkoutResp }) => {
|
||||||
checkout = checkoutResp;
|
checkout = checkoutResp;
|
||||||
const shippingMethodId = getShippingMethodIdFromCheckout(
|
const shippingMethodId = getShippingMethodIdFromCheckout(
|
||||||
checkoutResp,
|
checkoutResp,
|
||||||
shippingMethod.name
|
shippingMethod.name,
|
||||||
);
|
);
|
||||||
addShippingMethod(checkout.id, shippingMethodId);
|
addShippingMethod(checkout.id, shippingMethodId);
|
||||||
})
|
})
|
||||||
|
@ -79,7 +79,7 @@ describe("Stripe payments", () => {
|
||||||
addStripePaymentAndGetConfirmationData({
|
addStripePaymentAndGetConfirmationData({
|
||||||
card: simpleCard,
|
card: simpleCard,
|
||||||
checkoutId: checkout.id,
|
checkoutId: checkout.id,
|
||||||
amount: checkout.totalPrice.gross.amount
|
amount: checkout.totalPrice.gross.amount,
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
completeCheckout(checkout.id);
|
completeCheckout(checkout.id);
|
||||||
|
@ -90,7 +90,7 @@ describe("Stripe payments", () => {
|
||||||
.then(order => {
|
.then(order => {
|
||||||
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -102,11 +102,11 @@ describe("Stripe payments", () => {
|
||||||
addStripePaymentAndGetConfirmationData({
|
addStripePaymentAndGetConfirmationData({
|
||||||
card: simpleCard,
|
card: simpleCard,
|
||||||
checkoutId: checkout.id,
|
checkoutId: checkout.id,
|
||||||
amount: checkout.totalPrice.gross.amount
|
amount: checkout.totalPrice.gross.amount,
|
||||||
}).then(resp => {
|
}).then(resp => {
|
||||||
expect(resp.body.error.code).to.equal("card_declined");
|
expect(resp.body.error.code).to.equal("card_declined");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -118,7 +118,7 @@ describe("Stripe payments", () => {
|
||||||
addStripePaymentAndGetConfirmationData({
|
addStripePaymentAndGetConfirmationData({
|
||||||
card: threeDSecureCard,
|
card: threeDSecureCard,
|
||||||
checkoutId: checkout.id,
|
checkoutId: checkout.id,
|
||||||
amount: checkout.totalPrice.gross.amount
|
amount: checkout.totalPrice.gross.amount,
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
confirmThreeDSecure(resp.body.next_action.redirect_to_url.url);
|
confirmThreeDSecure(resp.body.next_action.redirect_to_url.url);
|
||||||
|
@ -132,7 +132,7 @@ describe("Stripe payments", () => {
|
||||||
.then(order => {
|
.then(order => {
|
||||||
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
expect(order.paymentStatus).to.eq("FULLY_CHARGED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -144,7 +144,7 @@ describe("Stripe payments", () => {
|
||||||
addStripePaymentAndGetConfirmationData({
|
addStripePaymentAndGetConfirmationData({
|
||||||
card: threeDSecureCard,
|
card: threeDSecureCard,
|
||||||
checkoutId: checkout.id,
|
checkoutId: checkout.id,
|
||||||
amount: checkout.totalPrice.gross.amount
|
amount: checkout.totalPrice.gross.amount,
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
confirmThreeDSecure(resp.body.next_action.redirect_to_url.url, false);
|
confirmThreeDSecure(resp.body.next_action.redirect_to_url.url, false);
|
||||||
|
@ -155,6 +155,6 @@ describe("Stripe payments", () => {
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order).to.not.be.ok;
|
expect(order).to.not.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { createCategory } from "../../../support/api/requests/Category";
|
||||||
import {
|
import {
|
||||||
assignAttribute,
|
assignAttribute,
|
||||||
createTypeProduct,
|
createTypeProduct,
|
||||||
getProductType
|
getProductType,
|
||||||
} from "../../../support/api/requests/ProductType";
|
} from "../../../support/api/requests/ProductType";
|
||||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import { deleteProductsStartsWith } from "../../../support/api/utils/products/productsUtils";
|
import { deleteProductsStartsWith } from "../../../support/api/utils/products/productsUtils";
|
||||||
|
@ -43,7 +43,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
createTypeProduct({ name })
|
createTypeProduct({ name })
|
||||||
.then(productType => {
|
.then(productType => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productTypeDetailsUrl(productType.id)
|
productTypeDetailsUrl(productType.id),
|
||||||
)
|
)
|
||||||
.get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton)
|
.get(PRODUCT_TYPE_DETAILS.assignProductAttributeButton)
|
||||||
.click()
|
.click()
|
||||||
|
@ -56,7 +56,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
.then(productType => {
|
.then(productType => {
|
||||||
expect(productType.productAttributes[0].name).to.eq(startsWith);
|
expect(productType.productAttributes[0].name).to.eq(startsWith);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -68,7 +68,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
createTypeProduct({ name, hasVariants: false })
|
createTypeProduct({ name, hasVariants: false })
|
||||||
.then(productType => {
|
.then(productType => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productTypeDetailsUrl(productType.id)
|
productTypeDetailsUrl(productType.id),
|
||||||
)
|
)
|
||||||
.get(PRODUCT_TYPE_DETAILS.hasVariantsButton)
|
.get(PRODUCT_TYPE_DETAILS.hasVariantsButton)
|
||||||
.click({ force: true })
|
.click({ force: true })
|
||||||
|
@ -82,10 +82,10 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
})
|
})
|
||||||
.then(productType => {
|
.then(productType => {
|
||||||
expect(productType.assignedVariantAttributes[0].attribute.name).to.eq(
|
expect(productType.assignedVariantAttributes[0].attribute.name).to.eq(
|
||||||
startsWith
|
startsWith,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -102,7 +102,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productTypeDetailsUrl(productType.id)
|
productTypeDetailsUrl(productType.id),
|
||||||
)
|
)
|
||||||
.get(PRODUCT_TYPE_DETAILS.nameInput)
|
.get(PRODUCT_TYPE_DETAILS.nameInput)
|
||||||
.should("be.enabled")
|
.should("be.enabled")
|
||||||
|
@ -118,7 +118,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
.then(productTypeResp => {
|
.then(productTypeResp => {
|
||||||
expect(productTypeResp.assignedVariantAttributes).to.be.empty;
|
expect(productTypeResp.assignedVariantAttributes).to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -135,7 +135,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productTypeDetailsUrl(productType.id)
|
productTypeDetailsUrl(productType.id),
|
||||||
)
|
)
|
||||||
.get(PRODUCT_TYPE_DETAILS.nameInput)
|
.get(PRODUCT_TYPE_DETAILS.nameInput)
|
||||||
.should("be.enabled")
|
.should("be.enabled")
|
||||||
|
@ -151,7 +151,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
.then(productTypeResp => {
|
.then(productTypeResp => {
|
||||||
expect(productTypeResp.assignedVariantAttributes).to.be.empty;
|
expect(productTypeResp.assignedVariantAttributes).to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -168,7 +168,7 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productTypeDetailsUrl(productType.id)
|
productTypeDetailsUrl(productType.id),
|
||||||
)
|
)
|
||||||
.get(PRODUCT_TYPE_DETAILS.variantSelectionCheckbox)
|
.get(PRODUCT_TYPE_DETAILS.variantSelectionCheckbox)
|
||||||
.click()
|
.click()
|
||||||
|
@ -180,12 +180,12 @@ describe("As an admin I want to manage attributes in product types", () => {
|
||||||
})
|
})
|
||||||
.then(productType => {
|
.then(productType => {
|
||||||
expect(productType.assignedVariantAttributes[0].attribute.name).to.eq(
|
expect(productType.assignedVariantAttributes[0].attribute.name).to.eq(
|
||||||
startsWith
|
startsWith,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
productType.assignedVariantAttributes[0].variantSelection
|
productType.assignedVariantAttributes[0].variantSelection,
|
||||||
).to.eq(true);
|
).to.eq(true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe("As an admin I want to create product types", () => {
|
||||||
expect(productType.isShippingRequired).to.be.false;
|
expect(productType.isShippingRequired).to.be.false;
|
||||||
expect(productType.kind).to.be.eq("NORMAL");
|
expect(productType.kind).to.be.eq("NORMAL");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -58,7 +58,7 @@ describe("As an admin I want to create product types", () => {
|
||||||
expect(productType.weight.value).to.eq(shippingWeight);
|
expect(productType.weight.value).to.eq(shippingWeight);
|
||||||
expect(productType.kind).to.be.eq("NORMAL");
|
expect(productType.kind).to.be.eq("NORMAL");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -76,6 +76,6 @@ describe("As an admin I want to create product types", () => {
|
||||||
expect(productType.isShippingRequired).to.be.false;
|
expect(productType.isShippingRequired).to.be.false;
|
||||||
expect(productType.kind).to.be.eq("GIFT_CARD");
|
expect(productType.kind).to.be.eq("GIFT_CARD");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,13 +9,13 @@ import { createAttribute } from "../../../support/api/requests/Attribute";
|
||||||
import { createCategory } from "../../../support/api/requests/Category";
|
import { createCategory } from "../../../support/api/requests/Category";
|
||||||
import {
|
import {
|
||||||
createTypeProduct,
|
createTypeProduct,
|
||||||
getProductType
|
getProductType,
|
||||||
} from "../../../support/api/requests/ProductType";
|
} from "../../../support/api/requests/ProductType";
|
||||||
import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails";
|
import { getProductDetails } from "../../../support/api/requests/storeFront/ProductDetails";
|
||||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
|
|
||||||
describe("As an admin I want to manage product types", () => {
|
describe("As an admin I want to manage product types", () => {
|
||||||
|
@ -44,7 +44,7 @@ describe("As an admin I want to manage product types", () => {
|
||||||
|
|
||||||
createTypeProduct({ name, hasVariants: false }).then(productType => {
|
createTypeProduct({ name, hasVariants: false }).then(productType => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productTypeDetailsUrl(productType.id)
|
productTypeDetailsUrl(productType.id),
|
||||||
)
|
)
|
||||||
.get(BUTTON_SELECTORS.deleteButton)
|
.get(BUTTON_SELECTORS.deleteButton)
|
||||||
.click()
|
.click()
|
||||||
|
@ -54,7 +54,7 @@ describe("As an admin I want to manage product types", () => {
|
||||||
.waitForRequestAndCheckIfNoErrors("@ProductTypeDelete");
|
.waitForRequestAndCheckIfNoErrors("@ProductTypeDelete");
|
||||||
getProductType(productType.id).should("be.null");
|
getProductType(productType.id).should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -71,12 +71,12 @@ describe("As an admin I want to manage product types", () => {
|
||||||
name,
|
name,
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
productTypeId: productType.id
|
productTypeId: productType.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ product }) => {
|
.then(({ product }) => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productTypeDetailsUrl(productType.id)
|
productTypeDetailsUrl(productType.id),
|
||||||
)
|
)
|
||||||
.get(BUTTON_SELECTORS.deleteButton)
|
.get(BUTTON_SELECTORS.deleteButton)
|
||||||
.click()
|
.click()
|
||||||
|
@ -93,6 +93,6 @@ describe("As an admin I want to manage product types", () => {
|
||||||
.its("body.data.product")
|
.its("body.data.product")
|
||||||
.should("be.null");
|
.should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,14 +9,14 @@ import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
|
||||||
import { createChannel } from "../../../support/api/requests/Channels";
|
import { createChannel } from "../../../support/api/requests/Channels";
|
||||||
import {
|
import {
|
||||||
addChannelToShippingMethod,
|
addChannelToShippingMethod,
|
||||||
addChannelToShippingZone
|
addChannelToShippingZone,
|
||||||
} from "../../../support/api/requests/ShippingMethod";
|
} from "../../../support/api/requests/ShippingMethod";
|
||||||
import * as channelsUtils from "../../../support/api/utils/channelsUtils";
|
import * as channelsUtils from "../../../support/api/utils/channelsUtils";
|
||||||
import * as shippingUtils from "../../../support/api/utils/shippingUtils";
|
import * as shippingUtils from "../../../support/api/utils/shippingUtils";
|
||||||
import { selectChannelInHeader } from "../../../support/pages/channelsPage";
|
import { selectChannelInHeader } from "../../../support/pages/channelsPage";
|
||||||
import {
|
import {
|
||||||
enterAndSelectShippings,
|
enterAndSelectShippings,
|
||||||
enterShippingZone
|
enterShippingZone,
|
||||||
} from "../../../support/pages/shippingZones";
|
} from "../../../support/pages/shippingZones";
|
||||||
|
|
||||||
describe("As a staff user I want have different shipping method prices for each channel", () => {
|
describe("As a staff user I want have different shipping method prices for each channel", () => {
|
||||||
|
@ -46,7 +46,7 @@ describe("As a staff user I want have different shipping method prices for each
|
||||||
|
|
||||||
createChannel({
|
createChannel({
|
||||||
name: shippingName,
|
name: shippingName,
|
||||||
currencyCode: createdChannelCurrency
|
currencyCode: createdChannelCurrency,
|
||||||
}).then(channel => {
|
}).then(channel => {
|
||||||
createdChannel = channel;
|
createdChannel = channel;
|
||||||
});
|
});
|
||||||
|
@ -57,7 +57,7 @@ describe("As a staff user I want have different shipping method prices for each
|
||||||
({
|
({
|
||||||
shippingMethod: shippingMethodResp,
|
shippingMethod: shippingMethodResp,
|
||||||
shippingZone: shippingZoneResp,
|
shippingZone: shippingZoneResp,
|
||||||
defaultChannel: defaultChannelResp
|
defaultChannel: defaultChannelResp,
|
||||||
}) => {
|
}) => {
|
||||||
shippingZone = shippingZoneResp;
|
shippingZone = shippingZoneResp;
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
|
@ -68,16 +68,16 @@ describe("As a staff user I want have different shipping method prices for each
|
||||||
addChannelToShippingMethod(
|
addChannelToShippingMethod(
|
||||||
shippingMethod.id,
|
shippingMethod.id,
|
||||||
createdChannel.id,
|
createdChannel.id,
|
||||||
createdChannelPrice
|
createdChannelPrice,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.shipping
|
ONE_PERMISSION_USERS.shipping,
|
||||||
);
|
);
|
||||||
enterAndSelectShippings(shippingZone.id, enterShippingZone);
|
enterAndSelectShippings(shippingZone.id, enterShippingZone);
|
||||||
selectChannelInHeader(defaultChannel.name);
|
selectChannelInHeader(defaultChannel.name);
|
||||||
|
@ -85,7 +85,7 @@ describe("As a staff user I want have different shipping method prices for each
|
||||||
.get(SHARED_ELEMENTS.skeleton)
|
.get(SHARED_ELEMENTS.skeleton)
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
.getTextFromElement(
|
.getTextFromElement(
|
||||||
SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell
|
SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell,
|
||||||
)
|
)
|
||||||
.then(text => {
|
.then(text => {
|
||||||
const value = defaultChannelPrice
|
const value = defaultChannelPrice
|
||||||
|
@ -102,7 +102,7 @@ describe("As a staff user I want have different shipping method prices for each
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.getTextFromElement(
|
cy.getTextFromElement(
|
||||||
SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell
|
SHIPPING_ZONE_DETAILS.shippingRatePriceTableCell,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(text => {
|
.then(text => {
|
||||||
|
@ -115,6 +115,6 @@ describe("As a staff user I want have different shipping method prices for each
|
||||||
expect(text).to.includes(createdChannelCurrency);
|
expect(text).to.includes(createdChannelCurrency);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeF
|
||||||
import {
|
import {
|
||||||
createShippingRate,
|
createShippingRate,
|
||||||
createShippingZone,
|
createShippingZone,
|
||||||
rateOptions
|
rateOptions,
|
||||||
} from "../../../support/pages/shippingMethodPage";
|
} from "../../../support/pages/shippingMethodPage";
|
||||||
|
|
||||||
describe("As a staff user I want to create shipping zone and rate", () => {
|
describe("As a staff user I want to create shipping zone and rate", () => {
|
||||||
|
@ -53,14 +53,14 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
productsUtils.createTypeAttributeAndCategoryForProduct({
|
productsUtils.createTypeAttributeAndCategoryForProduct({
|
||||||
name: startsWith
|
name: startsWith,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp,
|
category: categoryResp,
|
||||||
attribute: attributeResp
|
attribute: attributeResp,
|
||||||
}) => {
|
}) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
|
@ -74,9 +74,9 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
||||||
categoryId: categoryResp.id,
|
categoryId: categoryResp.id,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
quantityInWarehouse: 10,
|
quantityInWarehouse: 10,
|
||||||
price
|
price,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(({ variantsList: variantsListResp, product }) => {
|
.then(({ variantsList: variantsListResp, product }) => {
|
||||||
variantsList = variantsListResp;
|
variantsList = variantsListResp;
|
||||||
|
@ -89,7 +89,7 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
||||||
quantityInWarehouse: 10,
|
quantityInWarehouse: 10,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
price: secondVariantPrice,
|
price: secondVariantPrice,
|
||||||
weight: 10
|
weight: 10,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(variantsListResp => {
|
.then(variantsListResp => {
|
||||||
|
@ -108,28 +108,28 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
||||||
const shippingName = `${startsWith}${faker.datatype.number()}`;
|
const shippingName = `${startsWith}${faker.datatype.number()}`;
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.shipping
|
ONE_PERMISSION_USERS.shipping,
|
||||||
);
|
);
|
||||||
cy.visit(urlList.shippingMethods).expectSkeletonIsVisible();
|
cy.visit(urlList.shippingMethods).expectSkeletonIsVisible();
|
||||||
createShippingZone(
|
createShippingZone(
|
||||||
shippingName,
|
shippingName,
|
||||||
warehouse.name,
|
warehouse.name,
|
||||||
address.countryFullName,
|
address.countryFullName,
|
||||||
defaultChannel.name
|
defaultChannel.name,
|
||||||
);
|
);
|
||||||
createShippingRate({
|
createShippingRate({
|
||||||
rateName: shippingName,
|
rateName: shippingName,
|
||||||
price,
|
price,
|
||||||
priceLimits: { min: price, max: 100 },
|
priceLimits: { min: price, max: 100 },
|
||||||
rateOption: rateOptions.PRICE_OPTION,
|
rateOption: rateOptions.PRICE_OPTION,
|
||||||
deliveryTime
|
deliveryTime,
|
||||||
});
|
});
|
||||||
createWaitingForCaptureOrder({
|
createWaitingForCaptureOrder({
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "test@example.com",
|
email: "test@example.com",
|
||||||
variantsList,
|
variantsList,
|
||||||
address,
|
address,
|
||||||
shippingMethodName: shippingName
|
shippingMethodName: shippingName,
|
||||||
})
|
})
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
|
@ -138,17 +138,17 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
||||||
email: "test@example.com",
|
email: "test@example.com",
|
||||||
variantsList: secondVariantsList,
|
variantsList: secondVariantsList,
|
||||||
address,
|
address,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
const isShippingAvailable = isShippingAvailableInCheckout(
|
const isShippingAvailable = isShippingAvailableInCheckout(
|
||||||
checkout,
|
checkout,
|
||||||
shippingName
|
shippingName,
|
||||||
);
|
);
|
||||||
expect(isShippingAvailable).to.be.false;
|
expect(isShippingAvailable).to.be.false;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -158,28 +158,28 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
||||||
const shippingName = `${startsWith}${faker.datatype.number()}`;
|
const shippingName = `${startsWith}${faker.datatype.number()}`;
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.shipping
|
ONE_PERMISSION_USERS.shipping,
|
||||||
);
|
);
|
||||||
cy.visit(urlList.shippingMethods).expectSkeletonIsVisible();
|
cy.visit(urlList.shippingMethods).expectSkeletonIsVisible();
|
||||||
createShippingZone(
|
createShippingZone(
|
||||||
shippingName,
|
shippingName,
|
||||||
warehouse.name,
|
warehouse.name,
|
||||||
address.countryFullName,
|
address.countryFullName,
|
||||||
defaultChannel.name
|
defaultChannel.name,
|
||||||
);
|
);
|
||||||
createShippingRate({
|
createShippingRate({
|
||||||
rateName: shippingName,
|
rateName: shippingName,
|
||||||
price,
|
price,
|
||||||
rateOption: rateOptions.WEIGHT_OPTION,
|
rateOption: rateOptions.WEIGHT_OPTION,
|
||||||
deliveryTime,
|
deliveryTime,
|
||||||
weightLimits: { min: 5, max: 10 }
|
weightLimits: { min: 5, max: 10 },
|
||||||
});
|
});
|
||||||
createWaitingForCaptureOrder({
|
createWaitingForCaptureOrder({
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "test@example.com",
|
email: "test@example.com",
|
||||||
variantsList: secondVariantsList,
|
variantsList: secondVariantsList,
|
||||||
address,
|
address,
|
||||||
shippingMethodName: shippingName
|
shippingMethodName: shippingName,
|
||||||
})
|
})
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
|
@ -188,16 +188,16 @@ describe("As a staff user I want to create shipping zone and rate", () => {
|
||||||
email: "test@example.com",
|
email: "test@example.com",
|
||||||
variantsList,
|
variantsList,
|
||||||
address,
|
address,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
const isShippingAvailable = isShippingAvailableInCheckout(
|
const isShippingAvailable = isShippingAvailableInCheckout(
|
||||||
checkout,
|
checkout,
|
||||||
shippingName
|
shippingName,
|
||||||
);
|
);
|
||||||
expect(isShippingAvailable).to.be.false;
|
expect(isShippingAvailable).to.be.false;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,13 +8,13 @@ import {
|
||||||
addChannelToShippingMethod,
|
addChannelToShippingMethod,
|
||||||
createShippingRate,
|
createShippingRate,
|
||||||
createShippingZone,
|
createShippingZone,
|
||||||
getShippingZone
|
getShippingZone,
|
||||||
} from "../../../support/api/requests/ShippingMethod";
|
} from "../../../support/api/requests/ShippingMethod";
|
||||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||||
import {
|
import {
|
||||||
fillUpShippingRate,
|
fillUpShippingRate,
|
||||||
saveRateAfterUpdate
|
saveRateAfterUpdate,
|
||||||
} from "../../../support/pages/shippingMethodPage";
|
} from "../../../support/pages/shippingMethodPage";
|
||||||
|
|
||||||
describe("As a user I should be able to update and delete shipping method", () => {
|
describe("As a user I should be able to update and delete shipping method", () => {
|
||||||
|
@ -46,7 +46,7 @@ describe("As a user I should be able to update and delete shipping method", () =
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
createShippingRate({
|
createShippingRate({
|
||||||
name: rateName,
|
name: rateName,
|
||||||
shippingZone: shippingZone.id
|
shippingZone: shippingZone.id,
|
||||||
}).then(({ shippingMethod: shippingResp }) => {
|
}).then(({ shippingMethod: shippingResp }) => {
|
||||||
shippingMethod = shippingResp;
|
shippingMethod = shippingResp;
|
||||||
addChannelToShippingMethod(shippingMethod.id, defaultChannel.id, 1);
|
addChannelToShippingMethod(shippingMethod.id, defaultChannel.id, 1);
|
||||||
|
@ -64,22 +64,22 @@ describe("As a user I should be able to update and delete shipping method", () =
|
||||||
fillUpShippingRate({
|
fillUpShippingRate({
|
||||||
rateName: updatedRateName,
|
rateName: updatedRateName,
|
||||||
price,
|
price,
|
||||||
deliveryTime
|
deliveryTime,
|
||||||
});
|
});
|
||||||
saveRateAfterUpdate();
|
saveRateAfterUpdate();
|
||||||
getShippingZone(shippingZone.id).then(({ shippingMethods }) => {
|
getShippingZone(shippingZone.id).then(({ shippingMethods }) => {
|
||||||
expect(shippingMethods).to.have.length(1);
|
expect(shippingMethods).to.have.length(1);
|
||||||
expect(shippingMethods[0].minimumDeliveryDays).to.be.eq(
|
expect(shippingMethods[0].minimumDeliveryDays).to.be.eq(
|
||||||
deliveryTime.min
|
deliveryTime.min,
|
||||||
);
|
);
|
||||||
expect(shippingMethods[0].maximumDeliveryDays).to.be.eq(
|
expect(shippingMethods[0].maximumDeliveryDays).to.be.eq(
|
||||||
deliveryTime.max
|
deliveryTime.max,
|
||||||
);
|
);
|
||||||
expect(shippingMethods[0].channelListings[0].price.amount).to.be.eq(
|
expect(shippingMethods[0].channelListings[0].price.amount).to.be.eq(
|
||||||
price
|
price,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -87,14 +87,14 @@ describe("As a user I should be able to update and delete shipping method", () =
|
||||||
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
{ tags: ["@shipping", "@allEnv", "@stable"] },
|
||||||
() => {
|
() => {
|
||||||
cy.visit(
|
cy.visit(
|
||||||
shippingRateUrl(shippingZone.id, shippingMethod.id)
|
shippingRateUrl(shippingZone.id, shippingMethod.id),
|
||||||
).deleteElementWithReqAlias("DeleteShippingRate");
|
).deleteElementWithReqAlias("DeleteShippingRate");
|
||||||
getShippingZone(shippingZone.id).then(({ shippingMethods }) => {
|
getShippingZone(shippingZone.id).then(({ shippingMethods }) => {
|
||||||
const deletedShipping = shippingMethods.find(
|
const deletedShipping = shippingMethods.find(
|
||||||
element => element.id === shippingMethod.id
|
element => element.id === shippingMethod.id,
|
||||||
);
|
);
|
||||||
expect(deletedShipping).to.be.not.ok;
|
expect(deletedShipping).to.be.not.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||||
import { shippingZoneDetailsUrl } from "../../../fixtures/urlList";
|
import { shippingZoneDetailsUrl } from "../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createShippingZone,
|
createShippingZone,
|
||||||
getShippingZone
|
getShippingZone,
|
||||||
} from "../../../support/api/requests/ShippingMethod";
|
} from "../../../support/api/requests/ShippingMethod";
|
||||||
import { createWarehouse } from "../../../support/api/requests/Warehouse";
|
import { createWarehouse } from "../../../support/api/requests/Warehouse";
|
||||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
|
@ -58,7 +58,7 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
country: "Poland",
|
country: "Poland",
|
||||||
shippingName: updatedName,
|
shippingName: updatedName,
|
||||||
warehouseName: name
|
warehouseName: name,
|
||||||
});
|
});
|
||||||
getShippingZone(shippingZone.id).then(shippingZone => {
|
getShippingZone(shippingZone.id).then(shippingZone => {
|
||||||
expect(shippingZone.channels).to.have.length(0);
|
expect(shippingZone.channels).to.have.length(0);
|
||||||
|
@ -67,7 +67,7 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
||||||
expect(shippingZone.warehouses[0].name).to.eq(name);
|
expect(shippingZone.warehouses[0].name).to.eq(name);
|
||||||
expect(shippingZone.countries.find(el => el.code === "PL")).to.be.ok;
|
expect(shippingZone.countries.find(el => el.code === "PL")).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -75,10 +75,10 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
||||||
{ tags: ["@shipping", "@allEnv"] },
|
{ tags: ["@shipping", "@allEnv"] },
|
||||||
() => {
|
() => {
|
||||||
cy.visit(
|
cy.visit(
|
||||||
shippingZoneDetailsUrl(shippingZone.id)
|
shippingZoneDetailsUrl(shippingZone.id),
|
||||||
).deleteElementWithReqAlias("DeleteShippingZone");
|
).deleteElementWithReqAlias("DeleteShippingZone");
|
||||||
getShippingZone(shippingZone.id).should("be.null");
|
getShippingZone(shippingZone.id).should("be.null");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -99,8 +99,8 @@ describe("As a user I should be able to update and delete shipping zone", () =>
|
||||||
.wait("@BulkDeleteShippingZone");
|
.wait("@BulkDeleteShippingZone");
|
||||||
getShippingZone(shippingZone.id).should("be.null");
|
getShippingZone(shippingZone.id).should("be.null");
|
||||||
getShippingZone(secondShippingZone.id).should("be.null");
|
getShippingZone(secondShippingZone.id).should("be.null");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,13 +12,13 @@ import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||||
import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils";
|
import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils";
|
||||||
import {
|
import {
|
||||||
createRateWithPostalCode,
|
createRateWithPostalCode,
|
||||||
postalCodesOptions
|
postalCodesOptions,
|
||||||
} from "../../../support/pages/shippingMethodPage";
|
} from "../../../support/pages/shippingMethodPage";
|
||||||
|
|
||||||
describe("As a user I want to create shipping method with postal codes", () => {
|
describe("As a user I want to create shipping method with postal codes", () => {
|
||||||
|
@ -47,19 +47,19 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
usAddress: usAddressResp,
|
usAddress: usAddressResp,
|
||||||
secondUsAddress: secondUsAddressResp
|
secondUsAddress: secondUsAddressResp,
|
||||||
}) => {
|
}) => {
|
||||||
usAddress = usAddressResp;
|
usAddress = usAddressResp;
|
||||||
secondUsAddress = secondUsAddressResp;
|
secondUsAddress = secondUsAddressResp;
|
||||||
createShippingZone(name, "US", defaultChannel.id);
|
createShippingZone(name, "US", defaultChannel.id);
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(shippingZoneResp => {
|
.then(shippingZoneResp => {
|
||||||
shippingZone = shippingZoneResp;
|
shippingZone = shippingZoneResp;
|
||||||
createWarehouse({
|
createWarehouse({
|
||||||
name,
|
name,
|
||||||
shippingZone: shippingZone.id,
|
shippingZone: shippingZone.id,
|
||||||
address: usAddress
|
address: usAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
|
@ -73,7 +73,7 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
productTypeId: productType.id
|
productTypeId: productType.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ variantsList: variantsListResp }) => {
|
.then(({ variantsList: variantsListResp }) => {
|
||||||
|
@ -98,15 +98,15 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
||||||
price,
|
price,
|
||||||
postalCodeOption: postalCodesOptions.INCLUDE_OPTION,
|
postalCodeOption: postalCodesOptions.INCLUDE_OPTION,
|
||||||
maxPostalCode: usAddress.postalCode,
|
maxPostalCode: usAddress.postalCode,
|
||||||
minPostalCode: usAddress.postalCode
|
minPostalCode: usAddress.postalCode,
|
||||||
});
|
});
|
||||||
isShippingAvailableForAddress(usAddress, rateName).then(
|
isShippingAvailableForAddress(usAddress, rateName).then(
|
||||||
isAvailable => expect(isAvailable).to.be.true
|
isAvailable => expect(isAvailable).to.be.true,
|
||||||
);
|
);
|
||||||
isShippingAvailableForAddress(secondUsAddress, rateName).then(
|
isShippingAvailableForAddress(secondUsAddress, rateName).then(
|
||||||
isAvailable => expect(isAvailable).to.be.false
|
isAvailable => expect(isAvailable).to.be.false,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -120,15 +120,15 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
||||||
price,
|
price,
|
||||||
postalCodeOption: postalCodesOptions.EXCLUDE_OPTION,
|
postalCodeOption: postalCodesOptions.EXCLUDE_OPTION,
|
||||||
maxPostalCode: usAddress.postalCode,
|
maxPostalCode: usAddress.postalCode,
|
||||||
minPostalCode: usAddress.postalCode
|
minPostalCode: usAddress.postalCode,
|
||||||
});
|
});
|
||||||
isShippingAvailableForAddress(usAddress, rateName).then(
|
isShippingAvailableForAddress(usAddress, rateName).then(
|
||||||
isAvailable => expect(isAvailable).to.be.false
|
isAvailable => expect(isAvailable).to.be.false,
|
||||||
);
|
);
|
||||||
isShippingAvailableForAddress(secondUsAddress, rateName).then(
|
isShippingAvailableForAddress(secondUsAddress, rateName).then(
|
||||||
isAvailable => expect(isAvailable).to.be.true
|
isAvailable => expect(isAvailable).to.be.true,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
function isShippingAvailableForAddress(address, rateName) {
|
function isShippingAvailableForAddress(address, rateName) {
|
||||||
|
@ -136,9 +136,9 @@ describe("As a user I want to create shipping method with postal codes", () => {
|
||||||
address,
|
address,
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList
|
variantsList,
|
||||||
}).then(({ checkout }) =>
|
}).then(({ checkout }) =>
|
||||||
isShippingAvailableInCheckout(checkout, rateName)
|
isShippingAvailableInCheckout(checkout, rateName),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,13 +12,13 @@ import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../../support/api/utils/products/productsUtils";
|
} from "../../../../support/api/utils/products/productsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
|
||||||
import { isShippingAvailableInCheckout } from "../../../../support/api/utils/storeFront/checkoutUtils";
|
import { isShippingAvailableInCheckout } from "../../../../support/api/utils/storeFront/checkoutUtils";
|
||||||
import {
|
import {
|
||||||
createShippingRate,
|
createShippingRate,
|
||||||
rateOptions
|
rateOptions,
|
||||||
} from "../../../../support/pages/shippingMethodPage";
|
} from "../../../../support/pages/shippingMethodPage";
|
||||||
|
|
||||||
describe("As a staff user I want to manage shipping weights", () => {
|
describe("As a staff user I want to manage shipping weights", () => {
|
||||||
|
@ -52,7 +52,7 @@ describe("As a staff user I want to manage shipping weights", () => {
|
||||||
createWarehouse({
|
createWarehouse({
|
||||||
name,
|
name,
|
||||||
shippingZone: shippingZone.id,
|
shippingZone: shippingZone.id,
|
||||||
address: usAddress
|
address: usAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
|
@ -67,7 +67,7 @@ describe("As a staff user I want to manage shipping weights", () => {
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
weight: 10
|
weight: 10,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ variantsList: variantsListResp }) => {
|
.then(({ variantsList: variantsListResp }) => {
|
||||||
|
@ -93,21 +93,21 @@ describe("As a staff user I want to manage shipping weights", () => {
|
||||||
rateOption: rateOptions.WEIGHT_OPTION,
|
rateOption: rateOptions.WEIGHT_OPTION,
|
||||||
weightLimits: {
|
weightLimits: {
|
||||||
max: 11,
|
max: 11,
|
||||||
min: 10
|
min: 10,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
createCheckout({
|
createCheckout({
|
||||||
address: usAddress,
|
address: usAddress,
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList
|
variantsList,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.true;
|
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.true;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -122,20 +122,20 @@ describe("As a staff user I want to manage shipping weights", () => {
|
||||||
rateOption: rateOptions.WEIGHT_OPTION,
|
rateOption: rateOptions.WEIGHT_OPTION,
|
||||||
weightLimits: {
|
weightLimits: {
|
||||||
max: 101,
|
max: 101,
|
||||||
min: 100
|
min: 100,
|
||||||
}
|
},
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
createCheckout({
|
createCheckout({
|
||||||
address: usAddress,
|
address: usAddress,
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList
|
variantsList,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.false;
|
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.false;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { SHIPPING_RATE_DETAILS } from "../../../../elements/shipping/shipping-ra
|
||||||
import { shippingRateUrl, urlList } from "../../../../fixtures/urlList";
|
import { shippingRateUrl, urlList } from "../../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createShippingRate as createShippingRateViaApi,
|
createShippingRate as createShippingRateViaApi,
|
||||||
createShippingZone
|
createShippingZone,
|
||||||
} from "../../../../support/api/requests/ShippingMethod";
|
} from "../../../../support/api/requests/ShippingMethod";
|
||||||
import { updateShopWeightUnit } from "../../../../support/api/requests/ShopSettings";
|
import { updateShopWeightUnit } from "../../../../support/api/requests/ShopSettings";
|
||||||
import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../../support/api/utils/channelsUtils";
|
||||||
|
@ -64,7 +64,7 @@ xdescribe("As a staff user I want to change shop default weight unit", () => {
|
||||||
shippingZone: shippingZone.id,
|
shippingZone: shippingZone.id,
|
||||||
type: "WEIGHT",
|
type: "WEIGHT",
|
||||||
maxWeight: maxWeightInKg,
|
maxWeight: maxWeightInKg,
|
||||||
minWeight: minWeightInKg
|
minWeight: minWeightInKg,
|
||||||
})
|
})
|
||||||
.then(({ shippingMethod: shippingMethodResp }) => {
|
.then(({ shippingMethod: shippingMethodResp }) => {
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
|
@ -80,10 +80,10 @@ xdescribe("As a staff user I want to change shop default weight unit", () => {
|
||||||
})
|
})
|
||||||
.then(responseArray => {
|
.then(responseArray => {
|
||||||
const shippingMethods = responseArray.find(
|
const shippingMethods = responseArray.find(
|
||||||
element => element.data.shippingZone
|
element => element.data.shippingZone,
|
||||||
).data.shippingZone.shippingMethods;
|
).data.shippingZone.shippingMethods;
|
||||||
const rate = shippingMethods.find(
|
const rate = shippingMethods.find(
|
||||||
element => element.id === shippingMethod.id
|
element => element.id === shippingMethod.id,
|
||||||
);
|
);
|
||||||
cy.waitForProgressBarToNotBeVisible();
|
cy.waitForProgressBarToNotBeVisible();
|
||||||
expect(rate.minimumOrderWeight.unit).to.eq("G");
|
expect(rate.minimumOrderWeight.unit).to.eq("G");
|
||||||
|
@ -99,6 +99,6 @@ xdescribe("As a staff user I want to change shop default weight unit", () => {
|
||||||
.then(actualMaxWeight => {
|
.then(actualMaxWeight => {
|
||||||
expect(parseInt(actualMaxWeight, 10)).to.eq(maxWeightInG);
|
expect(parseInt(actualMaxWeight, 10)).to.eq(maxWeightInG);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { SITE_SETTINGS_DETAILS } from "../../elements/siteSettings/site-settings
|
||||||
import { urlList } from "../../fixtures/urlList";
|
import { urlList } from "../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
getShopInfo,
|
getShopInfo,
|
||||||
updateShopAddress
|
updateShopAddress,
|
||||||
} from "../../support/api/requests/ShopSettings";
|
} from "../../support/api/requests/ShopSettings";
|
||||||
|
|
||||||
xdescribe("Tests for site settings", () => {
|
xdescribe("Tests for site settings", () => {
|
||||||
|
@ -56,7 +56,7 @@ xdescribe("Tests for site settings", () => {
|
||||||
getShopInfo().then(shopInfo => {
|
getShopInfo().then(shopInfo => {
|
||||||
expect(shopInfo.description).to.eq(description);
|
expect(shopInfo.description).to.eq(description);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -71,6 +71,6 @@ xdescribe("Tests for site settings", () => {
|
||||||
expect(companyAddress.companyName).to.eq(address.companyName);
|
expect(companyAddress.companyName).to.eq(address.companyName);
|
||||||
cy.expectCorrectBasicAddress(companyAddress, address);
|
cy.expectCorrectBasicAddress(companyAddress, address);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,12 +10,12 @@ import { WAREHOUSES_LIST } from "../../../elements/warehouses/warehouses-list";
|
||||||
import {
|
import {
|
||||||
shippingZoneDetailsUrl,
|
shippingZoneDetailsUrl,
|
||||||
urlList,
|
urlList,
|
||||||
warehouseDetailsUrl
|
warehouseDetailsUrl,
|
||||||
} from "../../../fixtures/urlList";
|
} from "../../../fixtures/urlList";
|
||||||
import { createShippingZone } from "../../../support/api/requests/ShippingMethod";
|
import { createShippingZone } from "../../../support/api/requests/ShippingMethod";
|
||||||
import {
|
import {
|
||||||
createWarehouse as createWarehouseViaApi,
|
createWarehouse as createWarehouseViaApi,
|
||||||
getWarehouse
|
getWarehouse,
|
||||||
} from "../../../support/api/requests/Warehouse";
|
} from "../../../support/api/requests/Warehouse";
|
||||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
|
||||||
|
@ -75,7 +75,7 @@ describe("Warehouse settings", () => {
|
||||||
defaultChannel = channelResp;
|
defaultChannel = channelResp;
|
||||||
createWarehouseViaApi({
|
createWarehouseViaApi({
|
||||||
name,
|
name,
|
||||||
address: usAddress
|
address: usAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
|
@ -87,7 +87,7 @@ describe("Warehouse settings", () => {
|
||||||
cy.visit(shippingZoneDetailsUrl(shippingZone.id))
|
cy.visit(shippingZoneDetailsUrl(shippingZone.id))
|
||||||
.fillAutocompleteSelect(
|
.fillAutocompleteSelect(
|
||||||
SHIPPING_ZONE_DETAILS.warehouseSelector,
|
SHIPPING_ZONE_DETAILS.warehouseSelector,
|
||||||
warehouse.name
|
warehouse.name,
|
||||||
)
|
)
|
||||||
.addAliasToGraphRequest("UpdateShippingZone")
|
.addAliasToGraphRequest("UpdateShippingZone")
|
||||||
.get(BUTTON_SELECTORS.confirm)
|
.get(BUTTON_SELECTORS.confirm)
|
||||||
|
@ -97,17 +97,17 @@ describe("Warehouse settings", () => {
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
expect(warehouseResp.shippingZones.edges[0].node.id).to.be.eq(
|
expect(warehouseResp.shippingZones.edges[0].node.id).to.be.eq(
|
||||||
shippingZone.id
|
shippingZone.id,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it("should delete warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
|
it("should delete warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
|
||||||
const name = `${startsWith}${faker.datatype.number()}`;
|
const name = `${startsWith}${faker.datatype.number()}`;
|
||||||
createWarehouseViaApi({
|
createWarehouseViaApi({
|
||||||
name,
|
name,
|
||||||
address: usAddress
|
address: usAddress,
|
||||||
}).then(warehouse => {
|
}).then(warehouse => {
|
||||||
cy.visit(warehouseDetailsUrl(warehouse.id))
|
cy.visit(warehouseDetailsUrl(warehouse.id))
|
||||||
.get(BUTTON_SELECTORS.deleteButton)
|
.get(BUTTON_SELECTORS.deleteButton)
|
||||||
|
@ -139,7 +139,7 @@ describe("Warehouse settings", () => {
|
||||||
createWarehouseViaApi({
|
createWarehouseViaApi({
|
||||||
name,
|
name,
|
||||||
shippingZone: shippingZone.id,
|
shippingZone: shippingZone.id,
|
||||||
address: usAddress
|
address: usAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
|
@ -156,7 +156,7 @@ describe("Warehouse settings", () => {
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
expect(warehouseResp.shippingZones.edges).to.be.empty;
|
expect(warehouseResp.shippingZones.edges).to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it("should update warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
|
it("should update warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
|
||||||
|
@ -166,7 +166,7 @@ describe("Warehouse settings", () => {
|
||||||
|
|
||||||
createWarehouseViaApi({
|
createWarehouseViaApi({
|
||||||
name,
|
name,
|
||||||
address: usAddress
|
address: usAddress,
|
||||||
})
|
})
|
||||||
.then(warehouseResp => {
|
.then(warehouseResp => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { customerDetailsUrl } from "../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
confirmAccount,
|
confirmAccount,
|
||||||
customerRegistration,
|
customerRegistration,
|
||||||
deleteCustomersStartsWith
|
deleteCustomersStartsWith,
|
||||||
} from "../support/api/requests/Customer";
|
} from "../support/api/requests/Customer";
|
||||||
import { getDefaultChannel } from "../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../support/api/utils/channelsUtils";
|
||||||
import { getMailActivationLinkForUser } from "../support/api/utils/users";
|
import { getMailActivationLinkForUser } from "../support/api/utils/users";
|
||||||
|
@ -42,7 +42,7 @@ describe("Tests for customer registration", () => {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.loginUserViaRequest("token", {
|
cy.loginUserViaRequest("token", {
|
||||||
email,
|
email,
|
||||||
password: Cypress.env("USER_PASSWORD")
|
password: Cypress.env("USER_PASSWORD"),
|
||||||
}).its("body.data.tokenCreate");
|
}).its("body.data.tokenCreate");
|
||||||
})
|
})
|
||||||
.then(({ errors, token }) => {
|
.then(({ errors, token }) => {
|
||||||
|
@ -58,12 +58,12 @@ describe("Tests for customer registration", () => {
|
||||||
const duplicatedEmail = Cypress.env("USER_NAME");
|
const duplicatedEmail = Cypress.env("USER_NAME");
|
||||||
customerRegistration({
|
customerRegistration({
|
||||||
duplicatedEmail,
|
duplicatedEmail,
|
||||||
channel: defaultChannel.slug
|
channel: defaultChannel.slug,
|
||||||
}).then(({ user, errors }) => {
|
}).then(({ user, errors }) => {
|
||||||
expect(errors[0].field).to.eq("email");
|
expect(errors[0].field).to.eq("email");
|
||||||
expect(user).to.not.be.ok;
|
expect(user).to.not.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -83,7 +83,7 @@ describe("Tests for customer registration", () => {
|
||||||
.clearSessionData()
|
.clearSessionData()
|
||||||
.loginUserViaRequest("token", {
|
.loginUserViaRequest("token", {
|
||||||
email,
|
email,
|
||||||
password: Cypress.env("USER_PASSWORD")
|
password: Cypress.env("USER_PASSWORD"),
|
||||||
})
|
})
|
||||||
.its("body.data.tokenCreate");
|
.its("body.data.tokenCreate");
|
||||||
})
|
})
|
||||||
|
@ -91,6 +91,6 @@ describe("Tests for customer registration", () => {
|
||||||
expect(errors.length).to.eq(0);
|
expect(errors.length).to.eq(0);
|
||||||
expect(token).to.be.ok;
|
expect(token).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -14,16 +14,16 @@ import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createSaleInChannel,
|
createSaleInChannel,
|
||||||
createSaleInChannelWithProduct,
|
createSaleInChannelWithProduct,
|
||||||
deleteSalesStartsWith
|
deleteSalesStartsWith,
|
||||||
} from "../../support/api/utils/discounts/salesUtils";
|
} from "../../support/api/utils/discounts/salesUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../support/api/utils/products/productsUtils";
|
} from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
|
|
||||||
describe("Create sale with assigned products", () => {
|
describe("Create sale with assigned products", () => {
|
||||||
|
@ -48,7 +48,7 @@ describe("Create sale with assigned products", () => {
|
||||||
name: startsWith,
|
name: startsWith,
|
||||||
type: "FIXED",
|
type: "FIXED",
|
||||||
value: saleValue,
|
value: saleValue,
|
||||||
channelId: channel.id
|
channelId: channel.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(saleResp => (sale = saleResp));
|
.then(saleResp => (sale = saleResp));
|
||||||
|
@ -58,7 +58,7 @@ describe("Create sale with assigned products", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
address,
|
address,
|
||||||
name: startsWith
|
name: startsWith,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
|
@ -66,7 +66,7 @@ describe("Create sale with assigned products", () => {
|
||||||
});
|
});
|
||||||
createTypeAttributeAndCategoryForProduct({
|
createTypeAttributeAndCategoryForProduct({
|
||||||
name: startsWith,
|
name: startsWith,
|
||||||
attributeValues: ["value1", "value2"]
|
attributeValues: ["value1", "value2"],
|
||||||
}).then(({ attribute, category, productType }) => {
|
}).then(({ attribute, category, productType }) => {
|
||||||
productData = {
|
productData = {
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
|
@ -74,7 +74,7 @@ describe("Create sale with assigned products", () => {
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
price: 30
|
price: 30,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -114,26 +114,26 @@ describe("Create sale with assigned products", () => {
|
||||||
channelSlug: channel.slug,
|
channelSlug: channel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
address,
|
address,
|
||||||
variantsList: variantOnSale.concat(variantNotOnSale)
|
variantsList: variantOnSale.concat(variantNotOnSale),
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ checkout }) => {
|
.then(({ checkout }) => {
|
||||||
const variantRespNotOnSale = checkout.lines.find(
|
const variantRespNotOnSale = checkout.lines.find(
|
||||||
element => element.variant.id === variantNotOnSale[0].id
|
element => element.variant.id === variantNotOnSale[0].id,
|
||||||
).variant;
|
).variant;
|
||||||
const variantRespOnSale = checkout.lines.find(
|
const variantRespOnSale = checkout.lines.find(
|
||||||
element => element.variant.id === variantOnSale[0].id
|
element => element.variant.id === variantOnSale[0].id,
|
||||||
).variant;
|
).variant;
|
||||||
expect(variantRespNotOnSale.pricing.onSale).to.be.false;
|
expect(variantRespNotOnSale.pricing.onSale).to.be.false;
|
||||||
expect(variantRespOnSale.pricing.onSale).to.be.true;
|
expect(variantRespOnSale.pricing.onSale).to.be.true;
|
||||||
expect(variantRespNotOnSale.pricing.price.gross.amount).to.eq(
|
expect(variantRespNotOnSale.pricing.price.gross.amount).to.eq(
|
||||||
productData.price
|
productData.price,
|
||||||
);
|
);
|
||||||
expect(variantRespOnSale.pricing.price.gross.amount).to.eq(
|
expect(variantRespOnSale.pricing.price.gross.amount).to.eq(
|
||||||
productData.price - saleValue
|
productData.price - saleValue,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it("should delete sale", { tags: ["@sales", "@allEnv", "@stable"] }, () => {
|
it("should delete sale", { tags: ["@sales", "@allEnv", "@stable"] }, () => {
|
||||||
|
@ -150,7 +150,7 @@ describe("Create sale with assigned products", () => {
|
||||||
type: "FIXED",
|
type: "FIXED",
|
||||||
value: saleValue,
|
value: saleValue,
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
variants
|
variants,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(saleResp => {
|
.then(saleResp => {
|
||||||
|
@ -160,7 +160,7 @@ describe("Create sale with assigned products", () => {
|
||||||
.then(variantResp => {
|
.then(variantResp => {
|
||||||
expect(variantResp.pricing.onSale).to.be.true;
|
expect(variantResp.pricing.onSale).to.be.true;
|
||||||
expect(variantResp.pricing.price.gross.amount).to.eq(
|
expect(variantResp.pricing.price.gross.amount).to.eq(
|
||||||
productData.price - saleValue
|
productData.price - saleValue,
|
||||||
);
|
);
|
||||||
cy.visit(saleDetailsUrl(saleToDelete.id))
|
cy.visit(saleDetailsUrl(saleToDelete.id))
|
||||||
.addAliasToGraphRequest("SaleDelete")
|
.addAliasToGraphRequest("SaleDelete")
|
||||||
|
@ -192,7 +192,7 @@ describe("Create sale with assigned products", () => {
|
||||||
variants = variantsList;
|
variants = variantsList;
|
||||||
updateSale({
|
updateSale({
|
||||||
saleId: sale.id,
|
saleId: sale.id,
|
||||||
variants
|
variants,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -201,7 +201,7 @@ describe("Create sale with assigned products", () => {
|
||||||
.then(variantResp => {
|
.then(variantResp => {
|
||||||
expect(variantResp.pricing.onSale).to.be.true;
|
expect(variantResp.pricing.onSale).to.be.true;
|
||||||
expect(variantResp.pricing.price.gross.amount).to.eq(
|
expect(variantResp.pricing.price.gross.amount).to.eq(
|
||||||
productData.price - saleValue
|
productData.price - saleValue,
|
||||||
);
|
);
|
||||||
cy.visit(saleDetailsUrl(sale.id))
|
cy.visit(saleDetailsUrl(sale.id))
|
||||||
.get(SALES_SELECTORS.variantsTab)
|
.get(SALES_SELECTORS.variantsTab)
|
||||||
|
@ -216,9 +216,9 @@ describe("Create sale with assigned products", () => {
|
||||||
.then(variantResp => {
|
.then(variantResp => {
|
||||||
expect(variantResp.pricing.onSale).to.be.false;
|
expect(variantResp.pricing.onSale).to.be.false;
|
||||||
expect(variantResp.pricing.price.gross.amount).to.eq(
|
expect(variantResp.pricing.price.gross.amount).to.eq(
|
||||||
productData.price
|
productData.price,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,14 +11,14 @@ import { deleteSalesStartsWith } from "../../support/api/utils/discounts/salesUt
|
||||||
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
import { getProductPrice } from "../../support/api/utils/storeFront/storeFrontProductUtils";
|
import { getProductPrice } from "../../support/api/utils/storeFront/storeFrontProductUtils";
|
||||||
import {
|
import {
|
||||||
assignProducts,
|
assignProducts,
|
||||||
createSale,
|
createSale,
|
||||||
createSaleWithNewProduct,
|
createSaleWithNewProduct,
|
||||||
discountOptions
|
discountOptions,
|
||||||
} from "../../support/pages/discounts/salesPage";
|
} from "../../support/pages/discounts/salesPage";
|
||||||
|
|
||||||
xdescribe("Sales discounts for products", () => {
|
xdescribe("Sales discounts for products", () => {
|
||||||
|
@ -44,14 +44,14 @@ xdescribe("Sales discounts for products", () => {
|
||||||
({
|
({
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
|
|
||||||
channelsUtils.getDefaultChannel();
|
channelsUtils.getDefaultChannel();
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
|
@ -62,7 +62,7 @@ xdescribe("Sales discounts for products", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address: addresses.plAddress,
|
address: addresses.plAddress,
|
||||||
price: 100
|
price: 100,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
|
@ -91,12 +91,12 @@ xdescribe("Sales discounts for products", () => {
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: productPrice,
|
price: productPrice,
|
||||||
discountOption: discountOptions.PERCENTAGE,
|
discountOption: discountOptions.PERCENTAGE,
|
||||||
discountValue
|
discountValue,
|
||||||
}).then(price => {
|
}).then(price => {
|
||||||
const expectedPrice = (productPrice * discountValue) / 100;
|
const expectedPrice = (productPrice * discountValue) / 100;
|
||||||
expect(expectedPrice).to.be.eq(price);
|
expect(expectedPrice).to.be.eq(price);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -116,12 +116,12 @@ xdescribe("Sales discounts for products", () => {
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: productPrice,
|
price: productPrice,
|
||||||
discountOption: discountOptions.FIXED,
|
discountOption: discountOptions.FIXED,
|
||||||
discountValue
|
discountValue,
|
||||||
}).then(price => {
|
}).then(price => {
|
||||||
const expectedPrice = productPrice - discountValue;
|
const expectedPrice = productPrice - discountValue;
|
||||||
expect(expectedPrice).to.be.eq(price);
|
expect(expectedPrice).to.be.eq(price);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -135,7 +135,7 @@ xdescribe("Sales discounts for products", () => {
|
||||||
const productPrice = 100;
|
const productPrice = 100;
|
||||||
|
|
||||||
createChannel({ name: saleName }).then(
|
createChannel({ name: saleName }).then(
|
||||||
channelResp => (channel = channelResp)
|
channelResp => (channel = channelResp),
|
||||||
);
|
);
|
||||||
productsUtils
|
productsUtils
|
||||||
.createProductInChannel({
|
.createProductInChannel({
|
||||||
|
@ -145,13 +145,13 @@ xdescribe("Sales discounts for products", () => {
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: productPrice
|
price: productPrice,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
product = productResp;
|
product = productResp;
|
||||||
updateChannelInProduct({
|
updateChannelInProduct({
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
channelId: channel.id
|
channelId: channel.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -165,12 +165,12 @@ xdescribe("Sales discounts for products", () => {
|
||||||
createSale({
|
createSale({
|
||||||
saleName,
|
saleName,
|
||||||
channelName: channel.name,
|
channelName: channel.name,
|
||||||
discountValue
|
discountValue,
|
||||||
});
|
});
|
||||||
assignProducts(product.name);
|
assignProducts(product.name);
|
||||||
getProductPrice(product.id, defaultChannel.slug);
|
getProductPrice(product.id, defaultChannel.slug);
|
||||||
})
|
})
|
||||||
.then(price => expect(price).to.equal(productPrice));
|
.then(price => expect(price).to.equal(productPrice));
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,11 +8,11 @@ import { deleteSalesStartsWith } from "../../support/api/utils/discounts/salesUt
|
||||||
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
import {
|
import {
|
||||||
createSaleWithNewVariant,
|
createSaleWithNewVariant,
|
||||||
discountOptions
|
discountOptions,
|
||||||
} from "../../support/pages/discounts/salesPage";
|
} from "../../support/pages/discounts/salesPage";
|
||||||
|
|
||||||
xdescribe("Sales discounts for variant", () => {
|
xdescribe("Sales discounts for variant", () => {
|
||||||
|
@ -37,14 +37,14 @@ xdescribe("Sales discounts for variant", () => {
|
||||||
({
|
({
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
|
|
||||||
channelsUtils.getDefaultChannel();
|
channelsUtils.getDefaultChannel();
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
|
@ -55,7 +55,7 @@ xdescribe("Sales discounts for variant", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address: addresses.plAddress,
|
address: addresses.plAddress,
|
||||||
price: 100
|
price: 100,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
|
@ -84,13 +84,13 @@ xdescribe("Sales discounts for variant", () => {
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: productPrice,
|
price: productPrice,
|
||||||
discountOption: discountOptions.PERCENTAGE,
|
discountOption: discountOptions.PERCENTAGE,
|
||||||
discountValue
|
discountValue,
|
||||||
}).then(({ pricing }) => {
|
}).then(({ pricing }) => {
|
||||||
const priceInResponse = pricing.price.gross.amount;
|
const priceInResponse = pricing.price.gross.amount;
|
||||||
const expectedPrice = (productPrice * discountValue) / 100;
|
const expectedPrice = (productPrice * discountValue) / 100;
|
||||||
expect(expectedPrice).to.be.eq(priceInResponse);
|
expect(expectedPrice).to.be.eq(priceInResponse);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -110,12 +110,12 @@ xdescribe("Sales discounts for variant", () => {
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: productPrice,
|
price: productPrice,
|
||||||
discountOption: discountOptions.FIXED,
|
discountOption: discountOptions.FIXED,
|
||||||
discountValue
|
discountValue,
|
||||||
}).then(({ pricing }) => {
|
}).then(({ pricing }) => {
|
||||||
const priceInResponse = pricing.price.gross.amount;
|
const priceInResponse = pricing.price.gross.amount;
|
||||||
const expectedPrice = productPrice - discountValue;
|
const expectedPrice = productPrice - discountValue;
|
||||||
expect(expectedPrice).to.be.eq(priceInResponse);
|
expect(expectedPrice).to.be.eq(priceInResponse);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,14 +10,14 @@ import * as channelsUtils from "../../../support/api/utils/channelsUtils";
|
||||||
import { deleteVouchersStartsWith } from "../../../support/api/utils/discounts/vouchersUtils";
|
import { deleteVouchersStartsWith } from "../../../support/api/utils/discounts/vouchersUtils";
|
||||||
import {
|
import {
|
||||||
addPayment,
|
addPayment,
|
||||||
createCheckoutWithVoucher
|
createCheckoutWithVoucher,
|
||||||
} from "../../../support/api/utils/ordersUtils";
|
} from "../../../support/api/utils/ordersUtils";
|
||||||
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
||||||
import filterTests from "../../../support/filterTests";
|
import filterTests from "../../../support/filterTests";
|
||||||
import {
|
import {
|
||||||
createVoucher,
|
createVoucher,
|
||||||
discountOptions,
|
discountOptions,
|
||||||
loginAndCreateCheckoutForVoucherWithDiscount
|
loginAndCreateCheckoutForVoucherWithDiscount,
|
||||||
} from "../../../support/pages/discounts/vouchersPage";
|
} from "../../../support/pages/discounts/vouchersPage";
|
||||||
|
|
||||||
describe("As an admin I want to create voucher", () => {
|
describe("As an admin I want to create voucher", () => {
|
||||||
|
@ -44,14 +44,14 @@ describe("As an admin I want to create voucher", () => {
|
||||||
variantsList: variantsResp,
|
variantsList: variantsResp,
|
||||||
defaultChannel: channel,
|
defaultChannel: channel,
|
||||||
shippingMethod: shippingMethodResp,
|
shippingMethod: shippingMethodResp,
|
||||||
address: addressResp
|
address: addressResp,
|
||||||
}) => {
|
}) => {
|
||||||
variants = variantsResp;
|
variants = variantsResp;
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
address = addressResp;
|
address = addressResp;
|
||||||
createChannel({ name });
|
createChannel({ name });
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
createdChannel = channel;
|
createdChannel = channel;
|
||||||
|
@ -60,7 +60,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
variantsList: variants,
|
variantsList: variants,
|
||||||
address,
|
address,
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -79,11 +79,11 @@ describe("As an admin I want to create voucher", () => {
|
||||||
voucherValue,
|
voucherValue,
|
||||||
voucherCode,
|
voucherCode,
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
dataForCheckout
|
dataForCheckout,
|
||||||
})
|
})
|
||||||
.then(({ addPromoCodeResp, checkout: checkoutResp }) => {
|
.then(({ addPromoCodeResp, checkout: checkoutResp }) => {
|
||||||
expect(addPromoCodeResp.checkout.totalPrice.gross.amount).to.be.eq(
|
expect(addPromoCodeResp.checkout.totalPrice.gross.amount).to.be.eq(
|
||||||
expectedAmount
|
expectedAmount,
|
||||||
);
|
);
|
||||||
dataForCheckout.voucherCode = voucherCode;
|
dataForCheckout.voucherCode = voucherCode;
|
||||||
checkout = checkoutResp;
|
checkout = checkoutResp;
|
||||||
|
@ -95,7 +95,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -113,11 +113,11 @@ describe("As an admin I want to create voucher", () => {
|
||||||
voucherValue,
|
voucherValue,
|
||||||
voucherCode,
|
voucherCode,
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
dataForCheckout
|
dataForCheckout,
|
||||||
})
|
})
|
||||||
.then(({ addPromoCodeResp, checkout: checkoutResp }) => {
|
.then(({ addPromoCodeResp, checkout: checkoutResp }) => {
|
||||||
expect(addPromoCodeResp.checkout.totalPrice.gross.amount).to.be.eq(
|
expect(addPromoCodeResp.checkout.totalPrice.gross.amount).to.be.eq(
|
||||||
expectedAmount
|
expectedAmount,
|
||||||
);
|
);
|
||||||
dataForCheckout.voucherCode = voucherCode;
|
dataForCheckout.voucherCode = voucherCode;
|
||||||
checkout = checkoutResp;
|
checkout = checkoutResp;
|
||||||
|
@ -129,7 +129,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -144,11 +144,11 @@ describe("As an admin I want to create voucher", () => {
|
||||||
discount: discountOptions.SHIPPING,
|
discount: discountOptions.SHIPPING,
|
||||||
voucherCode,
|
voucherCode,
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
dataForCheckout
|
dataForCheckout,
|
||||||
})
|
})
|
||||||
.then(({ addPromoCodeResp, checkout: checkoutResp }) => {
|
.then(({ addPromoCodeResp, checkout: checkoutResp }) => {
|
||||||
expect(addPromoCodeResp.checkout.totalPrice.gross.amount).to.be.eq(
|
expect(addPromoCodeResp.checkout.totalPrice.gross.amount).to.be.eq(
|
||||||
expectedAmount
|
expectedAmount,
|
||||||
);
|
);
|
||||||
dataForCheckout.voucherCode = voucherCode;
|
dataForCheckout.voucherCode = voucherCode;
|
||||||
checkout = checkoutResp;
|
checkout = checkoutResp;
|
||||||
|
@ -160,7 +160,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -178,15 +178,15 @@ describe("As an admin I want to create voucher", () => {
|
||||||
voucherCode: randomName,
|
voucherCode: randomName,
|
||||||
voucherValue,
|
voucherValue,
|
||||||
discountOption: discountOptions.PERCENTAGE,
|
discountOption: discountOptions.PERCENTAGE,
|
||||||
channelName: createdChannel.name
|
channelName: createdChannel.name,
|
||||||
});
|
});
|
||||||
dataForCheckout.voucherCode = randomName;
|
dataForCheckout.voucherCode = randomName;
|
||||||
createCheckoutWithVoucher(dataForCheckout).then(
|
createCheckoutWithVoucher(dataForCheckout).then(
|
||||||
({ addPromoCodeResp }) => {
|
({ addPromoCodeResp }) => {
|
||||||
const errorField = addPromoCodeResp.errors[0].field;
|
const errorField = addPromoCodeResp.errors[0].field;
|
||||||
expect(errorField).to.be.eq("promoCode");
|
expect(errorField).to.be.eq("promoCode");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,12 +8,12 @@ import * as channelsUtils from "../../../support/api/utils/channelsUtils";
|
||||||
import { deleteVouchersStartsWith } from "../../../support/api/utils/discounts/vouchersUtils";
|
import { deleteVouchersStartsWith } from "../../../support/api/utils/discounts/vouchersUtils";
|
||||||
import {
|
import {
|
||||||
addPayment,
|
addPayment,
|
||||||
createCheckoutWithVoucher
|
createCheckoutWithVoucher,
|
||||||
} from "../../../support/api/utils/ordersUtils";
|
} from "../../../support/api/utils/ordersUtils";
|
||||||
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
discountOptions,
|
discountOptions,
|
||||||
loginAndCreateCheckoutForVoucherWithDiscount
|
loginAndCreateCheckoutForVoucherWithDiscount,
|
||||||
} from "../../../support/pages/discounts/vouchersPage";
|
} from "../../../support/pages/discounts/vouchersPage";
|
||||||
|
|
||||||
describe("As an admin I want to create voucher", () => {
|
describe("As an admin I want to create voucher", () => {
|
||||||
|
@ -39,7 +39,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
variantsList: variantsResp,
|
variantsList: variantsResp,
|
||||||
defaultChannel: channel,
|
defaultChannel: channel,
|
||||||
shippingMethod: shippingMethodResp,
|
shippingMethod: shippingMethodResp,
|
||||||
address: addressResp
|
address: addressResp,
|
||||||
}) => {
|
}) => {
|
||||||
variants = variantsResp;
|
variants = variantsResp;
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
|
@ -50,9 +50,9 @@ describe("As an admin I want to create voucher", () => {
|
||||||
variantsList: variants,
|
variantsList: variants,
|
||||||
address,
|
address,
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
voucherCode,
|
voucherCode,
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
dataForCheckout,
|
dataForCheckout,
|
||||||
usageLimit
|
usageLimit,
|
||||||
})
|
})
|
||||||
.then(({ checkout, addPromoCodeResp }) => {
|
.then(({ checkout, addPromoCodeResp }) => {
|
||||||
expect(addPromoCodeResp.errors).to.be.empty;
|
expect(addPromoCodeResp.errors).to.be.empty;
|
||||||
|
@ -88,10 +88,10 @@ describe("As an admin I want to create voucher", () => {
|
||||||
.then(({ addPromoCodeResp }) => {
|
.then(({ addPromoCodeResp }) => {
|
||||||
const errorField = addPromoCodeResp.errors[0].field;
|
const errorField = addPromoCodeResp.errors[0].field;
|
||||||
expect(errorField, "error in promo code should occur").to.be.eq(
|
expect(errorField, "error in promo code should occur").to.be.eq(
|
||||||
"promoCode"
|
"promoCode",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -109,7 +109,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
voucherCode,
|
voucherCode,
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
dataForCheckout,
|
dataForCheckout,
|
||||||
applyOnePerCustomer: true
|
applyOnePerCustomer: true,
|
||||||
})
|
})
|
||||||
.then(({ checkout, addPromoCodeResp }) => {
|
.then(({ checkout, addPromoCodeResp }) => {
|
||||||
expect(addPromoCodeResp.errors).to.be.empty;
|
expect(addPromoCodeResp.errors).to.be.empty;
|
||||||
|
@ -127,7 +127,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
.then(({ addPromoCodeResp }) => {
|
.then(({ addPromoCodeResp }) => {
|
||||||
const errorField = addPromoCodeResp.errors[0].field;
|
const errorField = addPromoCodeResp.errors[0].field;
|
||||||
expect(errorField, "error in promo code should occur").to.be.eq(
|
expect(errorField, "error in promo code should occur").to.be.eq(
|
||||||
"promoCode"
|
"promoCode",
|
||||||
);
|
);
|
||||||
|
|
||||||
// Create new checkout as other not logged in customer - voucher should be available for other customer
|
// Create new checkout as other not logged in customer - voucher should be available for other customer
|
||||||
|
@ -140,7 +140,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
const errorField = addPromoCodeResp.errors;
|
const errorField = addPromoCodeResp.errors;
|
||||||
expect(errorField, "No errors when adding promo code").to.be.empty;
|
expect(errorField, "No errors when adding promo code").to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -158,7 +158,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
voucherCode,
|
voucherCode,
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
dataForCheckout,
|
dataForCheckout,
|
||||||
onlyStaff: true
|
onlyStaff: true,
|
||||||
})
|
})
|
||||||
.then(({ checkout, addPromoCodeResp }) => {
|
.then(({ checkout, addPromoCodeResp }) => {
|
||||||
expect(addPromoCodeResp.errors).to.be.empty;
|
expect(addPromoCodeResp.errors).to.be.empty;
|
||||||
|
@ -176,10 +176,10 @@ describe("As an admin I want to create voucher", () => {
|
||||||
.then(({ addPromoCodeResp }) => {
|
.then(({ addPromoCodeResp }) => {
|
||||||
const errorField = addPromoCodeResp.errors[0].field;
|
const errorField = addPromoCodeResp.errors[0].field;
|
||||||
expect(errorField, "error in promo code should occur").to.be.eq(
|
expect(errorField, "error in promo code should occur").to.be.eq(
|
||||||
"promoCode"
|
"promoCode",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -197,14 +197,14 @@ describe("As an admin I want to create voucher", () => {
|
||||||
voucherCode,
|
voucherCode,
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
dataForCheckout,
|
dataForCheckout,
|
||||||
minOrderValue
|
minOrderValue,
|
||||||
})
|
})
|
||||||
.then(({ addPromoCodeResp }) => {
|
.then(({ addPromoCodeResp }) => {
|
||||||
const errorField = addPromoCodeResp.errors[0].field;
|
const errorField = addPromoCodeResp.errors[0].field;
|
||||||
dataForCheckout.voucherCode = voucherCode;
|
dataForCheckout.voucherCode = voucherCode;
|
||||||
|
|
||||||
expect(errorField, "error in promo code should occur").to.be.eq(
|
expect(errorField, "error in promo code should occur").to.be.eq(
|
||||||
"promoCode"
|
"promoCode",
|
||||||
);
|
);
|
||||||
dataForCheckout.productQuantity = 2;
|
dataForCheckout.productQuantity = 2;
|
||||||
createCheckoutWithVoucher(dataForCheckout);
|
createCheckoutWithVoucher(dataForCheckout);
|
||||||
|
@ -213,7 +213,7 @@ describe("As an admin I want to create voucher", () => {
|
||||||
const errorField = addPromoCodeResp.errors;
|
const errorField = addPromoCodeResp.errors;
|
||||||
expect(errorField, "No errors when adding promo code").to.be.empty;
|
expect(errorField, "No errors when adding promo code").to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit("should create voucher with min product quantity. TC: SALEOR_1911", () => {
|
xit("should create voucher with min product quantity. TC: SALEOR_1911", () => {
|
||||||
|
@ -228,14 +228,14 @@ describe("As an admin I want to create voucher", () => {
|
||||||
voucherCode,
|
voucherCode,
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
dataForCheckout,
|
dataForCheckout,
|
||||||
minAmountOfItems
|
minAmountOfItems,
|
||||||
})
|
})
|
||||||
.then(({ addPromoCodeResp }) => {
|
.then(({ addPromoCodeResp }) => {
|
||||||
const errorField = addPromoCodeResp.errors[0].field;
|
const errorField = addPromoCodeResp.errors[0].field;
|
||||||
dataForCheckout.voucherCode = voucherCode;
|
dataForCheckout.voucherCode = voucherCode;
|
||||||
|
|
||||||
expect(errorField, "error in promo code should occur").to.be.eq(
|
expect(errorField, "error in promo code should occur").to.be.eq(
|
||||||
"promoCode"
|
"promoCode",
|
||||||
);
|
);
|
||||||
dataForCheckout.productQuantity = 2;
|
dataForCheckout.productQuantity = 2;
|
||||||
createCheckoutWithVoucher(dataForCheckout);
|
createCheckoutWithVoucher(dataForCheckout);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||||
import { voucherDetailsUrl } from "../../../fixtures/urlList";
|
import { voucherDetailsUrl } from "../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createVoucherInChannel,
|
createVoucherInChannel,
|
||||||
deleteVouchersStartsWith
|
deleteVouchersStartsWith,
|
||||||
} from "../../../support/api/utils/discounts/vouchersUtils";
|
} from "../../../support/api/utils/discounts/vouchersUtils";
|
||||||
import { createCheckoutWithVoucher } from "../../../support/api/utils/ordersUtils";
|
import { createCheckoutWithVoucher } from "../../../support/api/utils/ordersUtils";
|
||||||
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
|
||||||
|
@ -36,7 +36,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
defaultChannel: channel,
|
defaultChannel: channel,
|
||||||
shippingMethod: shippingMethodResp,
|
shippingMethod: shippingMethodResp,
|
||||||
address: addressResp,
|
address: addressResp,
|
||||||
product: productResp
|
product: productResp,
|
||||||
}) => {
|
}) => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
product = productResp;
|
product = productResp;
|
||||||
|
@ -46,9 +46,9 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
variantsList: variantsResp,
|
variantsList: variantsResp,
|
||||||
address: addressResp,
|
address: addressResp,
|
||||||
shippingMethodName: shippingMethodResp.name,
|
shippingMethodName: shippingMethodResp.name,
|
||||||
auth: "token"
|
auth: "token",
|
||||||
};
|
};
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
name,
|
name,
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
value: voucherValue
|
value: voucherValue,
|
||||||
})
|
})
|
||||||
.then(voucherResp => {
|
.then(voucherResp => {
|
||||||
voucher = voucherResp;
|
voucher = voucherResp;
|
||||||
|
@ -85,7 +85,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
const errorField = addPromoCodeResp.errors[0].field;
|
const errorField = addPromoCodeResp.errors[0].field;
|
||||||
expect(errorField).to.be.eq("promoCode");
|
expect(errorField).to.be.eq("promoCode");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -107,7 +107,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
name,
|
name,
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
value: voucherValue
|
value: voucherValue,
|
||||||
})
|
})
|
||||||
.then(voucherResp => {
|
.then(voucherResp => {
|
||||||
voucher = voucherResp;
|
voucher = voucherResp;
|
||||||
|
@ -128,7 +128,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
const amount = addPromoCodeResp.checkout.totalPrice.gross.amount;
|
const amount = addPromoCodeResp.checkout.totalPrice.gross.amount;
|
||||||
expect(amount).to.be.eq(expectedOrderAmount);
|
expect(amount).to.be.eq(expectedOrderAmount);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -149,7 +149,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
name,
|
name,
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
value: voucherValue
|
value: voucherValue,
|
||||||
})
|
})
|
||||||
.then(voucherResp => {
|
.then(voucherResp => {
|
||||||
voucher = voucherResp;
|
voucher = voucherResp;
|
||||||
|
@ -168,7 +168,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
.then(({ addPromoCodeResp }) => {
|
.then(({ addPromoCodeResp }) => {
|
||||||
expect(addPromoCodeResp.errors).to.be.empty;
|
expect(addPromoCodeResp.errors).to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -189,7 +189,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
name,
|
name,
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
value: voucherValue
|
value: voucherValue,
|
||||||
})
|
})
|
||||||
.then(voucherResp => {
|
.then(voucherResp => {
|
||||||
voucher = voucherResp;
|
voucher = voucherResp;
|
||||||
|
@ -198,7 +198,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
voucherId: voucher.id,
|
voucherId: voucher.id,
|
||||||
endDate: todayDate,
|
endDate: todayDate,
|
||||||
endTime: formatTime(today),
|
endTime: formatTime(today),
|
||||||
hasEndDate: true
|
hasEndDate: true,
|
||||||
});
|
});
|
||||||
dataForCheckout.voucherCode = voucher.code;
|
dataForCheckout.voucherCode = voucher.code;
|
||||||
createCheckoutWithVoucher(dataForCheckout);
|
createCheckoutWithVoucher(dataForCheckout);
|
||||||
|
@ -209,7 +209,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
setVoucherDate({
|
setVoucherDate({
|
||||||
voucherId: voucher.id,
|
voucherId: voucher.id,
|
||||||
endDate: tomorrowDate,
|
endDate: tomorrowDate,
|
||||||
endTime: formatTime(tomorrow)
|
endTime: formatTime(tomorrow),
|
||||||
});
|
});
|
||||||
dataForCheckout.voucherCode = voucher.code;
|
dataForCheckout.voucherCode = voucher.code;
|
||||||
createCheckoutWithVoucher(dataForCheckout);
|
createCheckoutWithVoucher(dataForCheckout);
|
||||||
|
@ -217,7 +217,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
.then(({ addPromoCodeResp }) => {
|
.then(({ addPromoCodeResp }) => {
|
||||||
expect(addPromoCodeResp.errors).to.be.empty;
|
expect(addPromoCodeResp.errors).to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -236,7 +236,7 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
value: voucherValue,
|
value: voucherValue,
|
||||||
type: "SHIPPING",
|
type: "SHIPPING",
|
||||||
country: "US"
|
country: "US",
|
||||||
})
|
})
|
||||||
.then(voucherResp => {
|
.then(voucherResp => {
|
||||||
voucher = voucherResp;
|
voucher = voucherResp;
|
||||||
|
@ -268,6 +268,6 @@ describe("As an admin I want to update vouchers", () => {
|
||||||
const errorField = addPromoCodeResp.errors[0].field;
|
const errorField = addPromoCodeResp.errors[0].field;
|
||||||
expect(errorField).to.be.eq("promoCode");
|
expect(errorField).to.be.eq("promoCode");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,9 +12,9 @@ describe("Displaying welcome message on home page", () => {
|
||||||
() => {
|
() => {
|
||||||
cy.loginUserViaRequest().visit(urlList.homePage);
|
cy.loginUserViaRequest().visit(urlList.homePage);
|
||||||
expectWelcomeMessageIncludes(
|
expectWelcomeMessageIncludes(
|
||||||
`${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}`
|
`${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}`,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -23,7 +23,7 @@ describe("Displaying welcome message on home page", () => {
|
||||||
() => {
|
() => {
|
||||||
cy.loginUserViaRequest("auth", USER_WITHOUT_NAME).visit(urlList.homePage);
|
cy.loginUserViaRequest("auth", USER_WITHOUT_NAME).visit(urlList.homePage);
|
||||||
expectWelcomeMessageIncludes(`${USER_WITHOUT_NAME.email}`);
|
expectWelcomeMessageIncludes(`${USER_WITHOUT_NAME.email}`);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -35,8 +35,8 @@ describe("Displaying welcome message on home page", () => {
|
||||||
.waitForProgressBarToNotExist()
|
.waitForProgressBarToNotExist()
|
||||||
.reload(true);
|
.reload(true);
|
||||||
expectWelcomeMessageIncludes(
|
expectWelcomeMessageIncludes(
|
||||||
`${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}`
|
`${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}`,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { createCustomer } from "../../support/api/requests/Customer";
|
||||||
import * as homePageUtils from "../../support/api/utils/homePageUtils";
|
import * as homePageUtils from "../../support/api/utils/homePageUtils";
|
||||||
import {
|
import {
|
||||||
createReadyToFulfillOrder,
|
createReadyToFulfillOrder,
|
||||||
createWaitingForCaptureOrder
|
createWaitingForCaptureOrder,
|
||||||
} from "../../support/api/utils/ordersUtils";
|
} from "../../support/api/utils/ordersUtils";
|
||||||
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
||||||
import filterTests from "../../support/filterTests";
|
import filterTests from "../../support/filterTests";
|
||||||
|
@ -19,7 +19,7 @@ import {
|
||||||
getOrdersReadyToFulfillRegex,
|
getOrdersReadyToFulfillRegex,
|
||||||
getProductsOutOfStockRegex,
|
getProductsOutOfStockRegex,
|
||||||
getSalesAmountRegex,
|
getSalesAmountRegex,
|
||||||
getTodaysOrdersRegex
|
getTodaysOrdersRegex,
|
||||||
} from "../../support/pages/homePage";
|
} from "../../support/pages/homePage";
|
||||||
|
|
||||||
describe("As an admin I want to see correct information on dashboard home page", () => {
|
describe("As an admin I want to see correct information on dashboard home page", () => {
|
||||||
|
@ -52,7 +52,7 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
name: randomName,
|
name: randomName,
|
||||||
productPrice,
|
productPrice,
|
||||||
shippingPrice,
|
shippingPrice,
|
||||||
newChannel: true
|
newChannel: true,
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
createdVariants = resp.variantsList;
|
createdVariants = resp.variantsList;
|
||||||
|
@ -65,7 +65,7 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
productType = resp.productType;
|
productType = resp.productType;
|
||||||
|
|
||||||
createCustomer(randomEmail, randomName, address).then(
|
createCustomer(randomEmail, randomName, address).then(
|
||||||
customerResp => (customer = customerResp)
|
customerResp => (customer = customerResp),
|
||||||
);
|
);
|
||||||
|
|
||||||
homePageUtils
|
homePageUtils
|
||||||
|
@ -73,7 +73,7 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
.then(ordersReadyToFulfillBefore => {
|
.then(ordersReadyToFulfillBefore => {
|
||||||
ordersReadyToFulfillRegexp = getOrdersReadyToFulfillRegex(
|
ordersReadyToFulfillRegexp = getOrdersReadyToFulfillRegex(
|
||||||
ordersReadyToFulfillBefore,
|
ordersReadyToFulfillBefore,
|
||||||
1
|
1,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
.then(ordersReadyForCaptureBefore => {
|
.then(ordersReadyForCaptureBefore => {
|
||||||
ordersReadyForCaptureRegexp = getOrdersReadyForCaptureRegex(
|
ordersReadyForCaptureRegexp = getOrdersReadyForCaptureRegex(
|
||||||
ordersReadyForCaptureBefore,
|
ordersReadyForCaptureBefore,
|
||||||
1
|
1,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -91,14 +91,14 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
.then(productsOutOfStockBefore => {
|
.then(productsOutOfStockBefore => {
|
||||||
productsOutOfStockRegexp = getProductsOutOfStockRegex(
|
productsOutOfStockRegexp = getProductsOutOfStockRegex(
|
||||||
productsOutOfStockBefore,
|
productsOutOfStockBefore,
|
||||||
1
|
1,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
homePageUtils.getSalesAmount(defaultChannel.slug).then(salesAmount => {
|
homePageUtils.getSalesAmount(defaultChannel.slug).then(salesAmount => {
|
||||||
salesAmountRegexp = getSalesAmountRegex(
|
salesAmountRegexp = getSalesAmountRegex(
|
||||||
salesAmount,
|
salesAmount,
|
||||||
productPrice * 2 + shippingPrice
|
productPrice * 2 + shippingPrice,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
shippingMethodId: shippingMethod.id,
|
shippingMethodId: shippingMethod.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
variantsList: createdVariants,
|
variantsList: createdVariants,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
|
|
||||||
createWaitingForCaptureOrder({
|
createWaitingForCaptureOrder({
|
||||||
|
@ -122,7 +122,7 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
email: randomEmail,
|
email: randomEmail,
|
||||||
variantsList: createdVariants,
|
variantsList: createdVariants,
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
|
|
||||||
const productOutOfStockRandomName =
|
const productOutOfStockRandomName =
|
||||||
|
@ -136,7 +136,7 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: productPrice
|
price: productPrice,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -154,19 +154,19 @@ describe("As an admin I want to see correct information on dashboard home page",
|
||||||
cy.contains(HOMEPAGE_SELECTORS.orders, ordersRegexp).should("be.visible");
|
cy.contains(HOMEPAGE_SELECTORS.orders, ordersRegexp).should("be.visible");
|
||||||
cy.contains(
|
cy.contains(
|
||||||
HOMEPAGE_SELECTORS.ordersReadyToFulfill,
|
HOMEPAGE_SELECTORS.ordersReadyToFulfill,
|
||||||
ordersReadyToFulfillRegexp
|
ordersReadyToFulfillRegexp,
|
||||||
).should("be.visible");
|
).should("be.visible");
|
||||||
cy.contains(
|
cy.contains(
|
||||||
HOMEPAGE_SELECTORS.paymentsWaitingForCapture,
|
HOMEPAGE_SELECTORS.paymentsWaitingForCapture,
|
||||||
ordersReadyForCaptureRegexp
|
ordersReadyForCaptureRegexp,
|
||||||
).should("be.visible");
|
).should("be.visible");
|
||||||
cy.contains(HOMEPAGE_SELECTORS.sales, salesAmountRegexp).should(
|
cy.contains(HOMEPAGE_SELECTORS.sales, salesAmountRegexp).should(
|
||||||
"be.visible"
|
"be.visible",
|
||||||
);
|
);
|
||||||
cy.contains(
|
cy.contains(
|
||||||
HOMEPAGE_SELECTORS.productsOutOfStock,
|
HOMEPAGE_SELECTORS.productsOutOfStock,
|
||||||
productsOutOfStockRegexp
|
productsOutOfStockRegexp,
|
||||||
).should("be.visible");
|
).should("be.visible");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe("User authorization", () => {
|
||||||
cy.visit(urlList.homePage);
|
cy.visit(urlList.homePage);
|
||||||
cy.loginUser();
|
cy.loginUser();
|
||||||
cy.get(LOGIN_SELECTORS.welcomePage).should("be.visible");
|
cy.get(LOGIN_SELECTORS.welcomePage).should("be.visible");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -33,7 +33,7 @@ describe("User authorization", () => {
|
||||||
.click()
|
.click()
|
||||||
.get(LOGIN_SELECTORS.warningCredentialMessage)
|
.get(LOGIN_SELECTORS.warningCredentialMessage)
|
||||||
.should("be.visible");
|
.should("be.visible");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -49,6 +49,6 @@ describe("User authorization", () => {
|
||||||
.click()
|
.click()
|
||||||
.get(LOGIN_SELECTORS.emailAddressInput)
|
.get(LOGIN_SELECTORS.emailAddressInput)
|
||||||
.should("be.visible");
|
.should("be.visible");
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@ import faker from "faker";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
updateMetadata,
|
updateMetadata,
|
||||||
updatePrivateMetadata
|
updatePrivateMetadata,
|
||||||
} from "../support/api/requests/Metadata";
|
} from "../support/api/requests/Metadata";
|
||||||
import { createDraftOrder, getOrder } from "../support/api/requests/Order";
|
import { createDraftOrder, getOrder } from "../support/api/requests/Order";
|
||||||
import { getProductMetadata } from "../support/api/requests/storeFront/ProductDetails";
|
import { getProductMetadata } from "../support/api/requests/storeFront/ProductDetails";
|
||||||
|
@ -12,7 +12,7 @@ import { getDefaultChannel } from "../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../support/api/utils/products/productsUtils";
|
} from "../support/api/utils/products/productsUtils";
|
||||||
|
|
||||||
describe("Test for metadata", () => {
|
describe("Test for metadata", () => {
|
||||||
|
@ -36,7 +36,7 @@ describe("Test for metadata", () => {
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
name,
|
name,
|
||||||
productTypeId: productType.id
|
productTypeId: productType.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
|
@ -56,7 +56,7 @@ describe("Test for metadata", () => {
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
channelSlug: channel.slug,
|
channelSlug: channel.slug,
|
||||||
auth: "auth",
|
auth: "auth",
|
||||||
withPrivateMetadata: true
|
withPrivateMetadata: true,
|
||||||
}).its("data");
|
}).its("data");
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
|
@ -68,7 +68,7 @@ describe("Test for metadata", () => {
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
channelSlug: channel.slug,
|
channelSlug: channel.slug,
|
||||||
auth: "token",
|
auth: "token",
|
||||||
withPrivateMetadata: true
|
withPrivateMetadata: true,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ errors }) => {
|
.then(({ errors }) => {
|
||||||
|
@ -77,14 +77,14 @@ describe("Test for metadata", () => {
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
channelSlug: channel.slug,
|
channelSlug: channel.slug,
|
||||||
auth: "token",
|
auth: "token",
|
||||||
withPrivateMetadata: false
|
withPrivateMetadata: false,
|
||||||
}).its("data");
|
}).its("data");
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
expect(productResp.metadata[0].key).to.eq(metadata.key);
|
expect(productResp.metadata[0].key).to.eq(metadata.key);
|
||||||
expect(productResp.metadata[0].value).to.eq(metadata.value);
|
expect(productResp.metadata[0].value).to.eq(metadata.value);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
it(
|
it(
|
||||||
"should create metadata for order",
|
"should create metadata for order",
|
||||||
|
@ -107,6 +107,6 @@ describe("Test for metadata", () => {
|
||||||
expect(orderResp.privateMetadata[0].key).to.eq(metadata.key);
|
expect(orderResp.privateMetadata[0].key).to.eq(metadata.key);
|
||||||
expect(orderResp.privateMetadata[0].value).to.eq(metadata.value);
|
expect(orderResp.privateMetadata[0].value).to.eq(metadata.value);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
import {
|
import {
|
||||||
APP_MENU_SELECTORS,
|
APP_MENU_SELECTORS,
|
||||||
appCommonSelector,
|
appCommonSelector,
|
||||||
LEFT_MENU_SELECTORS
|
LEFT_MENU_SELECTORS,
|
||||||
} from "../elements/account/left-menu/left-menu-selectors";
|
} from "../elements/account/left-menu/left-menu-selectors";
|
||||||
import { PERMISSIONS_OPTIONS } from "../fixtures/permissionsUsers";
|
import { PERMISSIONS_OPTIONS } from "../fixtures/permissionsUsers";
|
||||||
import * as permissionsSteps from "../support/pages/permissionsPage";
|
import * as permissionsSteps from "../support/pages/permissionsPage";
|
||||||
|
@ -28,13 +28,13 @@ describe("As a staff user I want to navigate through shop using different permis
|
||||||
appPermissions = {
|
appPermissions = {
|
||||||
parent: {
|
parent: {
|
||||||
parentMenuSelector: LEFT_MENU_SELECTORS.appSection,
|
parentMenuSelector: LEFT_MENU_SELECTORS.appSection,
|
||||||
parentSelectors: [APP_MENU_SELECTORS]
|
parentSelectors: [APP_MENU_SELECTORS],
|
||||||
},
|
},
|
||||||
permissionSelectors: [APP_MENU_SELECTORS.app]
|
permissionSelectors: [APP_MENU_SELECTORS.app],
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
appPermissions = {
|
appPermissions = {
|
||||||
permissionSelectors: [LEFT_MENU_SELECTORS.app]
|
permissionSelectors: [LEFT_MENU_SELECTORS.app],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,14 +53,14 @@ describe("As a staff user I want to navigate through shop using different permis
|
||||||
const permissions = permissionOption.permissions;
|
const permissions = permissionOption.permissions;
|
||||||
cy.clearSessionData();
|
cy.clearSessionData();
|
||||||
permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed(
|
permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed(
|
||||||
permissionOption
|
permissionOption,
|
||||||
);
|
);
|
||||||
permissionsSteps
|
permissionsSteps
|
||||||
.getDisplayedSelectors()
|
.getDisplayedSelectors()
|
||||||
.then(selectors => {
|
.then(selectors => {
|
||||||
permissionsSteps.expectAllSelectorsPermitted(
|
permissionsSteps.expectAllSelectorsPermitted(
|
||||||
permissions,
|
permissions,
|
||||||
selectors
|
selectors,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -73,19 +73,19 @@ describe("As a staff user I want to navigate through shop using different permis
|
||||||
.click()
|
.click()
|
||||||
.then(() => {
|
.then(() => {
|
||||||
permissionsSteps.getDisplayedSelectors(
|
permissionsSteps.getDisplayedSelectors(
|
||||||
permission.parent.parentSelectors
|
permission.parent.parentSelectors,
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(parentSelectors => {
|
.then(parentSelectors => {
|
||||||
permissionsSteps.expectAllSelectorsPermitted(
|
permissionsSteps.expectAllSelectorsPermitted(
|
||||||
permissions,
|
permissions,
|
||||||
parentSelectors
|
parentSelectors,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -97,8 +97,8 @@ describe("As a staff user I want to navigate through shop using different permis
|
||||||
const permissionOption = permissionsOptions.all;
|
const permissionOption = permissionsOptions.all;
|
||||||
cy.clearSessionData();
|
cy.clearSessionData();
|
||||||
permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed(
|
permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed(
|
||||||
permissionOption
|
permissionOption,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@ import { createChannel } from "../../support/api/requests/Channels";
|
||||||
import * as channelsUtils from "../../support/api/utils/channelsUtils";
|
import * as channelsUtils from "../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
selectChannelInHeader,
|
selectChannelInHeader,
|
||||||
selectChannelInPicker
|
selectChannelInPicker,
|
||||||
} from "../../support/pages/channelsPage";
|
} from "../../support/pages/channelsPage";
|
||||||
|
|
||||||
xdescribe("Channels in draft orders", () => {
|
xdescribe("Channels in draft orders", () => {
|
||||||
|
@ -49,7 +49,7 @@ xdescribe("Channels in draft orders", () => {
|
||||||
cy.getTextFromElement(HEADER_SELECTORS.channelSelect).then(
|
cy.getTextFromElement(HEADER_SELECTORS.channelSelect).then(
|
||||||
channelInHeader => {
|
channelInHeader => {
|
||||||
channelName = channelInHeader;
|
channelName = channelInHeader;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
cy.visit(urlList.orders)
|
cy.visit(urlList.orders)
|
||||||
.get(ORDERS_SELECTORS.createOrder)
|
.get(ORDERS_SELECTORS.createOrder)
|
||||||
|
@ -57,15 +57,15 @@ xdescribe("Channels in draft orders", () => {
|
||||||
cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then(
|
cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then(
|
||||||
selectedChannelName => {
|
selectedChannelName => {
|
||||||
expect(channelName).to.contains(selectedChannelName);
|
expect(channelName).to.contains(selectedChannelName);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
cy.get(CHANNEL_FORM_SELECTORS.confirmButton).click();
|
cy.get(CHANNEL_FORM_SELECTORS.confirmButton).click();
|
||||||
cy.getTextFromElement(DRAFT_ORDER_SELECTORS.salesChannel).then(
|
cy.getTextFromElement(DRAFT_ORDER_SELECTORS.salesChannel).then(
|
||||||
channelNameInDraftOrder => {
|
channelNameInDraftOrder => {
|
||||||
expect(channelName).to.contains(channelNameInDraftOrder);
|
expect(channelName).to.contains(channelNameInDraftOrder);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -79,15 +79,15 @@ xdescribe("Channels in draft orders", () => {
|
||||||
cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then(
|
cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then(
|
||||||
channelInSelect => {
|
channelInSelect => {
|
||||||
expect(channelInSelect).to.be.eq(otherChannel.name);
|
expect(channelInSelect).to.be.eq(otherChannel.name);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
cy.get(CHANNEL_FORM_SELECTORS.confirmButton).click();
|
cy.get(CHANNEL_FORM_SELECTORS.confirmButton).click();
|
||||||
cy.getTextFromElement(DRAFT_ORDER_SELECTORS.salesChannel).then(
|
cy.getTextFromElement(DRAFT_ORDER_SELECTORS.salesChannel).then(
|
||||||
channelInDraftOrder => {
|
channelInDraftOrder => {
|
||||||
expect(channelInDraftOrder).to.be.eq(otherChannel.name);
|
expect(channelInDraftOrder).to.be.eq(otherChannel.name);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -101,14 +101,14 @@ xdescribe("Channels in draft orders", () => {
|
||||||
cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then(
|
cy.getTextFromElement(CHANNEL_FORM_SELECTORS.channelSelect).then(
|
||||||
channelInSelect => {
|
channelInSelect => {
|
||||||
expect(channelInSelect).to.be.eq(defaultChannel.name);
|
expect(channelInSelect).to.be.eq(defaultChannel.name);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
selectChannelInPicker(otherChannel.name);
|
selectChannelInPicker(otherChannel.name);
|
||||||
cy.getTextFromElement(DRAFT_ORDER_SELECTORS.salesChannel).then(
|
cy.getTextFromElement(DRAFT_ORDER_SELECTORS.salesChannel).then(
|
||||||
channelInDraftOrder => {
|
channelInDraftOrder => {
|
||||||
expect(channelInDraftOrder).to.be.eq(otherChannel.name);
|
expect(channelInDraftOrder).to.be.eq(otherChannel.name);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,14 +8,14 @@ import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
|
||||||
import { urlList } from "../../fixtures/urlList";
|
import { urlList } from "../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createCustomer,
|
createCustomer,
|
||||||
deleteCustomersStartsWith
|
deleteCustomersStartsWith,
|
||||||
} from "../../support/api/requests/Customer";
|
} from "../../support/api/requests/Customer";
|
||||||
import { updateOrdersSettings } from "../../support/api/requests/Order";
|
import { updateOrdersSettings } from "../../support/api/requests/Order";
|
||||||
import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
|
||||||
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
import { selectChannelInPicker } from "../../support/pages/channelsPage";
|
import { selectChannelInPicker } from "../../support/pages/channelsPage";
|
||||||
import { finalizeDraftOrder } from "../../support/pages/draftOrderPage";
|
import { finalizeDraftOrder } from "../../support/pages/draftOrderPage";
|
||||||
|
@ -48,25 +48,25 @@ xdescribe("Draft orders", () => {
|
||||||
`${randomName}@example.com`,
|
`${randomName}@example.com`,
|
||||||
randomName,
|
randomName,
|
||||||
addresses.plAddress,
|
addresses.plAddress,
|
||||||
true
|
true,
|
||||||
);
|
);
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name: randomName,
|
name: randomName,
|
||||||
address: addresses.plAddress
|
address: addresses.plAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
productsUtils.createTypeAttributeAndCategoryForProduct({
|
productsUtils.createTypeAttributeAndCategoryForProduct({
|
||||||
name: randomName
|
name: randomName,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
productsUtils.createProductInChannel({
|
productsUtils.createProductInChannel({
|
||||||
name: randomName,
|
name: randomName,
|
||||||
|
@ -74,9 +74,9 @@ xdescribe("Draft orders", () => {
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
productTypeId: productTypeResp.id,
|
productTypeId: productTypeResp.id,
|
||||||
attributeId: attributeResp.id,
|
attributeId: attributeResp.id,
|
||||||
categoryId: categoryResp.id
|
categoryId: categoryResp.id,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -97,16 +97,16 @@ xdescribe("Draft orders", () => {
|
||||||
cy.contains(ORDERS_SELECTORS.orderRow, draftOrderNumber).should(
|
cy.contains(ORDERS_SELECTORS.orderRow, draftOrderNumber).should(
|
||||||
$order => {
|
$order => {
|
||||||
expect($order).to.be.visible;
|
expect($order).to.be.visible;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
cy.visit(urlList.draftOrders);
|
cy.visit(urlList.draftOrders);
|
||||||
cy.contains(
|
cy.contains(
|
||||||
DRAFT_ORDERS_LIST_SELECTORS.draftOrderRow,
|
DRAFT_ORDERS_LIST_SELECTORS.draftOrderRow,
|
||||||
draftOrderNumber
|
draftOrderNumber,
|
||||||
).should($draftOrder => {
|
).should($draftOrder => {
|
||||||
expect($draftOrder).to.not.exist;
|
expect($draftOrder).to.not.exist;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,15 +9,15 @@ import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../support/api/utils/products/productsUtils";
|
} from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
import {
|
import {
|
||||||
enterSiteSettingAndSetStockReservation,
|
enterSiteSettingAndSetStockReservation,
|
||||||
userType
|
userType,
|
||||||
} from "../../support/pages/siteSettings";
|
} from "../../support/pages/siteSettings";
|
||||||
|
|
||||||
xdescribe("As an admin I want to manage stock reservation", () => {
|
xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
|
@ -26,7 +26,7 @@ xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
const productQuantity = 10;
|
const productQuantity = 10;
|
||||||
const customerType = {
|
const customerType = {
|
||||||
authenticated: "auth",
|
authenticated: "auth",
|
||||||
anonymous: "token"
|
anonymous: "token",
|
||||||
};
|
};
|
||||||
|
|
||||||
let defaultChannel;
|
let defaultChannel;
|
||||||
|
@ -51,7 +51,7 @@ xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
|
@ -62,12 +62,12 @@ xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
category: categoryResp,
|
category: categoryResp,
|
||||||
productType: productTypeResp
|
productType: productTypeResp,
|
||||||
}) => {
|
}) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -83,14 +83,14 @@ xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
name: productName,
|
name: productName,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
quantityInWarehouse: productQuantity
|
quantityInWarehouse: productQuantity,
|
||||||
}).then(({ variantsList }) => {
|
}).then(({ variantsList }) => {
|
||||||
dataForCheckout = {
|
dataForCheckout = {
|
||||||
email: "example@example.pl",
|
email: "example@example.pl",
|
||||||
address,
|
address,
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
variantsList,
|
variantsList,
|
||||||
productQuantity
|
productQuantity,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -115,10 +115,10 @@ xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
.empty;
|
.empty;
|
||||||
expect(
|
expect(
|
||||||
resp.errors[0].field,
|
resp.errors[0].field,
|
||||||
"error should be on field quantity"
|
"error should be on field quantity",
|
||||||
).to.be.eq("quantity");
|
).to.be.eq("quantity");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -141,10 +141,10 @@ xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
.empty;
|
.empty;
|
||||||
expect(
|
expect(
|
||||||
resp.errors[0].field,
|
resp.errors[0].field,
|
||||||
"error should be on field quantity"
|
"error should be on field quantity",
|
||||||
).to.be.eq("quantity");
|
).to.be.eq("quantity");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -166,7 +166,7 @@ xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
expect(resp.errors, "there should be no errors in response").to.be
|
expect(resp.errors, "there should be no errors in response").to.be
|
||||||
.empty;
|
.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -188,6 +188,6 @@ xdescribe("As an admin I want to manage stock reservation", () => {
|
||||||
expect(resp.errors, "there should be no errors in response").to.be
|
expect(resp.errors, "there should be no errors in response").to.be
|
||||||
.empty;
|
.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,22 +11,22 @@ import { urlList } from "../../fixtures/urlList";
|
||||||
import { ONE_PERMISSION_USERS } from "../../fixtures/users";
|
import { ONE_PERMISSION_USERS } from "../../fixtures/users";
|
||||||
import {
|
import {
|
||||||
createCustomer,
|
createCustomer,
|
||||||
deleteCustomersStartsWith
|
deleteCustomersStartsWith,
|
||||||
} from "../../support/api/requests/Customer";
|
} from "../../support/api/requests/Customer";
|
||||||
import {
|
import {
|
||||||
getOrder,
|
getOrder,
|
||||||
updateOrdersSettings
|
updateOrdersSettings,
|
||||||
} from "../../support/api/requests/Order";
|
} from "../../support/api/requests/Order";
|
||||||
import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createFulfilledOrder,
|
createFulfilledOrder,
|
||||||
createOrder,
|
createOrder,
|
||||||
createReadyToFulfillOrder
|
createReadyToFulfillOrder,
|
||||||
} from "../../support/api/utils/ordersUtils";
|
} from "../../support/api/utils/ordersUtils";
|
||||||
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
import * as productsUtils from "../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../support/api/utils/shippingUtils";
|
} from "../../support/api/utils/shippingUtils";
|
||||||
import { selectChannelInPicker } from "../../support/pages/channelsPage";
|
import { selectChannelInPicker } from "../../support/pages/channelsPage";
|
||||||
import { finalizeDraftOrder } from "../../support/pages/draftOrderPage";
|
import { finalizeDraftOrder } from "../../support/pages/draftOrderPage";
|
||||||
|
@ -65,7 +65,7 @@ describe("Orders", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name: randomName,
|
name: randomName,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
|
@ -73,15 +73,15 @@ describe("Orders", () => {
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
productsUtils.createTypeAttributeAndCategoryForProduct({
|
productsUtils.createTypeAttributeAndCategoryForProduct({
|
||||||
name: randomName
|
name: randomName,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
productsUtils.createProductInChannel({
|
productsUtils.createProductInChannel({
|
||||||
name: randomName,
|
name: randomName,
|
||||||
|
@ -89,9 +89,9 @@ describe("Orders", () => {
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
productTypeId: productTypeResp.id,
|
productTypeId: productTypeResp.id,
|
||||||
attributeId: attributeResp.id,
|
attributeId: attributeResp.id,
|
||||||
categoryId: categoryResp.id
|
categoryId: categoryResp.id,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(({ variantsList: variantsResp }) => {
|
.then(({ variantsList: variantsResp }) => {
|
||||||
variantsList = variantsResp;
|
variantsList = variantsResp;
|
||||||
|
@ -101,7 +101,7 @@ describe("Orders", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.order
|
ONE_PERMISSION_USERS.order,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -117,10 +117,10 @@ describe("Orders", () => {
|
||||||
cy.visit(urlList.orders);
|
cy.visit(urlList.orders);
|
||||||
cy.contains(ORDERS_SELECTORS.orderRow, draftOrderNumber).click();
|
cy.contains(ORDERS_SELECTORS.orderRow, draftOrderNumber).click();
|
||||||
cy.contains(ORDERS_SELECTORS.salesChannel, defaultChannel.name).should(
|
cy.contains(ORDERS_SELECTORS.salesChannel, defaultChannel.name).should(
|
||||||
"be.visible"
|
"be.visible",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -132,7 +132,7 @@ describe("Orders", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
shippingMethodId: shippingMethod.id,
|
shippingMethodId: shippingMethod.id,
|
||||||
variantsList,
|
variantsList,
|
||||||
address
|
address,
|
||||||
}).then(order => {
|
}).then(order => {
|
||||||
cy.visit(urlList.orders);
|
cy.visit(urlList.orders);
|
||||||
cy.contains(ORDERS_SELECTORS.orderRow, order.number).click();
|
cy.contains(ORDERS_SELECTORS.orderRow, order.number).click();
|
||||||
|
@ -140,7 +140,7 @@ describe("Orders", () => {
|
||||||
.find("[button]")
|
.find("[button]")
|
||||||
.should("not.exist");
|
.should("not.exist");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it("should cancel fulfillment", { tags: ["@orders", "@allEnv"] }, () => {
|
it("should cancel fulfillment", { tags: ["@orders", "@allEnv"] }, () => {
|
||||||
|
@ -151,7 +151,7 @@ describe("Orders", () => {
|
||||||
shippingMethodId: shippingMethod.id,
|
shippingMethodId: shippingMethod.id,
|
||||||
variantsList,
|
variantsList,
|
||||||
address,
|
address,
|
||||||
warehouse: warehouse.id
|
warehouse: warehouse.id,
|
||||||
})
|
})
|
||||||
.then(({ order: orderResp }) => {
|
.then(({ order: orderResp }) => {
|
||||||
order = orderResp;
|
order = orderResp;
|
||||||
|
@ -164,7 +164,7 @@ describe("Orders", () => {
|
||||||
.click()
|
.click()
|
||||||
.fillAutocompleteSelect(
|
.fillAutocompleteSelect(
|
||||||
ORDERS_SELECTORS.cancelFulfillmentSelectField,
|
ORDERS_SELECTORS.cancelFulfillmentSelectField,
|
||||||
warehouse.name
|
warehouse.name,
|
||||||
)
|
)
|
||||||
.addAliasToGraphRequest("OrderFulfillmentCancel")
|
.addAliasToGraphRequest("OrderFulfillmentCancel")
|
||||||
.get(BUTTON_SELECTORS.submit)
|
.get(BUTTON_SELECTORS.submit)
|
||||||
|
@ -187,7 +187,7 @@ describe("Orders", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
shippingMethodId: shippingMethod.id,
|
shippingMethodId: shippingMethod.id,
|
||||||
variantsList,
|
variantsList,
|
||||||
address
|
address,
|
||||||
})
|
})
|
||||||
.then(({ order: orderResp }) => {
|
.then(({ order: orderResp }) => {
|
||||||
order = orderResp;
|
order = orderResp;
|
||||||
|
@ -202,13 +202,13 @@ describe("Orders", () => {
|
||||||
cy.get(BUTTON_SELECTORS.submit)
|
cy.get(BUTTON_SELECTORS.submit)
|
||||||
.click()
|
.click()
|
||||||
.waitForRequestAndCheckIfNoErrors(
|
.waitForRequestAndCheckIfNoErrors(
|
||||||
"@OrderFulfillmentRefundProducts"
|
"@OrderFulfillmentRefundProducts",
|
||||||
);
|
);
|
||||||
getOrder(order.id);
|
getOrder(order.id);
|
||||||
})
|
})
|
||||||
.then(orderResp => {
|
.then(orderResp => {
|
||||||
expect(orderResp.paymentStatus).to.be.eq("FULLY_REFUNDED");
|
expect(orderResp.paymentStatus).to.be.eq("FULLY_REFUNDED");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { pageTypeDetailsUrl, urlList } from "../../fixtures/urlList";
|
||||||
import { createAttribute } from "../../support/api/requests/Attribute";
|
import { createAttribute } from "../../support/api/requests/Attribute";
|
||||||
import {
|
import {
|
||||||
createPageType,
|
createPageType,
|
||||||
getPageType
|
getPageType,
|
||||||
} from "../../support/api/requests/PageType";
|
} from "../../support/api/requests/PageType";
|
||||||
|
|
||||||
describe("Tests for page types", () => {
|
describe("Tests for page types", () => {
|
||||||
|
@ -44,7 +44,7 @@ describe("Tests for page types", () => {
|
||||||
.then(pageType => {
|
.then(pageType => {
|
||||||
expect(pageType.name).to.eq(randomName);
|
expect(pageType.name).to.eq(randomName);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit("should assign attribute", { tags: ["@pages", "@allEnv"] }, () => {
|
xit("should assign attribute", { tags: ["@pages", "@allEnv"] }, () => {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { pageDetailsUrl } from "../../fixtures/urlList";
|
||||||
import { createAttribute } from "../../support/api/requests/Attribute";
|
import { createAttribute } from "../../support/api/requests/Attribute";
|
||||||
import {
|
import {
|
||||||
createPage as createPageRequest,
|
createPage as createPageRequest,
|
||||||
getPage
|
getPage,
|
||||||
} from "../../support/api/requests/Page";
|
} from "../../support/api/requests/Page";
|
||||||
import { createPageType } from "../../support/api/requests/PageType";
|
import { createPageType } from "../../support/api/requests/PageType";
|
||||||
import { deleteAttributesStartsWith } from "../../support/api/utils/attributes/attributeUtils";
|
import { deleteAttributesStartsWith } from "../../support/api/utils/attributes/attributeUtils";
|
||||||
|
@ -27,7 +27,7 @@ describe("Tests for pages", () => {
|
||||||
RICH_TEXT: faker.lorem.sentence(),
|
RICH_TEXT: faker.lorem.sentence(),
|
||||||
DROPDOWN: "value",
|
DROPDOWN: "value",
|
||||||
MULTISELECT: "value",
|
MULTISELECT: "value",
|
||||||
BOOLEAN: true
|
BOOLEAN: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
before(() => {
|
before(() => {
|
||||||
|
@ -63,7 +63,7 @@ describe("Tests for pages", () => {
|
||||||
expect(page.attributes[0].attribute.id).to.eq(attribute.id);
|
expect(page.attributes[0].attribute.id).to.eq(attribute.id);
|
||||||
getPage(page.id, "token").should("be.null");
|
getPage(page.id, "token").should("be.null");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -75,7 +75,7 @@ describe("Tests for pages", () => {
|
||||||
createPage({
|
createPage({
|
||||||
pageName: randomName,
|
pageName: randomName,
|
||||||
pageTypeName: name,
|
pageTypeName: name,
|
||||||
isPublished: true
|
isPublished: true,
|
||||||
})
|
})
|
||||||
.then(page => {
|
.then(page => {
|
||||||
getPage(page.id, "token");
|
getPage(page.id, "token");
|
||||||
|
@ -85,7 +85,7 @@ describe("Tests for pages", () => {
|
||||||
expect(page.isPublished).to.be.true;
|
expect(page.isPublished).to.be.true;
|
||||||
expect(page.attributes[0].attribute.id).to.eq(attribute.id);
|
expect(page.attributes[0].attribute.id).to.eq(attribute.id);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Object.keys(attributesTypes).forEach(attributeType => {
|
Object.keys(attributesTypes).forEach(attributeType => {
|
||||||
|
@ -99,7 +99,7 @@ describe("Tests for pages", () => {
|
||||||
name: randomName,
|
name: randomName,
|
||||||
type: "PAGE_TYPE",
|
type: "PAGE_TYPE",
|
||||||
inputType: attributeType,
|
inputType: attributeType,
|
||||||
attributeValues
|
attributeValues,
|
||||||
}).then(attributeResp => {
|
}).then(attributeResp => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
createPageType({ name: randomName, attributeId: attribute.id });
|
createPageType({ name: randomName, attributeId: attribute.id });
|
||||||
|
@ -108,7 +108,7 @@ describe("Tests for pages", () => {
|
||||||
pageName: randomName,
|
pageName: randomName,
|
||||||
pageTypeName: randomName,
|
pageTypeName: randomName,
|
||||||
attributeType,
|
attributeType,
|
||||||
attributeValue: attributeValuesOnPage[attributeType]
|
attributeValue: attributeValuesOnPage[attributeType],
|
||||||
})
|
})
|
||||||
.then(page => {
|
.then(page => {
|
||||||
getPage(page.id);
|
getPage(page.id);
|
||||||
|
@ -117,15 +117,15 @@ describe("Tests for pages", () => {
|
||||||
expect(page.attributes[0].values[0].inputType).to.eq(attributeType);
|
expect(page.attributes[0].values[0].inputType).to.eq(attributeType);
|
||||||
if (attributeType !== "BOOLEAN") {
|
if (attributeType !== "BOOLEAN") {
|
||||||
expect(page.attributes[0].values[0].name).to.eq(
|
expect(page.attributes[0].values[0].name).to.eq(
|
||||||
attributeValuesOnPage[attributeType].toString()
|
attributeValuesOnPage[attributeType].toString(),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
expect(page.attributes[0].values[0].name).to.includes(
|
expect(page.attributes[0].values[0].name).to.includes(
|
||||||
"Yes".toString()
|
"Yes".toString(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ describe("Tests for pages", () => {
|
||||||
|
|
||||||
createPageRequest({
|
createPageRequest({
|
||||||
pageTypeId: pageType.id,
|
pageTypeId: pageType.id,
|
||||||
title: randomName
|
title: randomName,
|
||||||
}).then(({ page }) => {
|
}).then(({ page }) => {
|
||||||
cy.visit(pageDetailsUrl(page.id))
|
cy.visit(pageDetailsUrl(page.id))
|
||||||
.get(BUTTON_SELECTORS.deleteButton)
|
.get(BUTTON_SELECTORS.deleteButton)
|
||||||
|
@ -153,7 +153,7 @@ describe("Tests for pages", () => {
|
||||||
|
|
||||||
createPageRequest({
|
createPageRequest({
|
||||||
pageTypeId: pageType.id,
|
pageTypeId: pageType.id,
|
||||||
title: randomName
|
title: randomName,
|
||||||
})
|
})
|
||||||
.then(({ page }) => {
|
.then(({ page }) => {
|
||||||
cy.visit(pageDetailsUrl(page.id))
|
cy.visit(pageDetailsUrl(page.id))
|
||||||
|
|
|
@ -10,7 +10,7 @@ import { productDetailsUrl, variantDetailsUrl } from "../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
activatePreorderOnVariant,
|
activatePreorderOnVariant,
|
||||||
deactivatePreorderOnVariant,
|
deactivatePreorderOnVariant,
|
||||||
getVariant
|
getVariant,
|
||||||
} from "../../support/api/requests/Product";
|
} from "../../support/api/requests/Product";
|
||||||
import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils";
|
import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils";
|
||||||
import { createProductWithShipping } from "../../support/api/utils/products/productsUtils";
|
import { createProductWithShipping } from "../../support/api/utils/products/productsUtils";
|
||||||
|
@ -20,7 +20,7 @@ import {
|
||||||
fillUpVariantAttributeAndSku,
|
fillUpVariantAttributeAndSku,
|
||||||
saveVariant,
|
saveVariant,
|
||||||
selectChannelForVariantAndFillUpPrices,
|
selectChannelForVariantAndFillUpPrices,
|
||||||
setUpPreorderEndDate
|
setUpPreorderEndDate,
|
||||||
} from "../../support/pages/catalog/products/VariantsPage";
|
} from "../../support/pages/catalog/products/VariantsPage";
|
||||||
|
|
||||||
describe("Creating variants in preorder", () => {
|
describe("Creating variants in preorder", () => {
|
||||||
|
@ -43,7 +43,7 @@ describe("Creating variants in preorder", () => {
|
||||||
address: resp.address,
|
address: resp.address,
|
||||||
channelSlug: resp.defaultChannel.slug,
|
channelSlug: resp.defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
shippingMethodName: resp.shippingMethod.name
|
shippingMethodName: resp.shippingMethod.name,
|
||||||
};
|
};
|
||||||
defaultChannel = resp.defaultChannel;
|
defaultChannel = resp.defaultChannel;
|
||||||
product = resp.product;
|
product = resp.product;
|
||||||
|
@ -66,7 +66,7 @@ describe("Creating variants in preorder", () => {
|
||||||
.click();
|
.click();
|
||||||
fillUpVariantAttributeAndSku({
|
fillUpVariantAttributeAndSku({
|
||||||
attributeName: attributeValues[1],
|
attributeName: attributeValues[1],
|
||||||
sku: attributeValues[1]
|
sku: attributeValues[1],
|
||||||
});
|
});
|
||||||
enablePreorderWithThreshold(threshold);
|
enablePreorderWithThreshold(threshold);
|
||||||
setUpPreorderEndDate(endDate, endTime);
|
setUpPreorderEndDate(endDate, endTime);
|
||||||
|
@ -81,7 +81,7 @@ describe("Creating variants in preorder", () => {
|
||||||
selectChannelForVariantAndFillUpPrices({
|
selectChannelForVariantAndFillUpPrices({
|
||||||
channelName: defaultChannel.name,
|
channelName: defaultChannel.name,
|
||||||
attributeName: attributeValues[1],
|
attributeName: attributeValues[1],
|
||||||
price: 10
|
price: 10,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -100,7 +100,7 @@ describe("Creating variants in preorder", () => {
|
||||||
expect(endDate).to.eq(formatDate(respEndDate));
|
expect(endDate).to.eq(formatDate(respEndDate));
|
||||||
expect(endTime).to.eq(formatTime(respEndDate));
|
expect(endTime).to.eq(formatTime(respEndDate));
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -123,7 +123,7 @@ describe("Creating variants in preorder", () => {
|
||||||
expect(preorder.globalThreshold).to.eq(threshold);
|
expect(preorder.globalThreshold).to.eq(threshold);
|
||||||
expect(preorder.globalSoldUnits).to.eq(1);
|
expect(preorder.globalSoldUnits).to.eq(1);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -142,6 +142,6 @@ describe("Creating variants in preorder", () => {
|
||||||
expect(endDate).to.eq(formatDate(respEndDate));
|
expect(endDate).to.eq(formatDate(respEndDate));
|
||||||
expect(endTime).to.eq(formatTime(respEndDate));
|
expect(endTime).to.eq(formatTime(respEndDate));
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,7 +11,7 @@ import { deleteCollectionsStartsWith } from "../../support/api/utils/catalog/col
|
||||||
import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils";
|
import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils";
|
||||||
import {
|
import {
|
||||||
createProductWithShipping,
|
createProductWithShipping,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../support/api/utils/products/productsUtils";
|
} from "../../support/api/utils/products/productsUtils";
|
||||||
import { saveVariant } from "../../support/pages/catalog/products/VariantsPage";
|
import { saveVariant } from "../../support/pages/catalog/products/VariantsPage";
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ describe("Stocks and threshold in preorder variants", () => {
|
||||||
const startsWith = "StocksThreshold";
|
const startsWith = "StocksThreshold";
|
||||||
const attributeValues = ["value1", "value2"];
|
const attributeValues = ["value1", "value2"];
|
||||||
const preorder = {
|
const preorder = {
|
||||||
globalThreshold: 15
|
globalThreshold: 15,
|
||||||
};
|
};
|
||||||
|
|
||||||
let defaultChannel;
|
let defaultChannel;
|
||||||
|
@ -35,14 +35,14 @@ describe("Stocks and threshold in preorder variants", () => {
|
||||||
createProductWithShipping({
|
createProductWithShipping({
|
||||||
name: startsWith,
|
name: startsWith,
|
||||||
attributeValues,
|
attributeValues,
|
||||||
preorder
|
preorder,
|
||||||
}).then(resp => {
|
}).then(resp => {
|
||||||
checkoutData = {
|
checkoutData = {
|
||||||
address: resp.address,
|
address: resp.address,
|
||||||
channelSlug: resp.defaultChannel.slug,
|
channelSlug: resp.defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
shippingMethodName: resp.shippingMethod.name,
|
shippingMethodName: resp.shippingMethod.name,
|
||||||
variantsList: resp.variantsList
|
variantsList: resp.variantsList,
|
||||||
};
|
};
|
||||||
warehouse = resp.warehouse;
|
warehouse = resp.warehouse;
|
||||||
defaultChannel = resp.defaultChannel;
|
defaultChannel = resp.defaultChannel;
|
||||||
|
@ -69,7 +69,7 @@ describe("Stocks and threshold in preorder variants", () => {
|
||||||
createCheckout(checkoutData).then(({ errors }) => {
|
createCheckout(checkoutData).then(({ errors }) => {
|
||||||
expect(errors[0].field).to.eq("quantity");
|
expect(errors[0].field).to.eq("quantity");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -84,7 +84,7 @@ describe("Stocks and threshold in preorder variants", () => {
|
||||||
createCheckout(checkoutData).then(({ errors }) => {
|
createCheckout(checkoutData).then(({ errors }) => {
|
||||||
expect(errors[0].field).to.eq("quantity");
|
expect(errors[0].field).to.eq("quantity");
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -102,18 +102,18 @@ describe("Stocks and threshold in preorder variants", () => {
|
||||||
.get(BUTTON_SELECTORS.submit)
|
.get(BUTTON_SELECTORS.submit)
|
||||||
.click()
|
.click()
|
||||||
.waitForRequestAndCheckIfNoErrors(
|
.waitForRequestAndCheckIfNoErrors(
|
||||||
"@ProductVariantPreorderDeactivate"
|
"@ProductVariantPreorderDeactivate",
|
||||||
);
|
);
|
||||||
getVariant(variantsList[0].id, defaultChannel.slug);
|
getVariant(variantsList[0].id, defaultChannel.slug);
|
||||||
})
|
})
|
||||||
.then(variantResp => {
|
.then(variantResp => {
|
||||||
expect(
|
expect(
|
||||||
variantResp.stocks[0].quantityAllocated,
|
variantResp.stocks[0].quantityAllocated,
|
||||||
"product is allocated with correct quantity"
|
"product is allocated with correct quantity",
|
||||||
).to.eq(1);
|
).to.eq(1);
|
||||||
expect(
|
expect(
|
||||||
variantResp.stocks[0].warehouse.id,
|
variantResp.stocks[0].warehouse.id,
|
||||||
"product is allocated to correct warehouse"
|
"product is allocated to correct warehouse",
|
||||||
).to.eq(warehouse.id);
|
).to.eq(warehouse.id);
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -121,12 +121,12 @@ describe("Stocks and threshold in preorder variants", () => {
|
||||||
orderId: order.id,
|
orderId: order.id,
|
||||||
warehouse: warehouse.id,
|
warehouse: warehouse.id,
|
||||||
quantity: 1,
|
quantity: 1,
|
||||||
linesId: order.lines
|
linesId: order.lines,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ errors }) => {
|
.then(({ errors }) => {
|
||||||
expect(errors, "no errors when fulfilling order").to.be.empty;
|
expect(errors, "no errors when fulfilling order").to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,12 +12,12 @@ import { createAttribute } from "../../support/api/requests/Attribute";
|
||||||
import { createTypeProduct } from "../../support/api/requests/ProductType";
|
import { createTypeProduct } from "../../support/api/requests/ProductType";
|
||||||
import {
|
import {
|
||||||
expectCorrectProductInformation,
|
expectCorrectProductInformation,
|
||||||
expectCorrectProductVariantInformation
|
expectCorrectProductVariantInformation,
|
||||||
} from "../../support/api/utils/products/checkProductInfo";
|
} from "../../support/api/utils/products/checkProductInfo";
|
||||||
import { metadataForms } from "../../support/pages/catalog/metadataComponent";
|
import { metadataForms } from "../../support/pages/catalog/metadataComponent";
|
||||||
import {
|
import {
|
||||||
fillUpPriceList,
|
fillUpPriceList,
|
||||||
priceInputLists
|
priceInputLists,
|
||||||
} from "../../support/pages/catalog/products/priceListComponent";
|
} from "../../support/pages/catalog/products/priceListComponent";
|
||||||
import { fillUpCommonFieldsForAllProductTypes } from "../../support/pages/catalog/products/productDetailsPage";
|
import { fillUpCommonFieldsForAllProductTypes } from "../../support/pages/catalog/products/productDetailsPage";
|
||||||
import { selectChannelInDetailsPages } from "../../support/pages/channelsPage";
|
import { selectChannelInDetailsPages } from "../../support/pages/channelsPage";
|
||||||
|
@ -28,23 +28,23 @@ describe("As an admin I should be able to create product", () => {
|
||||||
const generalInfo = {
|
const generalInfo = {
|
||||||
name: `${startsWith}${faker.datatype.number()}`,
|
name: `${startsWith}${faker.datatype.number()}`,
|
||||||
description: faker.lorem.sentence(),
|
description: faker.lorem.sentence(),
|
||||||
rating: 2
|
rating: 2,
|
||||||
};
|
};
|
||||||
const seo = {
|
const seo = {
|
||||||
title: "testTitle",
|
title: "testTitle",
|
||||||
description: generalInfo.description
|
description: generalInfo.description,
|
||||||
};
|
};
|
||||||
const metadata = {
|
const metadata = {
|
||||||
public: {
|
public: {
|
||||||
metadataForm: metadataForms.public,
|
metadataForm: metadataForms.public,
|
||||||
name: "metadataName",
|
name: "metadataName",
|
||||||
value: "metadataValue"
|
value: "metadataValue",
|
||||||
},
|
},
|
||||||
private: {
|
private: {
|
||||||
metadataForm: metadataForms.private,
|
metadataForm: metadataForms.private,
|
||||||
name: "privateMetadataName",
|
name: "privateMetadataName",
|
||||||
value: "privateMetadataValue"
|
value: "privateMetadataValue",
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
let attribute;
|
let attribute;
|
||||||
|
|
||||||
|
@ -69,10 +69,10 @@ describe("As an admin I should be able to create product", () => {
|
||||||
seo,
|
seo,
|
||||||
metadata,
|
metadata,
|
||||||
productOrganization: { productType: randomName },
|
productOrganization: { productType: randomName },
|
||||||
attribute
|
attribute,
|
||||||
};
|
};
|
||||||
createTpeAndFillUpProductFields(randomName, true, productData).then(
|
createTpeAndFillUpProductFields(randomName, true, productData).then(
|
||||||
productOrgResp => (productData.productOrganization = productOrgResp)
|
productOrgResp => (productData.productOrganization = productOrgResp),
|
||||||
);
|
);
|
||||||
cy.addAliasToGraphRequest("ProductDetails")
|
cy.addAliasToGraphRequest("ProductDetails")
|
||||||
.get(BUTTON_SELECTORS.confirm)
|
.get(BUTTON_SELECTORS.confirm)
|
||||||
|
@ -91,7 +91,7 @@ describe("As an admin I should be able to create product", () => {
|
||||||
}
|
}
|
||||||
expectCorrectProductInformation(productResp, productData);
|
expectCorrectProductInformation(productResp, productData);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -106,10 +106,10 @@ describe("As an admin I should be able to create product", () => {
|
||||||
seo,
|
seo,
|
||||||
metadata,
|
metadata,
|
||||||
productOrganization: { productType: randomName },
|
productOrganization: { productType: randomName },
|
||||||
attribute
|
attribute,
|
||||||
};
|
};
|
||||||
createTpeAndFillUpProductFields(randomName, false, productData).then(
|
createTpeAndFillUpProductFields(randomName, false, productData).then(
|
||||||
productOrgResp => (productData.productOrganization = productOrgResp)
|
productOrgResp => (productData.productOrganization = productOrgResp),
|
||||||
);
|
);
|
||||||
selectChannelInDetailsPages();
|
selectChannelInDetailsPages();
|
||||||
fillUpPriceList(prices.sellingPrice);
|
fillUpPriceList(prices.sellingPrice);
|
||||||
|
@ -135,21 +135,21 @@ describe("As an admin I should be able to create product", () => {
|
||||||
expectCorrectProductVariantInformation(
|
expectCorrectProductVariantInformation(
|
||||||
productResp.variants,
|
productResp.variants,
|
||||||
randomName,
|
randomName,
|
||||||
prices
|
prices,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
function createTpeAndFillUpProductFields(
|
function createTpeAndFillUpProductFields(
|
||||||
randomName,
|
randomName,
|
||||||
hasVariants,
|
hasVariants,
|
||||||
productData
|
productData,
|
||||||
) {
|
) {
|
||||||
createTypeProduct({
|
createTypeProduct({
|
||||||
name: randomName,
|
name: randomName,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
hasVariants
|
hasVariants,
|
||||||
});
|
});
|
||||||
cy.clearSessionData()
|
cy.clearSessionData()
|
||||||
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product)
|
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product)
|
||||||
|
|
|
@ -24,7 +24,7 @@ xdescribe("Tests for images", () => {
|
||||||
.its("response.body")
|
.its("response.body")
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
const data = resp.find(element =>
|
const data = resp.find(element =>
|
||||||
element.data.hasOwnProperty("products")
|
element.data.hasOwnProperty("products"),
|
||||||
).data;
|
).data;
|
||||||
const products = data.products.edges;
|
const products = data.products.edges;
|
||||||
cy.expectSkeletonIsVisible()
|
cy.expectSkeletonIsVisible()
|
||||||
|
@ -49,7 +49,7 @@ xdescribe("Tests for images", () => {
|
||||||
.should("have.length", expectedProductsSvgAvatars);
|
.should("have.length", expectedProductsSvgAvatars);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it("Should display product image", { tags: ["@products", "@allEnv"] }, () => {
|
it("Should display product image", { tags: ["@products", "@allEnv"] }, () => {
|
||||||
|
|
|
@ -35,7 +35,7 @@ describe("Products available in listings", () => {
|
||||||
shippingUtils.createShipping({
|
shippingUtils.createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address: addressesFixture.plAddress
|
address: addressesFixture.plAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
|
@ -48,19 +48,19 @@ describe("Products available in listings", () => {
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.product
|
ONE_PERMISSION_USERS.product,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ describe("Products available in listings", () => {
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
isAvailableForPurchase: false
|
isAvailableForPurchase: false,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
product = productResp;
|
product = productResp;
|
||||||
|
@ -92,7 +92,7 @@ describe("Products available in listings", () => {
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
expect(isProductAvailableForPurchase(resp)).to.be.eq(true);
|
expect(isProductAvailableForPurchase(resp)).to.be.eq(true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -109,7 +109,7 @@ describe("Products available in listings", () => {
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
product = productResp;
|
product = productResp;
|
||||||
|
@ -122,6 +122,6 @@ describe("Products available in listings", () => {
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
expect(isProductAvailableForPurchase(resp)).to.be.eq(false);
|
expect(isProductAvailableForPurchase(resp)).to.be.eq(false);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,13 +28,13 @@ describe("Published products", () => {
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
getDefaultChannel();
|
getDefaultChannel();
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
|
@ -44,7 +44,7 @@ describe("Published products", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.product
|
ONE_PERMISSION_USERS.product,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ describe("Published products", () => {
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
isPublished: false,
|
isPublished: false,
|
||||||
isAvailableForPurchase: false
|
isAvailableForPurchase: false,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
const product = productResp;
|
const product = productResp;
|
||||||
|
@ -74,7 +74,7 @@ describe("Published products", () => {
|
||||||
const isVisible = isProductVisible(resp, productName);
|
const isVisible = isProductVisible(resp, productName);
|
||||||
expect(isVisible).to.be.eq(true);
|
expect(isVisible).to.be.eq(true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -90,7 +90,7 @@ describe("Published products", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
product = productResp;
|
product = productResp;
|
||||||
|
@ -110,6 +110,6 @@ describe("Published products", () => {
|
||||||
const isVisible = isProductVisible(resp, productName);
|
const isVisible = isProductVisible(resp, productName);
|
||||||
expect(isVisible).to.be.eq(true);
|
expect(isVisible).to.be.eq(true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,13 +27,13 @@ describe("Products displayed in listings", () => {
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
getDefaultChannel();
|
getDefaultChannel();
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(channel => {
|
.then(channel => {
|
||||||
defaultChannel = channel;
|
defaultChannel = channel;
|
||||||
|
@ -43,7 +43,7 @@ describe("Products displayed in listings", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.product
|
ONE_PERMISSION_USERS.product,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ describe("Products displayed in listings", () => {
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
visibleInListings: false,
|
visibleInListings: false,
|
||||||
isAvailableForPurchase: false
|
isAvailableForPurchase: false,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
const product = productResp;
|
const product = productResp;
|
||||||
|
@ -72,11 +72,11 @@ describe("Products displayed in listings", () => {
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
const isProductVisible = isProductVisibleInSearchResult(
|
const isProductVisible = isProductVisibleInSearchResult(
|
||||||
resp,
|
resp,
|
||||||
productName
|
productName,
|
||||||
);
|
);
|
||||||
expect(isProductVisible).to.be.eq(true);
|
expect(isProductVisible).to.be.eq(true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -92,7 +92,7 @@ describe("Products displayed in listings", () => {
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
visibleInListings: true
|
visibleInListings: true,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
const product = productResp;
|
const product = productResp;
|
||||||
|
@ -102,7 +102,7 @@ describe("Products displayed in listings", () => {
|
||||||
searchInShop(productName).then(resp => {
|
searchInShop(productName).then(resp => {
|
||||||
const isProductVisible = isProductVisibleInSearchResult(
|
const isProductVisible = isProductVisibleInSearchResult(
|
||||||
resp,
|
resp,
|
||||||
productName
|
productName,
|
||||||
);
|
);
|
||||||
expect(isProductVisible).to.be.eq(false);
|
expect(isProductVisible).to.be.eq(false);
|
||||||
});
|
});
|
||||||
|
@ -114,10 +114,10 @@ describe("Products displayed in listings", () => {
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
const isProductVisible = isProductVisibleInSearchResult(
|
const isProductVisible = isProductVisibleInSearchResult(
|
||||||
resp,
|
resp,
|
||||||
productName
|
productName,
|
||||||
);
|
);
|
||||||
expect(isProductVisible).to.be.eq(true);
|
expect(isProductVisible).to.be.eq(true);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,16 +11,16 @@ import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../../support/api/utils/shippingUtils";
|
} from "../../../support/api/utils/shippingUtils";
|
||||||
import {
|
import {
|
||||||
selectChannel,
|
selectChannel,
|
||||||
selectFilterOption,
|
selectFilterOption,
|
||||||
selectProductsOutOfStock
|
selectProductsOutOfStock,
|
||||||
} from "../../../support/pages/catalog/products/productsListPage";
|
} from "../../../support/pages/catalog/products/productsListPage";
|
||||||
|
|
||||||
describe("Filtering products", () => {
|
describe("Filtering products", () => {
|
||||||
|
@ -43,15 +43,15 @@ describe("Filtering products", () => {
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
createCollection(name).then(
|
createCollection(name).then(
|
||||||
collectionResp => (collection = collectionResp)
|
collectionResp => (collection = collectionResp),
|
||||||
);
|
);
|
||||||
getDefaultChannel()
|
getDefaultChannel()
|
||||||
.then(channelResp => {
|
.then(channelResp => {
|
||||||
|
@ -62,7 +62,7 @@ describe("Filtering products", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
name,
|
name,
|
||||||
address: addresses.plAddress
|
address: addresses.plAddress,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ warehouse: warehouseResp }) => {
|
.then(({ warehouse: warehouseResp }) => {
|
||||||
|
@ -75,7 +75,7 @@ describe("Filtering products", () => {
|
||||||
price,
|
price,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
productTypeId: productType.id
|
productTypeId: productType.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ product: product }) => {
|
.then(({ product: product }) => {
|
||||||
|
@ -101,7 +101,7 @@ describe("Filtering products", () => {
|
||||||
cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => {
|
cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => {
|
||||||
expect(product).to.includes(name);
|
expect(product).to.includes(name);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ describe("Filtering products", () => {
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price
|
price,
|
||||||
});
|
});
|
||||||
cy.waitForProgressBarToNotExist();
|
cy.waitForProgressBarToNotExist();
|
||||||
selectChannel(channel.slug);
|
selectChannel(channel.slug);
|
||||||
|
@ -131,6 +131,6 @@ describe("Filtering products", () => {
|
||||||
.then(product => {
|
.then(product => {
|
||||||
expect(product).to.includes(productOutOfStock);
|
expect(product).to.includes(productOutOfStock);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||||
import { urlList } from "../../../fixtures/urlList";
|
import { urlList } from "../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
getDisplayedColumnArray,
|
getDisplayedColumnArray,
|
||||||
isNumberOfProductsSameAsInSelectResultsOnPage
|
isNumberOfProductsSameAsInSelectResultsOnPage,
|
||||||
} from "../../../support/pages/catalog/products/productsListPage";
|
} from "../../../support/pages/catalog/products/productsListPage";
|
||||||
|
|
||||||
describe("Products", () => {
|
describe("Products", () => {
|
||||||
|
@ -26,7 +26,7 @@ describe("Products", () => {
|
||||||
.should("be.disabled");
|
.should("be.disabled");
|
||||||
let firstPageProducts;
|
let firstPageProducts;
|
||||||
getDisplayedColumnArray("name").then(
|
getDisplayedColumnArray("name").then(
|
||||||
productsList => (firstPageProducts = productsList)
|
productsList => (firstPageProducts = productsList),
|
||||||
);
|
);
|
||||||
cy.addAliasToGraphRequest("ProductList")
|
cy.addAliasToGraphRequest("ProductList")
|
||||||
.get(PRODUCTS_LIST.nextPageButton)
|
.get(PRODUCTS_LIST.nextPageButton)
|
||||||
|
@ -45,10 +45,10 @@ describe("Products", () => {
|
||||||
.should("not.exist");
|
.should("not.exist");
|
||||||
getDisplayedColumnArray("name").then(productsList => {
|
getDisplayedColumnArray("name").then(productsList => {
|
||||||
expect(
|
expect(
|
||||||
JSON.stringify(productsList) === JSON.stringify(firstPageProducts)
|
JSON.stringify(productsList) === JSON.stringify(firstPageProducts),
|
||||||
).to.be.true;
|
).to.be.true;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -59,12 +59,12 @@ describe("Products", () => {
|
||||||
isNumberOfProductsSameAsInSelectResultsOnPage().then(
|
isNumberOfProductsSameAsInSelectResultsOnPage().then(
|
||||||
isTheSame =>
|
isTheSame =>
|
||||||
expect(isTheSame, "check if number of displayed products is correct")
|
expect(isTheSame, "check if number of displayed products is correct")
|
||||||
.to.be.true
|
.to.be.true,
|
||||||
);
|
);
|
||||||
cy.get(PRODUCTS_LIST.resultsOnPageSelect)
|
cy.get(PRODUCTS_LIST.resultsOnPageSelect)
|
||||||
.click()
|
.click()
|
||||||
.get(
|
.get(
|
||||||
`${PRODUCTS_LIST.rowNumberOption}${BUTTON_SELECTORS.notSelectedOption}`
|
`${PRODUCTS_LIST.rowNumberOption}${BUTTON_SELECTORS.notSelectedOption}`,
|
||||||
)
|
)
|
||||||
.first()
|
.first()
|
||||||
.click()
|
.click()
|
||||||
|
@ -73,9 +73,9 @@ describe("Products", () => {
|
||||||
isTheSame =>
|
isTheSame =>
|
||||||
expect(
|
expect(
|
||||||
isTheSame,
|
isTheSame,
|
||||||
"check if number of displayed products is correct, after changing results number in table footer"
|
"check if number of displayed products is correct, after changing results number in table footer",
|
||||||
).to.be.true
|
).to.be.true,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -30,7 +30,7 @@ describe("Sorting products", () => {
|
||||||
.waitForProgressBarToNotExist()
|
.waitForProgressBarToNotExist()
|
||||||
.waitForRequestAndCheckIfNoErrors("@ProductList");
|
.waitForRequestAndCheckIfNoErrors("@ProductList");
|
||||||
expectProductsSortedBy(sortBy, false);
|
expectProductsSortedBy(sortBy, false);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,14 +8,14 @@ import { ONE_PERMISSION_USERS } from "../../fixtures/users";
|
||||||
import { createChannel } from "../../support/api/requests/Channels";
|
import { createChannel } from "../../support/api/requests/Channels";
|
||||||
import {
|
import {
|
||||||
createProduct,
|
createProduct,
|
||||||
updateChannelInProduct
|
updateChannelInProduct,
|
||||||
} from "../../support/api/requests/Product";
|
} from "../../support/api/requests/Product";
|
||||||
import * as productUtils from "../../support/api/utils/products/productsUtils";
|
import * as productUtils from "../../support/api/utils/products/productsUtils";
|
||||||
import { getProductVariants } from "../../support/api/utils/storeFront/storeFrontProductUtils";
|
import { getProductVariants } from "../../support/api/utils/storeFront/storeFrontProductUtils";
|
||||||
import {
|
import {
|
||||||
createFirstVariant,
|
createFirstVariant,
|
||||||
createVariant,
|
createVariant,
|
||||||
variantsShouldBeVisible
|
variantsShouldBeVisible,
|
||||||
} from "../../support/pages/catalog/products/VariantsPage";
|
} from "../../support/pages/catalog/products/VariantsPage";
|
||||||
import { selectChannelInHeader } from "../../support/pages/channelsPage";
|
import { selectChannelInHeader } from "../../support/pages/channelsPage";
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ describe("As an admin I should be able to create variant", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.product
|
ONE_PERMISSION_USERS.product,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -68,23 +68,23 @@ describe("As an admin I should be able to create variant", () => {
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
name,
|
name,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
createdProduct = resp;
|
createdProduct = resp;
|
||||||
updateChannelInProduct({
|
updateChannelInProduct({
|
||||||
productId: createdProduct.id,
|
productId: createdProduct.id,
|
||||||
channelId: defaultChannel.id
|
channelId: defaultChannel.id,
|
||||||
});
|
});
|
||||||
updateChannelInProduct({
|
updateChannelInProduct({
|
||||||
productId: createdProduct.id,
|
productId: createdProduct.id,
|
||||||
channelId: newChannel.id
|
channelId: newChannel.id,
|
||||||
});
|
});
|
||||||
cy.visit(`${urlList.products}${createdProduct.id}`);
|
cy.visit(`${urlList.products}${createdProduct.id}`);
|
||||||
createFirstVariant({
|
createFirstVariant({
|
||||||
sku: name,
|
sku: name,
|
||||||
price,
|
price,
|
||||||
attribute: attributeValues[0]
|
attribute: attributeValues[0],
|
||||||
});
|
});
|
||||||
selectChannelInHeader(defaultChannel.name);
|
selectChannelInHeader(defaultChannel.name);
|
||||||
variantsShouldBeVisible({ name, price });
|
variantsShouldBeVisible({ name, price });
|
||||||
|
@ -106,7 +106,7 @@ describe("As an admin I should be able to create variant", () => {
|
||||||
expect(variant).to.have.property("name", attributeValues[0]);
|
expect(variant).to.have.property("name", attributeValues[0]);
|
||||||
expect(variant).to.have.property("price", price);
|
expect(variant).to.have.property("price", price);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -126,7 +126,7 @@ describe("As an admin I should be able to create variant", () => {
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: variants[0].price
|
price: variants[0].price,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
createdProduct = productResp;
|
createdProduct = productResp;
|
||||||
|
@ -135,14 +135,14 @@ describe("As an admin I should be able to create variant", () => {
|
||||||
sku: secondVariantSku,
|
sku: secondVariantSku,
|
||||||
attributeName: variants[1].name,
|
attributeName: variants[1].name,
|
||||||
price: variants[1].price,
|
price: variants[1].price,
|
||||||
channelName: defaultChannel.name
|
channelName: defaultChannel.name,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
selectChannelInHeader(defaultChannel.name);
|
selectChannelInHeader(defaultChannel.name);
|
||||||
variantsShouldBeVisible({
|
variantsShouldBeVisible({
|
||||||
name: variants[1].name,
|
name: variants[1].name,
|
||||||
price: variants[1].price
|
price: variants[1].price,
|
||||||
});
|
});
|
||||||
getProductVariants(createdProduct.id, defaultChannel.slug);
|
getProductVariants(createdProduct.id, defaultChannel.slug);
|
||||||
})
|
})
|
||||||
|
@ -151,6 +151,6 @@ describe("As an admin I should be able to create variant", () => {
|
||||||
expect(secondVariant).to.have.property("name", variants[1].name);
|
expect(secondVariant).to.have.property("name", variants[1].name);
|
||||||
expect(secondVariant).to.have.property("price", variants[1].price);
|
expect(secondVariant).to.have.property("price", variants[1].price);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,12 +11,12 @@ import { urlList } from "../../../fixtures/urlList";
|
||||||
import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
|
import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
|
||||||
import {
|
import {
|
||||||
createProduct,
|
createProduct,
|
||||||
updateChannelInProduct
|
updateChannelInProduct,
|
||||||
} from "../../../support/api/requests/Product";
|
} from "../../../support/api/requests/Product";
|
||||||
import { createTypeProduct } from "../../../support/api/requests/ProductType";
|
import { createTypeProduct } from "../../../support/api/requests/ProductType";
|
||||||
import {
|
import {
|
||||||
deleteChannelsStartsWith,
|
deleteChannelsStartsWith,
|
||||||
getDefaultChannel
|
getDefaultChannel,
|
||||||
} from "../../../support/api/utils/channelsUtils";
|
} from "../../../support/api/utils/channelsUtils";
|
||||||
import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils";
|
import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils";
|
||||||
import * as productUtils from "../../../support/api/utils/products/productsUtils";
|
import * as productUtils from "../../../support/api/utils/products/productsUtils";
|
||||||
|
@ -24,7 +24,7 @@ import * as shippingUtils from "../../../support/api/utils/shippingUtils";
|
||||||
import { getProductVariants } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
|
import { getProductVariants } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
|
||||||
import {
|
import {
|
||||||
createFirstVariant,
|
createFirstVariant,
|
||||||
createVariant
|
createVariant,
|
||||||
} from "../../../support/pages/catalog/products/VariantsPage";
|
} from "../../../support/pages/catalog/products/VariantsPage";
|
||||||
import { selectChannelInDetailsPages } from "../../../support/pages/channelsPage";
|
import { selectChannelInDetailsPages } from "../../../support/pages/channelsPage";
|
||||||
|
|
||||||
|
@ -59,14 +59,14 @@ describe("Creating variants", () => {
|
||||||
shippingUtils.createShipping({
|
shippingUtils.createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
({ warehouse: warehouseResp, shippingMethod: shippingMethodResp }) => {
|
({ warehouse: warehouseResp, shippingMethod: shippingMethodResp }) => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
productUtils
|
productUtils
|
||||||
.createTypeAttributeAndCategoryForProduct({ name, attributeValues })
|
.createTypeAttributeAndCategoryForProduct({ name, attributeValues })
|
||||||
|
@ -74,7 +74,7 @@ describe("Creating variants", () => {
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
productType = productTypeResp;
|
productType = productTypeResp;
|
||||||
|
@ -82,9 +82,9 @@ describe("Creating variants", () => {
|
||||||
createTypeProduct({
|
createTypeProduct({
|
||||||
name: simpleProductTypeName,
|
name: simpleProductTypeName,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
hasVariants: false
|
hasVariants: false,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(type => {
|
.then(type => {
|
||||||
simpleProductType = type;
|
simpleProductType = type;
|
||||||
|
@ -94,7 +94,7 @@ describe("Creating variants", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.clearSessionData().loginUserViaRequest(
|
cy.clearSessionData().loginUserViaRequest(
|
||||||
"auth",
|
"auth",
|
||||||
ONE_PERMISSION_USERS.product
|
ONE_PERMISSION_USERS.product,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -110,19 +110,19 @@ describe("Creating variants", () => {
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
name,
|
name,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
createdProduct = resp;
|
createdProduct = resp;
|
||||||
updateChannelInProduct({
|
updateChannelInProduct({
|
||||||
productId: createdProduct.id,
|
productId: createdProduct.id,
|
||||||
channelId: defaultChannel.id
|
channelId: defaultChannel.id,
|
||||||
});
|
});
|
||||||
cy.visit(`${urlList.products}${createdProduct.id}`);
|
cy.visit(`${urlList.products}${createdProduct.id}`);
|
||||||
cy.waitForProgressBarToNotBeVisible();
|
cy.waitForProgressBarToNotBeVisible();
|
||||||
createFirstVariant({
|
createFirstVariant({
|
||||||
price,
|
price,
|
||||||
attribute: attributeValues[0]
|
attribute: attributeValues[0],
|
||||||
});
|
});
|
||||||
getProductVariants(createdProduct.id, defaultChannel.slug);
|
getProductVariants(createdProduct.id, defaultChannel.slug);
|
||||||
})
|
})
|
||||||
|
@ -134,13 +134,13 @@ describe("Creating variants", () => {
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList: [variant],
|
variantsList: [variant],
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
xit(
|
xit(
|
||||||
|
@ -159,7 +159,7 @@ describe("Creating variants", () => {
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
productTypeId: productType.id,
|
productTypeId: productType.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
price: variants[0].price
|
price: variants[0].price,
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
createdProduct = productResp;
|
createdProduct = productResp;
|
||||||
|
@ -168,7 +168,7 @@ describe("Creating variants", () => {
|
||||||
warehouseName: warehouse.name,
|
warehouseName: warehouse.name,
|
||||||
attributeName: variants[1].name,
|
attributeName: variants[1].name,
|
||||||
price: variants[1].price,
|
price: variants[1].price,
|
||||||
channelName: defaultChannel.name
|
channelName: defaultChannel.name,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
@ -183,13 +183,13 @@ describe("Creating variants", () => {
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList: [secondVariant],
|
variantsList: [secondVariant],
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ order }) => {
|
.then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -204,7 +204,7 @@ describe("Creating variants", () => {
|
||||||
.type(name)
|
.type(name)
|
||||||
.fillAutocompleteSelect(
|
.fillAutocompleteSelect(
|
||||||
PRODUCT_DETAILS.productTypeInput,
|
PRODUCT_DETAILS.productTypeInput,
|
||||||
simpleProductType.name
|
simpleProductType.name,
|
||||||
)
|
)
|
||||||
.fillAutocompleteSelect(PRODUCT_DETAILS.categoryInput);
|
.fillAutocompleteSelect(PRODUCT_DETAILS.categoryInput);
|
||||||
selectChannelInDetailsPages(defaultChannel.name);
|
selectChannelInDetailsPages(defaultChannel.name);
|
||||||
|
@ -220,11 +220,11 @@ describe("Creating variants", () => {
|
||||||
.get(AVAILABLE_CHANNELS_FORM.assignedChannels)
|
.get(AVAILABLE_CHANNELS_FORM.assignedChannels)
|
||||||
.click()
|
.click()
|
||||||
.get(
|
.get(
|
||||||
`${AVAILABLE_CHANNELS_FORM.availableForPurchaseRadioButtons}${AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue}`
|
`${AVAILABLE_CHANNELS_FORM.availableForPurchaseRadioButtons}${AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue}`,
|
||||||
)
|
)
|
||||||
.click()
|
.click()
|
||||||
.get(
|
.get(
|
||||||
`${AVAILABLE_CHANNELS_FORM.publishedRadioButtons}${AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue}`
|
`${AVAILABLE_CHANNELS_FORM.publishedRadioButtons}${AVAILABLE_CHANNELS_FORM.radioButtonsValueTrue}`,
|
||||||
)
|
)
|
||||||
.click()
|
.click()
|
||||||
.addAliasToGraphRequest("VariantCreate")
|
.addAliasToGraphRequest("VariantCreate")
|
||||||
|
@ -234,16 +234,16 @@ describe("Creating variants", () => {
|
||||||
.wait("@VariantCreate")
|
.wait("@VariantCreate")
|
||||||
.then(({ response }) => {
|
.then(({ response }) => {
|
||||||
const variants = [
|
const variants = [
|
||||||
response.body.data.productVariantCreate.productVariant
|
response.body.data.productVariantCreate.productVariant,
|
||||||
];
|
];
|
||||||
createWaitingForCaptureOrder({
|
createWaitingForCaptureOrder({
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email: "example@example.com",
|
email: "example@example.com",
|
||||||
variantsList: variants,
|
variantsList: variants,
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -26,14 +26,14 @@ describe("As an admin I should be able to create order with variant without SKU"
|
||||||
variantsList,
|
variantsList,
|
||||||
defaultChannel,
|
defaultChannel,
|
||||||
shippingMethod,
|
shippingMethod,
|
||||||
address: addressResp
|
address: addressResp,
|
||||||
}) => {
|
}) => {
|
||||||
variants = variantsList;
|
variants = variantsList;
|
||||||
channel = defaultChannel;
|
channel = defaultChannel;
|
||||||
shippingMethodId = shippingMethod.id;
|
shippingMethodId = shippingMethod.id;
|
||||||
address = addressResp;
|
address = addressResp;
|
||||||
createCustomer(`${name}@example.com`, name, address, true);
|
createCustomer(`${name}@example.com`, name, address, true);
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(customerResp => {
|
.then(customerResp => {
|
||||||
const customer = customerResp.user;
|
const customer = customerResp.user;
|
||||||
|
@ -42,12 +42,12 @@ describe("As an admin I should be able to create order with variant without SKU"
|
||||||
channelId: channel.id,
|
channelId: channel.id,
|
||||||
customerId: customer.id,
|
customerId: customer.id,
|
||||||
shippingMethodId,
|
shippingMethodId,
|
||||||
variantsList: variants
|
variantsList: variants,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ errors }) => {
|
.then(({ errors }) => {
|
||||||
expect(errors, "check if no errors").to.be.empty;
|
expect(errors, "check if no errors").to.be.empty;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,26 +9,26 @@ import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||||
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
||||||
import {
|
import {
|
||||||
productDetailsUrl,
|
productDetailsUrl,
|
||||||
productVariantDetailUrl
|
productVariantDetailUrl,
|
||||||
} from "../../../fixtures/urlList";
|
} from "../../../fixtures/urlList";
|
||||||
import {
|
import {
|
||||||
createVariant,
|
createVariant,
|
||||||
getVariant
|
getVariant,
|
||||||
} from "../../../support/api/requests/Product";
|
} from "../../../support/api/requests/Product";
|
||||||
import {
|
import {
|
||||||
createTypeProduct,
|
createTypeProduct,
|
||||||
productAttributeAssignmentUpdate
|
productAttributeAssignmentUpdate,
|
||||||
} from "../../../support/api/requests/ProductType";
|
} from "../../../support/api/requests/ProductType";
|
||||||
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
import { getDefaultChannel } from "../../../support/api/utils/channelsUtils";
|
||||||
import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils";
|
import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils";
|
||||||
import {
|
import {
|
||||||
createProductInChannelWithoutVariants,
|
createProductInChannelWithoutVariants,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../../support/api/utils/products/productsUtils";
|
} from "../../../support/api/utils/products/productsUtils";
|
||||||
import {
|
import {
|
||||||
createShipping,
|
createShipping,
|
||||||
deleteShippingStartsWith
|
deleteShippingStartsWith,
|
||||||
} from "../../../support/api/utils/shippingUtils";
|
} from "../../../support/api/utils/shippingUtils";
|
||||||
|
|
||||||
describe("Updating products without sku", () => {
|
describe("Updating products without sku", () => {
|
||||||
|
@ -63,7 +63,7 @@ describe("Updating products without sku", () => {
|
||||||
createShipping({
|
createShipping({
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
address
|
address,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
|
@ -71,40 +71,40 @@ describe("Updating products without sku", () => {
|
||||||
warehouse = warehouseResp;
|
warehouse = warehouseResp;
|
||||||
shippingMethod = shippingMethodResp;
|
shippingMethod = shippingMethodResp;
|
||||||
createTypeAttributeAndCategoryForProduct({ name, attributeValues });
|
createTypeAttributeAndCategoryForProduct({ name, attributeValues });
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(
|
.then(
|
||||||
({
|
({
|
||||||
attribute: attributeResp,
|
attribute: attributeResp,
|
||||||
productType: productTypeResp,
|
productType: productTypeResp,
|
||||||
category: categoryResp
|
category: categoryResp,
|
||||||
}) => {
|
}) => {
|
||||||
attribute = attributeResp;
|
attribute = attributeResp;
|
||||||
productTypeWithVariants = productTypeResp;
|
productTypeWithVariants = productTypeResp;
|
||||||
category = categoryResp;
|
category = categoryResp;
|
||||||
productAttributeAssignmentUpdate({
|
productAttributeAssignmentUpdate({
|
||||||
productTypeId: productTypeWithVariants.id,
|
productTypeId: productTypeWithVariants.id,
|
||||||
attributeId: attribute.id
|
attributeId: attribute.id,
|
||||||
});
|
});
|
||||||
createTypeProduct({
|
createTypeProduct({
|
||||||
name: productTypeWithoutVariantsName,
|
name: productTypeWithoutVariantsName,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
hasVariants: false
|
hasVariants: false,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
.then(productTypeResp => {
|
.then(productTypeResp => {
|
||||||
productTypeWithoutVariants = productTypeResp;
|
productTypeWithoutVariants = productTypeResp;
|
||||||
productAttributeAssignmentUpdate({
|
productAttributeAssignmentUpdate({
|
||||||
productTypeId: productTypeWithoutVariants.id,
|
productTypeId: productTypeWithoutVariants.id,
|
||||||
attributeId: attribute.id
|
attributeId: attribute.id,
|
||||||
});
|
});
|
||||||
createProductInChannelWithoutVariants({
|
createProductInChannelWithoutVariants({
|
||||||
name,
|
name,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
productTypeId: productTypeWithVariants.id,
|
productTypeId: productTypeWithVariants.id,
|
||||||
categoryId: category.id
|
categoryId: category.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(productResp => (product = productResp));
|
.then(productResp => (product = productResp));
|
||||||
|
@ -126,7 +126,7 @@ describe("Updating products without sku", () => {
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
productTypeId: productTypeWithoutVariants.id
|
productTypeId: productTypeWithoutVariants.id,
|
||||||
})
|
})
|
||||||
.then(productResp => {
|
.then(productResp => {
|
||||||
simpleProduct = productResp;
|
simpleProduct = productResp;
|
||||||
|
@ -134,12 +134,12 @@ describe("Updating products without sku", () => {
|
||||||
productId: simpleProduct.id,
|
productId: simpleProduct.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
quantityInWarehouse: 10
|
quantityInWarehouse: 10,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(variantsList => {
|
.then(variantsList => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productDetailsUrl(simpleProduct.id)
|
productDetailsUrl(simpleProduct.id),
|
||||||
)
|
)
|
||||||
.get(SHARED_ELEMENTS.skeleton)
|
.get(SHARED_ELEMENTS.skeleton)
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
|
@ -154,7 +154,7 @@ describe("Updating products without sku", () => {
|
||||||
.then(variantResp => {
|
.then(variantResp => {
|
||||||
expect(variantResp.sku).to.eq(sku);
|
expect(variantResp.sku).to.eq(sku);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -169,12 +169,12 @@ describe("Updating products without sku", () => {
|
||||||
productId: product.id,
|
productId: product.id,
|
||||||
quantityInWarehouse: 10,
|
quantityInWarehouse: 10,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
attributeName: attributeValues[0]
|
attributeName: attributeValues[0],
|
||||||
})
|
})
|
||||||
.then(variantResp => {
|
.then(variantResp => {
|
||||||
variant = variantResp[0];
|
variant = variantResp[0];
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productVariantDetailUrl(product.id, variant.id)
|
productVariantDetailUrl(product.id, variant.id),
|
||||||
)
|
)
|
||||||
.get(SHARED_ELEMENTS.skeleton)
|
.get(SHARED_ELEMENTS.skeleton)
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
|
@ -189,7 +189,7 @@ describe("Updating products without sku", () => {
|
||||||
.then(variantResp => {
|
.then(variantResp => {
|
||||||
expect(variantResp.sku).to.equal(sku);
|
expect(variantResp.sku).to.equal(sku);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -204,12 +204,12 @@ describe("Updating products without sku", () => {
|
||||||
quantityInWarehouse: 10,
|
quantityInWarehouse: 10,
|
||||||
warehouseId: warehouse.id,
|
warehouseId: warehouse.id,
|
||||||
sku: name,
|
sku: name,
|
||||||
attributeName: attributeValues[1]
|
attributeName: attributeValues[1],
|
||||||
})
|
})
|
||||||
.then(variantResp => {
|
.then(variantResp => {
|
||||||
variant = variantResp[0];
|
variant = variantResp[0];
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productVariantDetailUrl(product.id, variant.id)
|
productVariantDetailUrl(product.id, variant.id),
|
||||||
)
|
)
|
||||||
.get(SHARED_ELEMENTS.skeleton)
|
.get(SHARED_ELEMENTS.skeleton)
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
|
@ -225,7 +225,7 @@ describe("Updating products without sku", () => {
|
||||||
expect(variantResp.sku).to.be.null;
|
expect(variantResp.sku).to.be.null;
|
||||||
checkIfCheckoutForVariantCanBeCompleted(variantResp);
|
checkIfCheckoutForVariantCanBeCompleted(variantResp);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -239,7 +239,7 @@ describe("Updating products without sku", () => {
|
||||||
attributeId: attribute.id,
|
attributeId: attribute.id,
|
||||||
categoryId: category.id,
|
categoryId: category.id,
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
productTypeId: productTypeWithoutVariants.id
|
productTypeId: productTypeWithoutVariants.id,
|
||||||
})
|
})
|
||||||
.then(productResp => {
|
.then(productResp => {
|
||||||
simpleProduct = productResp;
|
simpleProduct = productResp;
|
||||||
|
@ -248,12 +248,12 @@ describe("Updating products without sku", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
sku: simpleProductName,
|
sku: simpleProductName,
|
||||||
quantityInWarehouse: 10,
|
quantityInWarehouse: 10,
|
||||||
warehouseId: warehouse.id
|
warehouseId: warehouse.id,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(variantsList => {
|
.then(variantsList => {
|
||||||
cy.visitAndWaitForProgressBarToDisappear(
|
cy.visitAndWaitForProgressBarToDisappear(
|
||||||
productDetailsUrl(simpleProduct.id)
|
productDetailsUrl(simpleProduct.id),
|
||||||
)
|
)
|
||||||
.get(SHARED_ELEMENTS.skeleton)
|
.get(SHARED_ELEMENTS.skeleton)
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
|
@ -269,7 +269,7 @@ describe("Updating products without sku", () => {
|
||||||
expect(variantResp.sku).to.be.null;
|
expect(variantResp.sku).to.be.null;
|
||||||
checkIfCheckoutForVariantCanBeCompleted(variantResp);
|
checkIfCheckoutForVariantCanBeCompleted(variantResp);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
function checkIfCheckoutForVariantCanBeCompleted(variant) {
|
function checkIfCheckoutForVariantCanBeCompleted(variant) {
|
||||||
|
@ -278,7 +278,7 @@ describe("Updating products without sku", () => {
|
||||||
channelSlug: defaultChannel.slug,
|
channelSlug: defaultChannel.slug,
|
||||||
email,
|
email,
|
||||||
shippingMethodName: shippingMethod.name,
|
shippingMethodName: shippingMethod.name,
|
||||||
variantsList: [variant]
|
variantsList: [variant],
|
||||||
}).then(({ order }) => {
|
}).then(({ order }) => {
|
||||||
expect(order.id).to.be.ok;
|
expect(order.id).to.be.ok;
|
||||||
});
|
});
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { expectCorrectProductInformation } from "../../support/api/utils/product
|
||||||
import {
|
import {
|
||||||
createProductInChannel,
|
createProductInChannel,
|
||||||
createTypeAttributeAndCategoryForProduct,
|
createTypeAttributeAndCategoryForProduct,
|
||||||
deleteProductsStartsWith
|
deleteProductsStartsWith,
|
||||||
} from "../../support/api/utils/products/productsUtils";
|
} from "../../support/api/utils/products/productsUtils";
|
||||||
import { metadataForms } from "../../support/pages/catalog/metadataComponent";
|
import { metadataForms } from "../../support/pages/catalog/metadataComponent";
|
||||||
import { fillUpCommonFieldsForAllProductTypes } from "../../support/pages/catalog/products/productDetailsPage";
|
import { fillUpCommonFieldsForAllProductTypes } from "../../support/pages/catalog/products/productDetailsPage";
|
||||||
|
@ -53,7 +53,7 @@ describe("Update products", () => {
|
||||||
channelId: defaultChannel.id,
|
channelId: defaultChannel.id,
|
||||||
name,
|
name,
|
||||||
collectionId: collection.id,
|
collectionId: collection.id,
|
||||||
description
|
description,
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(({ product: productResp }) => {
|
.then(({ product: productResp }) => {
|
||||||
|
@ -76,29 +76,29 @@ describe("Update products", () => {
|
||||||
generalInfo: {
|
generalInfo: {
|
||||||
name: updatedName,
|
name: updatedName,
|
||||||
description: faker.lorem.sentence(),
|
description: faker.lorem.sentence(),
|
||||||
rating: 3
|
rating: 3,
|
||||||
},
|
},
|
||||||
seo: {
|
seo: {
|
||||||
slug: updatedName,
|
slug: updatedName,
|
||||||
title: "newTitle",
|
title: "newTitle",
|
||||||
description: "New description."
|
description: "New description.",
|
||||||
},
|
},
|
||||||
metadata: {
|
metadata: {
|
||||||
private: {
|
private: {
|
||||||
metadataForm: metadataForms.private,
|
metadataForm: metadataForms.private,
|
||||||
name: "newPrivate",
|
name: "newPrivate",
|
||||||
value: "value1"
|
value: "value1",
|
||||||
},
|
},
|
||||||
public: {
|
public: {
|
||||||
metadataForm: metadataForms.public,
|
metadataForm: metadataForms.public,
|
||||||
name: "newPublic",
|
name: "newPublic",
|
||||||
value: "value2"
|
value: "value2",
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
productOrganization: {
|
productOrganization: {
|
||||||
category: updatedCategory.name,
|
category: updatedCategory.name,
|
||||||
collection: updatedCollection.name
|
collection: updatedCollection.name,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
cy.clearSessionData()
|
cy.clearSessionData()
|
||||||
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product)
|
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product)
|
||||||
|
@ -120,7 +120,7 @@ describe("Update products", () => {
|
||||||
cy.loginUserViaRequest("token")
|
cy.loginUserViaRequest("token")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
getProductDetails(product.id, defaultChannel.slug, "auth").its(
|
getProductDetails(product.id, defaultChannel.slug, "auth").its(
|
||||||
"body.data.product"
|
"body.data.product",
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.then(resp => {
|
.then(resp => {
|
||||||
|
@ -148,8 +148,8 @@ describe("Update products", () => {
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
productResp =>
|
productResp =>
|
||||||
expect(productResp.product, "Check if product exist").to.be.null
|
expect(productResp.product, "Check if product exist").to.be.null,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,19 +12,19 @@ import { urlList, userDetailsUrl } from "../fixtures/urlList";
|
||||||
import { updatePlugin } from "../support/api/requests/Plugins";
|
import { updatePlugin } from "../support/api/requests/Plugins";
|
||||||
import {
|
import {
|
||||||
deleteStaffMembersStartsWith,
|
deleteStaffMembersStartsWith,
|
||||||
updateStaffMember
|
updateStaffMember,
|
||||||
} from "../support/api/requests/StaffMembers";
|
} from "../support/api/requests/StaffMembers";
|
||||||
import {
|
import {
|
||||||
getMailActivationLinkForUser,
|
getMailActivationLinkForUser,
|
||||||
getMailActivationLinkForUserAndSubject,
|
getMailActivationLinkForUserAndSubject,
|
||||||
inviteStaffMemberWithFirstPermission
|
inviteStaffMemberWithFirstPermission,
|
||||||
} from "../support/api/utils/users";
|
} from "../support/api/utils/users";
|
||||||
import { expectWelcomeMessageIncludes } from "../support/pages/homePage";
|
import { expectWelcomeMessageIncludes } from "../support/pages/homePage";
|
||||||
import { getDisplayedSelectors } from "../support/pages/permissionsPage";
|
import { getDisplayedSelectors } from "../support/pages/permissionsPage";
|
||||||
import {
|
import {
|
||||||
fillUpSetPassword,
|
fillUpSetPassword,
|
||||||
fillUpUserDetails,
|
fillUpUserDetails,
|
||||||
updateUserActiveFlag
|
updateUserActiveFlag,
|
||||||
} from "../support/pages/userPage";
|
} from "../support/pages/userPage";
|
||||||
|
|
||||||
describe("Staff members", () => {
|
describe("Staff members", () => {
|
||||||
|
@ -82,11 +82,11 @@ describe("Staff members", () => {
|
||||||
.then(tokenCreate => {
|
.then(tokenCreate => {
|
||||||
expect(
|
expect(
|
||||||
tokenCreate.errors[0].code,
|
tokenCreate.errors[0].code,
|
||||||
"logging in should return error"
|
"logging in should return error",
|
||||||
).to.be.eq("INACTIVE");
|
).to.be.eq("INACTIVE");
|
||||||
expect(tokenCreate.token).to.be.not.ok;
|
expect(tokenCreate.token).to.be.not.ok;
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it("should activate user", { tags: ["@staffMembers", "@stagedOnly"] }, () => {
|
it("should activate user", { tags: ["@staffMembers", "@stagedOnly"] }, () => {
|
||||||
|
@ -117,10 +117,10 @@ describe("Staff members", () => {
|
||||||
getDisplayedSelectors().then(displayedSelectors => {
|
getDisplayedSelectors().then(displayedSelectors => {
|
||||||
expect(Object.values(displayedSelectors)).to.have.length(1);
|
expect(Object.values(displayedSelectors)).to.have.length(1);
|
||||||
expect(Object.values(displayedSelectors)[0]).to.eq(
|
expect(Object.values(displayedSelectors)[0]).to.eq(
|
||||||
LEFT_MENU_SELECTORS.home
|
LEFT_MENU_SELECTORS.home,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -131,7 +131,7 @@ describe("Staff members", () => {
|
||||||
updatePlugin(
|
updatePlugin(
|
||||||
"mirumee.notifications.admin_email",
|
"mirumee.notifications.admin_email",
|
||||||
"staff_password_reset_subject",
|
"staff_password_reset_subject",
|
||||||
"Reset"
|
"Reset",
|
||||||
)
|
)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
cy.clearSessionData()
|
cy.clearSessionData()
|
||||||
|
@ -156,6 +156,6 @@ describe("Staff members", () => {
|
||||||
.should("be.visible")
|
.should("be.visible")
|
||||||
.loginUserViaRequest({ email, password: newPassword });
|
.loginUserViaRequest({ email, password: newPassword });
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@ import faker from "faker";
|
||||||
import {
|
import {
|
||||||
createCategory,
|
createCategory,
|
||||||
getCategory,
|
getCategory,
|
||||||
updateCategoryTranslation
|
updateCategoryTranslation,
|
||||||
} from "../support/api/requests/Category";
|
} from "../support/api/requests/Category";
|
||||||
import { deleteCategoriesStartsWith } from "../support/api/utils/catalog/categoryUtils";
|
import { deleteCategoriesStartsWith } from "../support/api/utils/catalog/categoryUtils";
|
||||||
import { updateTranslationToCategory } from "../support/pages/translationsPage";
|
import { updateTranslationToCategory } from "../support/pages/translationsPage";
|
||||||
|
@ -22,7 +22,7 @@ xdescribe("As an admin I want to manage translations", () => {
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
deleteCategoriesStartsWith(startsWith);
|
deleteCategoriesStartsWith(startsWith);
|
||||||
createCategory({ name: startsWith }).then(
|
createCategory({ name: startsWith }).then(
|
||||||
categoryResp => (category = categoryResp)
|
categoryResp => (category = categoryResp),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -44,19 +44,19 @@ xdescribe("As an admin I want to manage translations", () => {
|
||||||
translatedName,
|
translatedName,
|
||||||
translatedDescription,
|
translatedDescription,
|
||||||
translatedSeoTitle,
|
translatedSeoTitle,
|
||||||
translatedSeoDescription
|
translatedSeoDescription,
|
||||||
});
|
});
|
||||||
getCategory(category.id, "PL").then(({ translation }) => {
|
getCategory(category.id, "PL").then(({ translation }) => {
|
||||||
expect(translation.name).to.eq(`TranslatedName${randomNumber}`);
|
expect(translation.name).to.eq(`TranslatedName${randomNumber}`);
|
||||||
expect(translation.description).to.includes(
|
expect(translation.description).to.includes(
|
||||||
`TranslatedDescription${randomNumber}`
|
`TranslatedDescription${randomNumber}`,
|
||||||
);
|
);
|
||||||
expect(translation.seoTitle).to.eq(`TranslatedSeoTitle${randomNumber}`);
|
expect(translation.seoTitle).to.eq(`TranslatedSeoTitle${randomNumber}`);
|
||||||
expect(translation.seoDescription).to.eq(
|
expect(translation.seoDescription).to.eq(
|
||||||
`TranslatedSeoDescription${randomNumber}`
|
`TranslatedSeoDescription${randomNumber}`,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it(
|
it(
|
||||||
|
@ -76,7 +76,7 @@ xdescribe("As an admin I want to manage translations", () => {
|
||||||
seoTitle: "test",
|
seoTitle: "test",
|
||||||
seoDescription: "test",
|
seoDescription: "test",
|
||||||
name: "test",
|
name: "test",
|
||||||
description: "test"
|
description: "test",
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
updateTranslationToCategory({
|
updateTranslationToCategory({
|
||||||
|
@ -84,7 +84,7 @@ xdescribe("As an admin I want to manage translations", () => {
|
||||||
translatedName: nameUpdate,
|
translatedName: nameUpdate,
|
||||||
translatedDescription: descriptionUpdate,
|
translatedDescription: descriptionUpdate,
|
||||||
translatedSeoTitle: seoTitleUpdate,
|
translatedSeoTitle: seoTitleUpdate,
|
||||||
translatedSeoDescription: seoDescriptionUpdate
|
translatedSeoDescription: seoDescriptionUpdate,
|
||||||
});
|
});
|
||||||
getCategory(category.id, "PL");
|
getCategory(category.id, "PL");
|
||||||
})
|
})
|
||||||
|
@ -94,6 +94,6 @@ xdescribe("As an admin I want to manage translations", () => {
|
||||||
expect(translation.seoTitle).to.eq(seoTitleUpdate);
|
expect(translation.seoTitle).to.eq(seoTitleUpdate);
|
||||||
expect(translation.seoDescription).to.includes(seoDescriptionUpdate);
|
expect(translation.seoDescription).to.includes(seoDescriptionUpdate);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,8 +5,8 @@ export function expectCorrectDataInAttribute(
|
||||||
attributeType,
|
attributeType,
|
||||||
entityType = null,
|
entityType = null,
|
||||||
unit = null,
|
unit = null,
|
||||||
valueRequired = true
|
valueRequired = true,
|
||||||
}
|
},
|
||||||
) {
|
) {
|
||||||
expect(attribute.name).to.eq(attributeName);
|
expect(attribute.name).to.eq(attributeName);
|
||||||
expect(attribute.slug).to.eq(attributeName);
|
expect(attribute.slug).to.eq(attributeName);
|
||||||
|
|
|
@ -4,7 +4,7 @@ export function expectCorrectProductInformation(productResp, productData) {
|
||||||
expectCorrectMetadataInfo(productResp.metadata, productData.metadata.public);
|
expectCorrectMetadataInfo(productResp.metadata, productData.metadata.public);
|
||||||
expectCorrectMetadataInfo(
|
expectCorrectMetadataInfo(
|
||||||
productResp.privateMetadata,
|
productResp.privateMetadata,
|
||||||
productData.metadata.private
|
productData.metadata.private,
|
||||||
);
|
);
|
||||||
expectCorrectProductOrgInfo(productResp, productData.productOrganization);
|
expectCorrectProductOrgInfo(productResp, productData.productOrganization);
|
||||||
expectCorrectAttribute(productResp.attributes, productData.attribute);
|
expectCorrectAttribute(productResp.attributes, productData.attribute);
|
||||||
|
@ -13,22 +13,22 @@ export function expectCorrectProductInformation(productResp, productData) {
|
||||||
export function expectCorrectProductVariantInformation(
|
export function expectCorrectProductVariantInformation(
|
||||||
variantsResp,
|
variantsResp,
|
||||||
variantName,
|
variantName,
|
||||||
prices
|
prices,
|
||||||
) {
|
) {
|
||||||
expect(variantsResp).to.have.length(1);
|
expect(variantsResp).to.have.length(1);
|
||||||
expect(variantsResp[0].sku).to.be.eq(variantName);
|
expect(variantsResp[0].sku).to.be.eq(variantName);
|
||||||
expect(variantsResp[0].channelListings[0].costPrice.amount).to.be.eq(
|
expect(variantsResp[0].channelListings[0].costPrice.amount).to.be.eq(
|
||||||
prices.costPrice
|
prices.costPrice,
|
||||||
);
|
);
|
||||||
expect(variantsResp[0].channelListings[0].price.amount).to.be.eq(
|
expect(variantsResp[0].channelListings[0].price.amount).to.be.eq(
|
||||||
prices.sellingPrice
|
prices.sellingPrice,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectCorrectGeneralInformation(productResp, generalInfo) {
|
function expectCorrectGeneralInformation(productResp, generalInfo) {
|
||||||
expect(productResp.name, "Check product name").to.be.eq(generalInfo.name);
|
expect(productResp.name, "Check product name").to.be.eq(generalInfo.name);
|
||||||
expect(productResp.description, "Check product description").includes(
|
expect(productResp.description, "Check product description").includes(
|
||||||
generalInfo.description
|
generalInfo.description,
|
||||||
);
|
);
|
||||||
expect(productResp.rating, "Check product rate").to.be.eq(generalInfo.rating);
|
expect(productResp.rating, "Check product rate").to.be.eq(generalInfo.rating);
|
||||||
}
|
}
|
||||||
|
@ -37,39 +37,39 @@ function expectCorrectSeoInfo(productResp, seo) {
|
||||||
expect(productResp.slug, "Check product slug").to.be.eq(seo.slug);
|
expect(productResp.slug, "Check product slug").to.be.eq(seo.slug);
|
||||||
expect(productResp.seoTitle, "Check product seo title").to.be.eq(seo.title);
|
expect(productResp.seoTitle, "Check product seo title").to.be.eq(seo.title);
|
||||||
expect(productResp.seoDescription, "Check product seo description").to.be.eq(
|
expect(productResp.seoDescription, "Check product seo description").to.be.eq(
|
||||||
seo.description
|
seo.description,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectCorrectMetadataInfo(metadataResp, expectedMetadata) {
|
function expectCorrectMetadataInfo(metadataResp, expectedMetadata) {
|
||||||
expect(metadataResp, "Check metadata fields length").to.have.length(1);
|
expect(metadataResp, "Check metadata fields length").to.have.length(1);
|
||||||
expect(metadataResp[0].key, "Check product metadata key").to.be.eq(
|
expect(metadataResp[0].key, "Check product metadata key").to.be.eq(
|
||||||
expectedMetadata.name
|
expectedMetadata.name,
|
||||||
);
|
);
|
||||||
expect(metadataResp[0].value, "Check product metadata value").to.be.eq(
|
expect(metadataResp[0].value, "Check product metadata value").to.be.eq(
|
||||||
expectedMetadata.value
|
expectedMetadata.value,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectCorrectProductOrgInfo(productResp, productOrganization) {
|
function expectCorrectProductOrgInfo(productResp, productOrganization) {
|
||||||
expect(productResp.productType.name, "Check product type name").to.be.eq(
|
expect(productResp.productType.name, "Check product type name").to.be.eq(
|
||||||
productOrganization.productType
|
productOrganization.productType,
|
||||||
);
|
);
|
||||||
expect(productResp.category.name, "Check category name").to.be.eq(
|
expect(productResp.category.name, "Check category name").to.be.eq(
|
||||||
productOrganization.category
|
productOrganization.category,
|
||||||
);
|
);
|
||||||
expect(
|
expect(
|
||||||
productResp.collections,
|
productResp.collections,
|
||||||
"Check length of assigned collections"
|
"Check length of assigned collections",
|
||||||
).to.have.length(1);
|
).to.have.length(1);
|
||||||
expect(productResp.collections[0].name, "Check collection name").to.be.eq(
|
expect(productResp.collections[0].name, "Check collection name").to.be.eq(
|
||||||
productOrganization.collection
|
productOrganization.collection,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function expectCorrectAttribute(attributes, attribute) {
|
function expectCorrectAttribute(attributes, attribute) {
|
||||||
expect(attributes).to.have.length(1);
|
expect(attributes).to.have.length(1);
|
||||||
expect(attributes[0].attribute.name, "Check attribute name").to.be.eq(
|
expect(attributes[0].attribute.name, "Check attribute name").to.be.eq(
|
||||||
attribute.name
|
attribute.name,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
||||||
|
|
||||||
Cypress.Commands.add("assertVisibility", selector => {
|
Cypress.Commands.add("assertVisibility", selector => {
|
||||||
cy.get(selector).then(
|
cy.get(selector).then(
|
||||||
element => expect(element, "element should be visible").to.be.visible
|
element => expect(element, "element should be visible").to.be.visible,
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -10,26 +10,26 @@ Cypress.Commands.add(
|
||||||
"expectCorrectBasicAddress",
|
"expectCorrectBasicAddress",
|
||||||
(responseAddress, expectedAddress) => {
|
(responseAddress, expectedAddress) => {
|
||||||
expect(responseAddress.city.toUpperCase()).to.eq(
|
expect(responseAddress.city.toUpperCase()).to.eq(
|
||||||
expectedAddress.city.toUpperCase()
|
expectedAddress.city.toUpperCase(),
|
||||||
);
|
);
|
||||||
expect(responseAddress).to.have.property(
|
expect(responseAddress).to.have.property(
|
||||||
"countryArea",
|
"countryArea",
|
||||||
expectedAddress.countryArea
|
expectedAddress.countryArea,
|
||||||
);
|
);
|
||||||
expect(responseAddress).to.have.property("phone", expectedAddress.phone);
|
expect(responseAddress).to.have.property("phone", expectedAddress.phone);
|
||||||
expect(responseAddress).to.have.property(
|
expect(responseAddress).to.have.property(
|
||||||
"postalCode",
|
"postalCode",
|
||||||
expectedAddress.postalCode
|
expectedAddress.postalCode,
|
||||||
);
|
);
|
||||||
expect(responseAddress).to.have.property(
|
expect(responseAddress).to.have.property(
|
||||||
"streetAddress1",
|
"streetAddress1",
|
||||||
expectedAddress.streetAddress1
|
expectedAddress.streetAddress1,
|
||||||
);
|
);
|
||||||
expect(responseAddress).to.have.property(
|
expect(responseAddress).to.have.property(
|
||||||
"streetAddress2",
|
"streetAddress2",
|
||||||
expectedAddress.streetAddress2
|
expectedAddress.streetAddress2,
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Cypress.Commands.add(
|
Cypress.Commands.add(
|
||||||
|
@ -37,14 +37,14 @@ Cypress.Commands.add(
|
||||||
(responseAddress, expectedAddress) => {
|
(responseAddress, expectedAddress) => {
|
||||||
expect(responseAddress).to.have.property(
|
expect(responseAddress).to.have.property(
|
||||||
"firstName",
|
"firstName",
|
||||||
expectedAddress.firstName
|
expectedAddress.firstName,
|
||||||
);
|
);
|
||||||
expect(responseAddress).to.have.property(
|
expect(responseAddress).to.have.property(
|
||||||
"firstName",
|
"firstName",
|
||||||
expectedAddress.lastName
|
expectedAddress.lastName,
|
||||||
);
|
);
|
||||||
cy.expectCorrectBasicAddress(responseAddress, expectedAddress);
|
cy.expectCorrectBasicAddress(responseAddress, expectedAddress);
|
||||||
}
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
Cypress.Commands.add("expectSkeletonIsVisible", () => {
|
Cypress.Commands.add("expectSkeletonIsVisible", () => {
|
||||||
|
@ -55,7 +55,7 @@ Cypress.Commands.add("expectSkeletonIsVisible", () => {
|
||||||
cy.assertVisibility(SHARED_ELEMENTS.skeleton);
|
cy.assertVisibility(SHARED_ELEMENTS.skeleton);
|
||||||
} else {
|
} else {
|
||||||
expect(
|
expect(
|
||||||
$body.find(SHARED_ELEMENTS.skeleton, "skeleton should exist").length
|
$body.find(SHARED_ELEMENTS.skeleton, "skeleton should exist").length,
|
||||||
).to.be.eq(1);
|
).to.be.eq(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -58,7 +58,7 @@ function cypressGrepPlugin(config) {
|
||||||
const specFiles = globby.sync(specPattern, {
|
const specFiles = globby.sync(specPattern, {
|
||||||
cwd: integrationFolder,
|
cwd: integrationFolder,
|
||||||
ignore: excludeSpecPattern,
|
ignore: excludeSpecPattern,
|
||||||
absolute: true
|
absolute: true,
|
||||||
});
|
});
|
||||||
debug("found %d spec files", specFiles.length);
|
debug("found %d spec files", specFiles.length);
|
||||||
debug("%o", specFiles);
|
debug("%o", specFiles);
|
||||||
|
@ -66,7 +66,7 @@ function cypressGrepPlugin(config) {
|
||||||
if (grep) {
|
if (grep) {
|
||||||
console.log(
|
console.log(
|
||||||
'cypress-grep: filtering specs using "%s" in the title',
|
'cypress-grep: filtering specs using "%s" in the title',
|
||||||
grep
|
grep,
|
||||||
);
|
);
|
||||||
const parsedGrep = parseGrep(grep);
|
const parsedGrep = parseGrep(grep);
|
||||||
debug("parsed grep %o", parsedGrep);
|
debug("parsed grep %o", parsedGrep);
|
||||||
|
|
|
@ -91,7 +91,7 @@ function cypressGrep() {
|
||||||
parsedGrep,
|
parsedGrep,
|
||||||
nameToGrep,
|
nameToGrep,
|
||||||
tagsToGrep,
|
tagsToGrep,
|
||||||
grepUntagged
|
grepUntagged,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (tagsToGrep && tagsToGrep.length) {
|
if (tagsToGrep && tagsToGrep.length) {
|
||||||
|
@ -99,7 +99,7 @@ function cypressGrep() {
|
||||||
'should test "%s" with tags %s run? %s',
|
'should test "%s" with tags %s run? %s',
|
||||||
name,
|
name,
|
||||||
tagsToGrep.join(","),
|
tagsToGrep.join(","),
|
||||||
shouldRun
|
shouldRun,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
debug('should test "%s" run? %s', nameToGrep, shouldRun);
|
debug('should test "%s" run? %s', nameToGrep, shouldRun);
|
||||||
|
|
|
@ -16,12 +16,12 @@ function parseTitleGrep(s) {
|
||||||
if (s.startsWith("-")) {
|
if (s.startsWith("-")) {
|
||||||
return {
|
return {
|
||||||
title: s.substring(1),
|
title: s.substring(1),
|
||||||
invert: true
|
invert: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
title: s,
|
title: s,
|
||||||
invert: false
|
invert: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ function parseTagsGrep(s) {
|
||||||
if (part.startsWith("--")) {
|
if (part.startsWith("--")) {
|
||||||
explicitNotTags.push({
|
explicitNotTags.push({
|
||||||
tag: part.slice(2),
|
tag: part.slice(2),
|
||||||
invert: true
|
invert: true,
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -63,12 +63,12 @@ function parseTagsGrep(s) {
|
||||||
if (tag.startsWith("-")) {
|
if (tag.startsWith("-")) {
|
||||||
return {
|
return {
|
||||||
tag: tag.slice(1),
|
tag: tag.slice(1),
|
||||||
invert: true
|
invert: true,
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
tag,
|
tag,
|
||||||
invert: false
|
invert: false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -162,7 +162,7 @@ function shouldTestRun(parsedGrep, testName, tags = [], grepUntagged = false) {
|
||||||
function parseGrep(titlePart, tags) {
|
function parseGrep(titlePart, tags) {
|
||||||
return {
|
return {
|
||||||
title: parseFullTitleGrep(titlePart),
|
title: parseFullTitleGrep(titlePart),
|
||||||
tags: parseTagsGrep(tags)
|
tags: parseTagsGrep(tags),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,8 +178,8 @@ function resolveConfig(config) {
|
||||||
resolvedConfig: {
|
resolvedConfig: {
|
||||||
specPattern,
|
specPattern,
|
||||||
excludeSpecPattern,
|
excludeSpecPattern,
|
||||||
integrationFolder
|
integrationFolder,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,5 +191,5 @@ module.exports = {
|
||||||
resolveConfig,
|
resolveConfig,
|
||||||
shouldTestRun,
|
shouldTestRun,
|
||||||
shouldTestRunTags,
|
shouldTestRunTags,
|
||||||
shouldTestRunTitle
|
shouldTestRunTitle,
|
||||||
};
|
};
|
||||||
|
|
|
@ -54,26 +54,26 @@ Cypress.Commands.add(
|
||||||
.request({
|
.request({
|
||||||
body: {
|
body: {
|
||||||
variables,
|
variables,
|
||||||
query
|
query,
|
||||||
},
|
},
|
||||||
headers: {
|
headers: {
|
||||||
Authorization: `JWT ${window.sessionStorage.getItem(authorization)}`
|
Authorization: `JWT ${window.sessionStorage.getItem(authorization)}`,
|
||||||
},
|
},
|
||||||
method: "POST",
|
method: "POST",
|
||||||
url: urlList.apiUri,
|
url: urlList.apiUri,
|
||||||
log: true
|
log: true,
|
||||||
})
|
})
|
||||||
.then(response => {
|
.then(response => {
|
||||||
const respInSting = JSON.stringify(response.body);
|
const respInSting = JSON.stringify(response.body);
|
||||||
if (respInSting.includes(`"errors":[{`)) {
|
if (respInSting.includes(`"errors":[{`)) {
|
||||||
cy.log(query).log(JSON.stringify(response.body));
|
cy.log(query).log(JSON.stringify(response.body));
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
);
|
);
|
||||||
Cypress.on(
|
Cypress.on(
|
||||||
"uncaught:exception",
|
"uncaught:exception",
|
||||||
(err, runnable) =>
|
(err, runnable) =>
|
||||||
// returning false here prevents Cypress from
|
// returning false here prevents Cypress from
|
||||||
// failing the test
|
// failing the test
|
||||||
false
|
false,
|
||||||
);
|
);
|
||||||
|
|
12
cypress/support/index.d.ts
vendored
12
cypress/support/index.d.ts
vendored
|
@ -5,21 +5,21 @@ declare namespace Cypress {
|
||||||
element: {},
|
element: {},
|
||||||
deleteFunction: function,
|
deleteFunction: function,
|
||||||
startsWith: string,
|
startsWith: string,
|
||||||
name: string
|
name: string,
|
||||||
): Chainable<any>;
|
): Chainable<any>;
|
||||||
deleteElementsStartsWith(
|
deleteElementsStartsWith(
|
||||||
deleteFunction: function,
|
deleteFunction: function,
|
||||||
getFunction: function,
|
getFunction: function,
|
||||||
startsWith: string,
|
startsWith: string,
|
||||||
name? = string
|
name? = string,
|
||||||
): Chainable<any>;
|
): Chainable<any>;
|
||||||
expectCorrectFullAddress(
|
expectCorrectFullAddress(
|
||||||
responseAddress: string,
|
responseAddress: string,
|
||||||
expectedAddress: string
|
expectedAddress: string,
|
||||||
): Chainable<any>;
|
): Chainable<any>;
|
||||||
expectCorrectBasicAddress(
|
expectCorrectBasicAddress(
|
||||||
responseAddress: string,
|
responseAddress: string,
|
||||||
expectedAddress: string
|
expectedAddress: string,
|
||||||
): Chainable<any>;
|
): Chainable<any>;
|
||||||
getTextFromElement(element: {}): Chainable<any>;
|
getTextFromElement(element: {}): Chainable<any>;
|
||||||
clearAndType(subject: {}, text: string): Chainable<any>;
|
clearAndType(subject: {}, text: string): Chainable<any>;
|
||||||
|
@ -38,7 +38,7 @@ declare namespace Cypress {
|
||||||
fillBaseSelect(selectSelector: string, value: string): Chainable<any>;
|
fillBaseSelect(selectSelector: string, value: string): Chainable<any>;
|
||||||
fillAutocompleteSelect(
|
fillAutocompleteSelect(
|
||||||
selectSelector: string,
|
selectSelector: string,
|
||||||
option?: string
|
option?: string,
|
||||||
): Chainable<any>;
|
): Chainable<any>;
|
||||||
addAliasToGraphRequest(alias: string): Chainable<any>;
|
addAliasToGraphRequest(alias: string): Chainable<any>;
|
||||||
sendRequestWithQuery(query: string): Chainable<any>;
|
sendRequestWithQuery(query: string): Chainable<any>;
|
||||||
|
@ -48,7 +48,7 @@ declare namespace Cypress {
|
||||||
elementsGraphqlAlias: string,
|
elementsGraphqlAlias: string,
|
||||||
elementsName: string,
|
elementsName: string,
|
||||||
elementsIds: string,
|
elementsIds: string,
|
||||||
actionFunction
|
actionFunction,
|
||||||
}): Chainable<any>;
|
}): Chainable<any>;
|
||||||
searchInTable(query: string): Chainable<any>;
|
searchInTable(query: string): Chainable<any>;
|
||||||
waitForRequestAndCheckIfNoErrors(alias: string): Chainable<any>;
|
waitForRequestAndCheckIfNoErrors(alias: string): Chainable<any>;
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { PRODUCTS_LIST } from "../../../../elements/catalog/products/products-li
|
||||||
import { BUTTON_SELECTORS } from "../../../../elements/shared/button-selectors";
|
import { BUTTON_SELECTORS } from "../../../../elements/shared/button-selectors";
|
||||||
import {
|
import {
|
||||||
getElementByDataTestId,
|
getElementByDataTestId,
|
||||||
SHARED_ELEMENTS
|
SHARED_ELEMENTS,
|
||||||
} from "../../../../elements/shared/sharedElements";
|
} from "../../../../elements/shared/sharedElements";
|
||||||
import { urlList } from "../../../../fixtures/urlList";
|
import { urlList } from "../../../../fixtures/urlList";
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ export function isNumberOfProductsSameAsInSelectResultsOnPage() {
|
||||||
getDisplayedColumnArray("name");
|
getDisplayedColumnArray("name");
|
||||||
})
|
})
|
||||||
.then(
|
.then(
|
||||||
productsList => productsList.length === parseInt(numberOfResults, 10)
|
productsList => productsList.length === parseInt(numberOfResults, 10),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ export function selectAttributeFilter(attributeSlug, attributeValue) {
|
||||||
cy.get(
|
cy.get(
|
||||||
`${getElementByDataTestId(attributeSlug)}${
|
`${getElementByDataTestId(attributeSlug)}${
|
||||||
PRODUCTS_LIST.filters.filterField.filterField
|
PRODUCTS_LIST.filters.filterField.filterField
|
||||||
}`
|
}`,
|
||||||
)
|
)
|
||||||
.find(PRODUCTS_LIST.filters.filterOption)
|
.find(PRODUCTS_LIST.filters.filterOption)
|
||||||
.should("be.visible")
|
.should("be.visible")
|
||||||
|
@ -87,7 +87,7 @@ export function selectFilterByAttribute(attributeSlug) {
|
||||||
.get(
|
.get(
|
||||||
`${getElementByDataTestId(attributeSlug)}${
|
`${getElementByDataTestId(attributeSlug)}${
|
||||||
SHARED_ELEMENTS.filters.filterGroupActivateCheckbox
|
SHARED_ELEMENTS.filters.filterGroupActivateCheckbox
|
||||||
}`
|
}`,
|
||||||
)
|
)
|
||||||
.click();
|
.click();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,14 +10,14 @@ import { selectChannelInDetailsPages } from "../channelsPage";
|
||||||
|
|
||||||
export const discountOptions = {
|
export const discountOptions = {
|
||||||
PERCENTAGE: SALES_SELECTORS.percentageOption,
|
PERCENTAGE: SALES_SELECTORS.percentageOption,
|
||||||
FIXED: SALES_SELECTORS.fixedOption
|
FIXED: SALES_SELECTORS.fixedOption,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function createSale({
|
export function createSale({
|
||||||
saleName,
|
saleName,
|
||||||
channelName,
|
channelName,
|
||||||
discountValue = 10,
|
discountValue = 10,
|
||||||
discountOption = discountOptions.PERCENTAGE
|
discountOption = discountOptions.PERCENTAGE,
|
||||||
}) {
|
}) {
|
||||||
const todaysDate = formatDate(new Date());
|
const todaysDate = formatDate(new Date());
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ export function createSaleWithNewProduct({
|
||||||
categoryId,
|
categoryId,
|
||||||
price,
|
price,
|
||||||
discountOption,
|
discountOption,
|
||||||
discountValue
|
discountValue,
|
||||||
}) {
|
}) {
|
||||||
return createProductInChannel({
|
return createProductInChannel({
|
||||||
name,
|
name,
|
||||||
|
@ -92,7 +92,7 @@ export function createSaleWithNewProduct({
|
||||||
productTypeId,
|
productTypeId,
|
||||||
attributeId,
|
attributeId,
|
||||||
categoryId,
|
categoryId,
|
||||||
price
|
price,
|
||||||
}).then(({ product: productResp }) => {
|
}).then(({ product: productResp }) => {
|
||||||
/* Uncomment after fixing SALEOR-3367 bug
|
/* Uncomment after fixing SALEOR-3367 bug
|
||||||
cy.clearSessionData()
|
cy.clearSessionData()
|
||||||
|
@ -106,7 +106,7 @@ export function createSaleWithNewProduct({
|
||||||
saleName: name,
|
saleName: name,
|
||||||
channelName: channel.name,
|
channelName: channel.name,
|
||||||
discountValue,
|
discountValue,
|
||||||
discountOption
|
discountOption,
|
||||||
});
|
});
|
||||||
assignProducts(product.name);
|
assignProducts(product.name);
|
||||||
return getProductPrice(product.id, channel.slug);
|
return getProductPrice(product.id, channel.slug);
|
||||||
|
@ -122,7 +122,7 @@ export function createSaleWithNewVariant({
|
||||||
categoryId,
|
categoryId,
|
||||||
price,
|
price,
|
||||||
discountValue,
|
discountValue,
|
||||||
discountOption
|
discountOption,
|
||||||
}) {
|
}) {
|
||||||
return createProductInChannel({
|
return createProductInChannel({
|
||||||
name,
|
name,
|
||||||
|
@ -131,7 +131,7 @@ export function createSaleWithNewVariant({
|
||||||
productTypeId,
|
productTypeId,
|
||||||
attributeId,
|
attributeId,
|
||||||
categoryId,
|
categoryId,
|
||||||
price
|
price,
|
||||||
}).then(({ variantsList: variantsListResp, product }) => {
|
}).then(({ variantsList: variantsListResp, product }) => {
|
||||||
/* Uncomment after fixing SALEOR-3367 bug
|
/* Uncomment after fixing SALEOR-3367 bug
|
||||||
cy.clearSessionData()
|
cy.clearSessionData()
|
||||||
|
@ -144,7 +144,7 @@ export function createSaleWithNewVariant({
|
||||||
saleName: name,
|
saleName: name,
|
||||||
channelName: channel.name,
|
channelName: channel.name,
|
||||||
discountValue,
|
discountValue,
|
||||||
discountOption
|
discountOption,
|
||||||
});
|
});
|
||||||
assignVariants(product.name, variant.name);
|
assignVariants(product.name, variant.name);
|
||||||
return getVariant(variant.id, channel.slug, "token");
|
return getVariant(variant.id, channel.slug, "token");
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { selectChannelInDetailsPages } from "../channelsPage";
|
||||||
export const discountOptions = {
|
export const discountOptions = {
|
||||||
PERCENTAGE: VOUCHERS_SELECTORS.percentageDiscountRadioButton,
|
PERCENTAGE: VOUCHERS_SELECTORS.percentageDiscountRadioButton,
|
||||||
FIXED: VOUCHERS_SELECTORS.fixedDiscountRadioButton,
|
FIXED: VOUCHERS_SELECTORS.fixedDiscountRadioButton,
|
||||||
SHIPPING: VOUCHERS_SELECTORS.shippingDiscountRadioButton
|
SHIPPING: VOUCHERS_SELECTORS.shippingDiscountRadioButton,
|
||||||
};
|
};
|
||||||
|
|
||||||
export function createVoucher({
|
export function createVoucher({
|
||||||
|
@ -20,7 +20,7 @@ export function createVoucher({
|
||||||
applyOnePerCustomer,
|
applyOnePerCustomer,
|
||||||
onlyStaff,
|
onlyStaff,
|
||||||
minOrderValue,
|
minOrderValue,
|
||||||
minAmountOfItems
|
minAmountOfItems,
|
||||||
}) {
|
}) {
|
||||||
cy.get(VOUCHERS_SELECTORS.createVoucherButton).click();
|
cy.get(VOUCHERS_SELECTORS.createVoucherButton).click();
|
||||||
selectChannelInDetailsPages(channelName);
|
selectChannelInDetailsPages(channelName);
|
||||||
|
@ -64,7 +64,7 @@ export function setVoucherDate({
|
||||||
startDate,
|
startDate,
|
||||||
endDate,
|
endDate,
|
||||||
endTime,
|
endTime,
|
||||||
hasEndDate = false
|
hasEndDate = false,
|
||||||
}) {
|
}) {
|
||||||
cy.visit(voucherDetailsUrl(voucherId)).waitForProgressBarToNotBeVisible();
|
cy.visit(voucherDetailsUrl(voucherId)).waitForProgressBarToNotBeVisible();
|
||||||
if (startDate) {
|
if (startDate) {
|
||||||
|
@ -95,7 +95,7 @@ export function loginAndCreateCheckoutForVoucherWithDiscount({
|
||||||
applyOnePerCustomer,
|
applyOnePerCustomer,
|
||||||
onlyStaff,
|
onlyStaff,
|
||||||
minOrderValue,
|
minOrderValue,
|
||||||
minAmountOfItems
|
minAmountOfItems,
|
||||||
}) {
|
}) {
|
||||||
cy.clearSessionData()
|
cy.clearSessionData()
|
||||||
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.discount)
|
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.discount)
|
||||||
|
@ -110,7 +110,7 @@ export function loginAndCreateCheckoutForVoucherWithDiscount({
|
||||||
applyOnePerCustomer,
|
applyOnePerCustomer,
|
||||||
onlyStaff,
|
onlyStaff,
|
||||||
minOrderValue,
|
minOrderValue,
|
||||||
minAmountOfItems
|
minAmountOfItems,
|
||||||
});
|
});
|
||||||
dataForCheckout.voucherCode = voucherCode;
|
dataForCheckout.voucherCode = voucherCode;
|
||||||
return createCheckoutWithVoucher(dataForCheckout);
|
return createCheckoutWithVoucher(dataForCheckout);
|
||||||
|
|
Loading…
Reference in a new issue