Fix failing cypress tests (#1671)
* fix tests * fix prorders & images * change base url * remove comment
This commit is contained in:
parent
6e9b12b04e
commit
5a14884f9d
14 changed files with 43 additions and 34 deletions
|
@ -76,7 +76,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.waitForProgressBarToNotExist()
|
.waitForProgressBarToNotExist()
|
||||||
.get(PRODUCTS_LIST.emptyProductRow)
|
.get(PRODUCTS_LIST.emptyProductRow)
|
||||||
.should("not.exist")
|
.should("not.exist")
|
||||||
.get(PRODUCTS_LIST.productsList)
|
.get(PRODUCTS_LIST.productsNames)
|
||||||
.first()
|
.first()
|
||||||
.click()
|
.click()
|
||||||
.get(AVAILABLE_CHANNELS_FORM.menageChannelsButton)
|
.get(AVAILABLE_CHANNELS_FORM.menageChannelsButton)
|
||||||
|
|
|
@ -91,14 +91,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
.should("be.visible")
|
.should("be.visible")
|
||||||
.waitForProgressBarToNotExist()
|
.waitForProgressBarToNotExist()
|
||||||
.addAliasToGraphRequest("ShippingZone")
|
.addAliasToGraphRequest("ShippingZone")
|
||||||
.getTextFromElement(SHARED_ELEMENTS.table);
|
.findElementOnTable(shippingZone.name, "ShippingZones")
|
||||||
})
|
|
||||||
.then(tableText => {
|
|
||||||
if (!tableText.includes(shippingZone.name)) {
|
|
||||||
cy.get(BUTTON_SELECTORS.nextPaginationButton).click();
|
|
||||||
}
|
|
||||||
cy.contains(shippingZone.name)
|
|
||||||
.click()
|
|
||||||
.waitForRequestAndCheckIfNoErrors("@ShippingZone");
|
.waitForRequestAndCheckIfNoErrors("@ShippingZone");
|
||||||
enterHomePageChangeChannelAndReturn(defaultChannel.name);
|
enterHomePageChangeChannelAndReturn(defaultChannel.name);
|
||||||
cy.waitForProgressBarToNotBeVisible()
|
cy.waitForProgressBarToNotBeVisible()
|
||||||
|
|
|
@ -37,7 +37,7 @@ filterTests({ definedTags: ["all"], version: "3.1.1" }, () => {
|
||||||
cy.visit(urlList.translations)
|
cy.visit(urlList.translations)
|
||||||
.get(LANGUAGES_LIST.polishLanguageButton)
|
.get(LANGUAGES_LIST.polishLanguageButton)
|
||||||
.click()
|
.click()
|
||||||
.findElementOnTable(category.name);
|
.findElementOnTable(category.name, "CategoryTranslations");
|
||||||
cy.get(ELEMENT_TRANSLATION.editNameButton)
|
cy.get(ELEMENT_TRANSLATION.editNameButton)
|
||||||
.click()
|
.click()
|
||||||
.get(SHARED_ELEMENTS.skeleton)
|
.get(SHARED_ELEMENTS.skeleton)
|
||||||
|
|
|
@ -96,6 +96,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
let variantOnSale;
|
let variantOnSale;
|
||||||
|
|
||||||
productData.name = productName;
|
productData.name = productName;
|
||||||
|
productData.sku = productName;
|
||||||
createProductInChannel(productData)
|
createProductInChannel(productData)
|
||||||
.then(({ product, variantsList }) => {
|
.then(({ product, variantsList }) => {
|
||||||
variantNotOnSale = variantsList;
|
variantNotOnSale = variantsList;
|
||||||
|
@ -103,7 +104,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
productData.sku = name;
|
productData.sku = name;
|
||||||
productData.productId = product.id;
|
productData.productId = product.id;
|
||||||
productData.quantityInWarehouse = 10;
|
productData.quantityInWarehouse = 10;
|
||||||
productData.attributeValues = ["value2"];
|
productData.attributeName = "value2";
|
||||||
createVariant(productData);
|
createVariant(productData);
|
||||||
})
|
})
|
||||||
.then(variantsList => {
|
.then(variantsList => {
|
||||||
|
@ -141,6 +142,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
let variants;
|
let variants;
|
||||||
let saleToDelete;
|
let saleToDelete;
|
||||||
productData.name = name;
|
productData.name = name;
|
||||||
|
productData.sku = name;
|
||||||
createProductInChannel(productData)
|
createProductInChannel(productData)
|
||||||
.then(({ variantsList }) => {
|
.then(({ variantsList }) => {
|
||||||
variants = variantsList;
|
variants = variantsList;
|
||||||
|
@ -183,6 +185,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
let product;
|
let product;
|
||||||
let variants;
|
let variants;
|
||||||
productData.name = name;
|
productData.name = name;
|
||||||
|
productData.sku = name;
|
||||||
createProductInChannel(productData)
|
createProductInChannel(productData)
|
||||||
.then(({ variantsList, product: productResp }) => {
|
.then(({ variantsList, product: productResp }) => {
|
||||||
product = productResp;
|
product = productResp;
|
||||||
|
|
|
@ -18,6 +18,7 @@ import {
|
||||||
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 { deleteShippingStartsWith } from "../../support/api/utils/shippingUtils";
|
||||||
import filterTests from "../../support/filterTests";
|
import filterTests from "../../support/filterTests";
|
||||||
import {
|
import {
|
||||||
createVoucher,
|
createVoucher,
|
||||||
|
@ -41,6 +42,7 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
channelsUtils.deleteChannelsStartsWith(startsWith);
|
channelsUtils.deleteChannelsStartsWith(startsWith);
|
||||||
deleteVouchersStartsWith(startsWith);
|
deleteVouchersStartsWith(startsWith);
|
||||||
|
deleteShippingStartsWith(startsWith);
|
||||||
const name = `${startsWith}${faker.datatype.number()}`;
|
const name = `${startsWith}${faker.datatype.number()}`;
|
||||||
productsUtils
|
productsUtils
|
||||||
.createProductWithShipping({ name, productPrice, shippingPrice })
|
.createProductWithShipping({ name, productPrice, shippingPrice })
|
||||||
|
|
|
@ -116,8 +116,6 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should create order with selected channel", () => {
|
it("should create order with selected channel", () => {
|
||||||
// Remove login as admin after fixing SALEOR-3154
|
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
|
||||||
cy.visit(urlList.orders)
|
cy.visit(urlList.orders)
|
||||||
.get(ORDERS_SELECTORS.createOrder)
|
.get(ORDERS_SELECTORS.createOrder)
|
||||||
.click();
|
.click();
|
||||||
|
@ -131,7 +129,6 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// This test will pass after fixing SALEOR-3154
|
|
||||||
it("should not be possible to change channel in order", () => {
|
it("should not be possible to change channel in order", () => {
|
||||||
createOrder({
|
createOrder({
|
||||||
customerId: customer.id,
|
customerId: customer.id,
|
||||||
|
|
|
@ -22,7 +22,7 @@ import {
|
||||||
} from "../../support/pages/catalog/products/VariantsPage";
|
} from "../../support/pages/catalog/products/VariantsPage";
|
||||||
|
|
||||||
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
|
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
|
||||||
describe("Creating variants", () => {
|
describe("Creating variants in preorder", () => {
|
||||||
const startsWith = "CreatePreOrder";
|
const startsWith = "CreatePreOrder";
|
||||||
const attributeValues = ["value1", "value2", "value3"];
|
const attributeValues = ["value1", "value2", "value3"];
|
||||||
const threshold = 100;
|
const threshold = 100;
|
||||||
|
|
|
@ -13,8 +13,8 @@ import filterTests from "../../support/filterTests";
|
||||||
import { saveVariant } from "../../support/pages/catalog/products/VariantsPage";
|
import { saveVariant } from "../../support/pages/catalog/products/VariantsPage";
|
||||||
|
|
||||||
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
|
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
|
||||||
describe("Creating variants", () => {
|
describe("Stocks and threshold in preorder variants", () => {
|
||||||
const startsWith = "CreatePreOrder";
|
const startsWith = "StocksThreshold";
|
||||||
const attributeValues = ["value1", "value2"];
|
const attributeValues = ["value1", "value2"];
|
||||||
const preorder = {
|
const preorder = {
|
||||||
globalThreshold: 15
|
globalThreshold: 15
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
|
||||||
import { demoProductsNames } from "../../fixtures/products";
|
import { demoProductsNames } from "../../fixtures/products";
|
||||||
import { productDetailsUrl, urlList } from "../../fixtures/urlList";
|
import { productDetailsUrl, urlList } from "../../fixtures/urlList";
|
||||||
import { getFirstProducts } from "../../support/api/requests/Product";
|
import { getFirstProducts } from "../../support/api/requests/Product";
|
||||||
import { loginDeleteProductsAndCreateNewOneWithNewDataAndDefaultChannel } from "../../support/api/utils/products/productsUtils";
|
import { deleteProductsAndCreateNewOneWithNewDataAndDefaultChannel } from "../../support/api/utils/products/productsUtils";
|
||||||
import filterTests from "../../support/filterTests";
|
import filterTests from "../../support/filterTests";
|
||||||
|
|
||||||
filterTests({ definedTags: ["all"] }, () => {
|
filterTests({ definedTags: ["all"] }, () => {
|
||||||
|
@ -26,7 +26,8 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
element.data.hasOwnProperty("products")
|
element.data.hasOwnProperty("products")
|
||||||
).data;
|
).data;
|
||||||
const products = data.products.edges;
|
const products = data.products.edges;
|
||||||
cy.get(PRODUCTS_LIST.productImage)
|
cy.get(PRODUCTS_LIST.productsList)
|
||||||
|
.find(PRODUCTS_LIST.productImage)
|
||||||
.each($image => {
|
.each($image => {
|
||||||
cy.wrap($image)
|
cy.wrap($image)
|
||||||
.invoke("attr", "src")
|
.invoke("attr", "src")
|
||||||
|
@ -68,9 +69,10 @@ filterTests({ definedTags: ["all"] }, () => {
|
||||||
const name = "CyImages";
|
const name = "CyImages";
|
||||||
|
|
||||||
cy.clearSessionData().loginUserViaRequest();
|
cy.clearSessionData().loginUserViaRequest();
|
||||||
loginDeleteProductsAndCreateNewOneWithNewDataAndDefaultChannel({ name })
|
deleteProductsAndCreateNewOneWithNewDataAndDefaultChannel({ name })
|
||||||
.then(product => {
|
.then(({ product }) => {
|
||||||
cy.visit(productDetailsUrl(product.id))
|
cy.visit(productDetailsUrl(product.id))
|
||||||
|
.waitForProgressBarToNotBeVisible()
|
||||||
.get(PRODUCT_DETAILS.uploadImageButton)
|
.get(PRODUCT_DETAILS.uploadImageButton)
|
||||||
.click()
|
.click()
|
||||||
.get(PRODUCT_DETAILS.uploadSavedImagesButton)
|
.get(PRODUCT_DETAILS.uploadSavedImagesButton)
|
||||||
|
|
|
@ -18,18 +18,20 @@ export function createCollection(name, slug = name) {
|
||||||
.sendRequestWithQuery(mutation)
|
.sendRequestWithQuery(mutation)
|
||||||
.its("body.data.collectionCreate.collection");
|
.its("body.data.collectionCreate.collection");
|
||||||
}
|
}
|
||||||
export function getCollections(search) {
|
|
||||||
|
export function getCollections(first, search) {
|
||||||
const filter = search
|
const filter = search
|
||||||
? `, filter:{
|
? `, filter:{
|
||||||
search:""
|
search:""
|
||||||
}`
|
}`
|
||||||
: "";
|
: "";
|
||||||
const query = `query{
|
const query = `query{
|
||||||
collections(first:100 ${filter}){
|
collections(first:${first} ${filter}){
|
||||||
edges{
|
edges{
|
||||||
node{
|
node{
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
|
slug
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,6 @@ export function createVariant({
|
||||||
costPrice = 1,
|
costPrice = 1,
|
||||||
trackInventory = true,
|
trackInventory = true,
|
||||||
weight = 1,
|
weight = 1,
|
||||||
attributeValues = ["value"],
|
|
||||||
attributeName = "value",
|
attributeName = "value",
|
||||||
preorder
|
preorder
|
||||||
}) {
|
}) {
|
||||||
|
@ -205,7 +204,7 @@ export function createVariant({
|
||||||
id
|
id
|
||||||
name
|
name
|
||||||
}
|
}
|
||||||
bulkProductErrors{
|
errors{
|
||||||
field
|
field
|
||||||
message
|
message
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
import { deleteCollection, getCollections } from "../../requests/Collections";
|
import { deleteCollection, getCollections } from "../../requests/Collections";
|
||||||
|
|
||||||
export function deleteCollectionsStartsWith(startsWith) {
|
export function deleteCollectionsStartsWith(startsWith) {
|
||||||
cy.deleteElementsStartsWith(deleteCollection, getCollections, startsWith);
|
cy.deleteElementsStartsWith(
|
||||||
|
deleteCollection,
|
||||||
|
getCollections,
|
||||||
|
startsWith,
|
||||||
|
"slug"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
|
||||||
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
|
||||||
|
|
||||||
Cypress.Commands.add("findElementOnTable", elementName => {
|
Cypress.Commands.add("findElementOnTable", (elementName, alias) => {
|
||||||
cy.getTextFromElement(SHARED_ELEMENTS.table).then(tableText => {
|
cy.getTextFromElement(SHARED_ELEMENTS.table).then(tableText => {
|
||||||
if (tableText.includes(elementName)) {
|
if (tableText.includes(elementName)) {
|
||||||
cy.contains(SHARED_ELEMENTS.tableRow, elementName).click({ force: true });
|
cy.contains(SHARED_ELEMENTS.tableRow, elementName).click({ force: true });
|
||||||
} else {
|
} else {
|
||||||
cy.get(BUTTON_SELECTORS.nextPaginationButton)
|
cy.addAliasToGraphRequest(alias);
|
||||||
.click()
|
cy.get(BUTTON_SELECTORS.nextPaginationButton).click();
|
||||||
.findElementOnTable(elementName);
|
if (alias) {
|
||||||
|
cy.wait(`@${alias}`);
|
||||||
|
}
|
||||||
|
cy.findElementOnTable(elementName, alias);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -114,9 +114,10 @@ export function fillUpVariantAttributeAndSku({ attributeName, sku }) {
|
||||||
.click()
|
.click()
|
||||||
.get(VARIANTS_SELECTORS.attributeOption)
|
.get(VARIANTS_SELECTORS.attributeOption)
|
||||||
.contains(attributeName)
|
.contains(attributeName)
|
||||||
.click()
|
.click();
|
||||||
.get(VARIANTS_SELECTORS.skuInputInAddVariant)
|
if (sku) {
|
||||||
.type(sku);
|
cy.get(VARIANTS_SELECTORS.skuInputInAddVariant).type(sku);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function selectChannelForVariantAndFillUpPrices({
|
export function selectChannelForVariantAndFillUpPrices({
|
||||||
|
@ -125,7 +126,9 @@ export function selectChannelForVariantAndFillUpPrices({
|
||||||
price,
|
price,
|
||||||
costPrice = price
|
costPrice = price
|
||||||
}) {
|
}) {
|
||||||
cy.addAliasToGraphRequest("ProductChannelListingUpdate");
|
cy.waitForProgressBarToNotBeVisible().addAliasToGraphRequest(
|
||||||
|
"ProductChannelListingUpdate"
|
||||||
|
);
|
||||||
selectChannelVariantInDetailsPage(channelName, attributeName);
|
selectChannelVariantInDetailsPage(channelName, attributeName);
|
||||||
cy.get(BUTTON_SELECTORS.confirm)
|
cy.get(BUTTON_SELECTORS.confirm)
|
||||||
.click()
|
.click()
|
||||||
|
|
Loading…
Reference in a new issue