Disable Saleor_0702 for 3.5 or higher (#2182)

* update tests and snapshots

* remove if for 3.5 version

* remove deprecated test

* fix tests after rebase with main
This commit is contained in:
Anna Szczęch 2022-07-29 10:15:33 +02:00 committed by GitHub
parent 8a07f226e6
commit c076d52f68
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 49 additions and 9 deletions

View file

@ -13,25 +13,39 @@ import { urlList } from "../../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../../fixtures/users"; import { ONE_PERMISSION_USERS } from "../../../fixtures/users";
import { createChannel } from "../../../support/api/requests/Channels"; import { createChannel } from "../../../support/api/requests/Channels";
import { import {
createShippingZone, createShippingZoneWithoutWarehouse,
getShippingZone, getShippingZone,
} from "../../../support/api/requests/ShippingMethod"; } from "../../../support/api/requests/ShippingMethod";
import { createWarehouse as createWarehouseViaApi } from "../../../support/api/requests/Warehouse";
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";
import { deleteWarehouseStartsWith } from "../../../support/api/utils/warehouseUtils";
import { returnValueDependsOnShopVersion } from "../../../support/formatData/dataDependingOnVersion";
import { createChannelByView } from "../../../support/pages/channelsPage"; import { createChannelByView } from "../../../support/pages/channelsPage";
describe("Channels", () => { describe("Channels", () => {
const channelStartsWith = `CyChannels`; const channelStartsWith = `CyChannels`;
const randomName = `${channelStartsWith} ${faker.datatype.number()}`; const randomName = `${channelStartsWith}${faker.datatype.number()}`;
const currency = "PLN"; const currency = "PLN";
let shippingZone; let shippingZone;
let usAddress;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteChannelsStartsWith(channelStartsWith); deleteChannelsStartsWith(channelStartsWith);
deleteShippingStartsWith(channelStartsWith); deleteShippingStartsWith(channelStartsWith);
createShippingZone(randomName, "US").then(shippingZoneResp => { deleteWarehouseStartsWith(channelStartsWith);
shippingZone = shippingZoneResp; createShippingZoneWithoutWarehouse(randomName, "US").then(
shippingZoneResp => {
shippingZone = shippingZoneResp;
},
);
cy.fixture("addresses").then(addresses => {
usAddress = addresses.usAddress;
createWarehouseViaApi({
name: randomName,
address: usAddress,
});
}); });
}); });
@ -85,9 +99,8 @@ describe("Channels", () => {
.contains(randomChannel); .contains(randomChannel);
}, },
); );
it( it(
"should create channel with shippingZone. TC: SALEOR_0702", "should create channel with shippingZone and warehouse TC: SALEOR_0712",
{ tags: ["@channel", "@allEnv"] }, { tags: ["@channel", "@allEnv"] },
() => { () => {
// remove login after fixing SALEOR-3162 // remove login after fixing SALEOR-3162
@ -102,6 +115,7 @@ describe("Channels", () => {
name: randomChannel, name: randomChannel,
currency, currency,
shippingZone: shippingZone.name, shippingZone: shippingZone.name,
warehouse: randomName,
}); });
cy.waitForRequestAndCheckIfNoErrors("@Channel"); cy.waitForRequestAndCheckIfNoErrors("@Channel");
getShippingZone(shippingZone.id).then(shippingZoneResp => { getShippingZone(shippingZone.id).then(shippingZoneResp => {

View file

@ -0,0 +1,9 @@
import * as warehouseRequest from "../requests/Warehouse";
export function deleteWarehouseStartsWith(startsWith) {
cy.deleteElementsStartsWith(
warehouseRequest.deleteWarehouse,
warehouseRequest.getWarehouses,
startsWith,
);
}

View file

@ -13,7 +13,8 @@ export function createChannelByView({
currency, currency,
slug = name, slug = name,
shippingZone, shippingZone,
defaultCountry = "Poland" defaultCountry = "Poland",
warehouse,
}) { }) {
cy.addAliasToGraphRequest("Channel") cy.addAliasToGraphRequest("Channel")
.get(CHANNELS_SELECTORS.createChannelButton) .get(CHANNELS_SELECTORS.createChannelButton)
@ -34,22 +35,38 @@ export function createChannelByView({
}); });
cy.fillAutocompleteSelect( cy.fillAutocompleteSelect(
ADD_CHANNEL_FORM_SELECTORS.countryAutocompleteInput, ADD_CHANNEL_FORM_SELECTORS.countryAutocompleteInput,
defaultCountry defaultCountry,
); );
if (shippingZone) { if (shippingZone) {
addShippingZone(shippingZone); addShippingZone(shippingZone);
} }
if (warehouse) {
addWarehouse(warehouse);
}
cy.get(ADD_CHANNEL_FORM_SELECTORS.saveButton).click(); cy.get(ADD_CHANNEL_FORM_SELECTORS.saveButton).click();
} }
export function addShippingZone(shippingZone) { export function addShippingZone(shippingZone) {
cy.get(BUTTON_SELECTORS.expandIcon) cy.get(BUTTON_SELECTORS.expandIcon)
.first()
.click() .click()
.get(ADD_CHANNEL_FORM_SELECTORS.addShippingZoneButton) .get(ADD_CHANNEL_FORM_SELECTORS.addShippingZoneButton)
.click() .click()
.fillAutocompleteSelect( .fillAutocompleteSelect(
ADD_CHANNEL_FORM_SELECTORS.shippingAutocompleteSelect, ADD_CHANNEL_FORM_SELECTORS.shippingAutocompleteSelect,
shippingZone shippingZone,
);
}
export function addWarehouse(warehouse) {
cy.get(BUTTON_SELECTORS.expandIcon)
.last()
.click()
.get(ADD_CHANNEL_FORM_SELECTORS.addWarehouseButton)
.click()
.fillAutocompleteSelect(
ADD_CHANNEL_FORM_SELECTORS.warehouseAutocompleteSelect,
warehouse,
); );
} }