Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests - removing redundant session cleanup, navigator confirmation added #4023

Merged
merged 4 commits into from
Jul 28, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions cypress/e2e/apps.js
Original file line number Diff line number Diff line change
@@ -7,9 +7,16 @@ import { APP_DETAILS } from "../elements/apps/appDetails";
import { APPS_LIST_SELECTORS } from "../elements/apps/appsList";
import { WEBHOOK_DETAILS } from "../elements/apps/webhookDetails";
import { BUTTON_SELECTORS } from "../elements/shared/button-selectors";
import { appDetailsUrl, urlList } from "../fixtures/urlList";
import {
appDetailsUrl,
urlList,
} from "../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../fixtures/users";
import { createApp, getApp, updateApp } from "../support/api/requests/Apps";
import {
createApp,
getApp,
updateApp,
} from "../support/api/requests/Apps";
import {
addShippingMethod,
createCheckout,
@@ -18,7 +25,9 @@ import {
import { createVoucher } from "../support/api/requests/Discounts/Vouchers";
import { createGiftCard } from "../support/api/requests/GiftCard";
import { getDefaultChannel } from "../support/api/utils/channelsUtils";
import { getShippingMethodIdFromCheckout } from "../support/api/utils/ordersUtils";
import {
getShippingMethodIdFromCheckout,
} from "../support/api/utils/ordersUtils";
import {
createProductInChannel,
createTypeAttributeAndCategoryForProduct,
@@ -41,7 +50,7 @@ describe("As a staff user I want to manage apps", () => {
const email = `example@example.com`;

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();

createApp(name, "MANAGE_APPS").then(app => {
createdApp = app;
@@ -93,7 +102,7 @@ describe("As a staff user I want to manage apps", () => {
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest("auth", ONE_PERMISSION_USERS.app);
cy.loginUserViaRequest("auth", ONE_PERMISSION_USERS.app);
});

it(
21 changes: 15 additions & 6 deletions cypress/e2e/catalog/categories.js
Original file line number Diff line number Diff line change
@@ -3,18 +3,27 @@

import faker from "faker";

import { CATEGORIES_LIST_SELECTORS } from "../../elements/catalog/categories/categories-list";
import { CATEGORY_DETAILS_SELECTORS } from "../../elements/catalog/categories/category-details";
import {
CATEGORIES_LIST_SELECTORS,
} from "../../elements/catalog/categories/categories-list";
import {
CATEGORY_DETAILS_SELECTORS,
} from "../../elements/catalog/categories/category-details";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../elements/shared/sharedElements";
import { categoryDetailsUrl, urlList } from "../../fixtures/urlList";
import {
categoryDetailsUrl,
urlList,
} from "../../fixtures/urlList";
import {
createCategory as createCategoryRequest,
getCategory,
} from "../../support/api/requests/Category";
import * as channelsUtils from "../../support/api/utils/channelsUtils";
import * as productsUtils from "../../support/api/utils/products/productsUtils";
import { ensureCanvasStatic } from "../../support/customCommands/sharedElementsOperations/canvas";
import {
ensureCanvasStatic,
} from "../../support/customCommands/sharedElementsOperations/canvas";
import {
createCategory,
updateCategory,
@@ -32,7 +41,7 @@ describe("As an admin I want to manage categories", () => {
let defaultChannel;

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();

channelsUtils
.getDefaultChannel()
@@ -71,7 +80,7 @@ describe("As an admin I want to manage categories", () => {
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

it(
17 changes: 12 additions & 5 deletions cypress/e2e/catalog/collections.js
Original file line number Diff line number Diff line change
@@ -4,16 +4,23 @@
import faker from "faker";

import { BUTTON_SELECTORS } from "../../elements";
import { collectionDetailsUrl, urlList } from "../../fixtures/urlList";
import {
collectionDetailsUrl,
urlList,
} from "../../fixtures/urlList";
import { createChannel } from "../../support/api/requests/Channels";
import {
addChannelToCollection,
addProductToCollection,
createCollection as createCollectionRequest,
} from "../../support/api/requests/Collections";
import { updateChannelInProduct } from "../../support/api/requests/Product";
import { getCollection } from "../../support/api/requests/storeFront/Collections";
import { getProductDetails } from "../../support/api/requests/storeFront/ProductDetails";
import {
getCollection,
} from "../../support/api/requests/storeFront/Collections";
import {
getProductDetails,
} from "../../support/api/requests/storeFront/ProductDetails";
import { searchInShop } from "../../support/api/requests/storeFront/Search";
import * as channelsUtils from "../../support/api/utils/channelsUtils";
import * as productsUtils from "../../support/api/utils/products/productsUtils";
@@ -35,7 +42,7 @@ describe("As an admin I want to manage collections.", () => {
let defaultChannel;

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();

channelsUtils
.getDefaultChannel()
@@ -76,7 +83,7 @@ describe("As an admin I want to manage collections.", () => {
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

it(
15 changes: 10 additions & 5 deletions cypress/e2e/catalog/giftCards/activateGiftCards.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
/// <reference types="cypress" />
import faker from "faker";

import { GIFT_CARD_LIST } from "../../../elements/catalog/giftCard/giftCardList";
import {
GIFT_CARD_LIST,
} from "../../../elements/catalog/giftCard/giftCardList";
import { urlList } from "../../../fixtures/urlList";
import { completeCheckout } from "../../../support/api/requests/Checkout";
import {
@@ -17,8 +19,11 @@ import {
addPayment,
purchaseProductWithPromoCode,
} from "../../../support/api/utils/ordersUtils";
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
import { updateTaxConfigurationForChannel } from "../../../support/api/utils/taxesUtils";
import * as productsUtils
from "../../../support/api/utils/products/productsUtils";
import {
updateTaxConfigurationForChannel,
} from "../../../support/api/utils/taxesUtils";
import { giftCardsPage } from "../../../support/pages";

describe("As a admin I want to use enabled gift card in checkout", () => {
@@ -38,7 +43,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
before(() => {
const name = `${startsWith}${faker.datatype.number()}`;

cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();

productsUtils
.createProductWithShipping({ name, shippingPrice, productPrice })
@@ -59,7 +64,7 @@ describe("As a admin I want to use enabled gift card in checkout", () => {
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
updateTaxConfigurationForChannel({
channelSlug: defaultChannel.slug,
pricesEnteredWithTax: true,
4 changes: 2 additions & 2 deletions cypress/e2e/catalog/giftCards/createGiftCard.js
Original file line number Diff line number Diff line change
@@ -20,11 +20,11 @@ describe("As an admin I want to create gift card", () => {
const currency = "USD";

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

it(
8 changes: 5 additions & 3 deletions cypress/e2e/catalog/giftCards/exportGiftCards.js
Original file line number Diff line number Diff line change
@@ -10,19 +10,21 @@ import {
activatePlugin,
updatePlugin,
} from "../../../support/api/requests/Plugins";
import { getMailWithGiftCardExportWithAttachment } from "../../../support/api/utils/users";
import {
getMailWithGiftCardExportWithAttachment,
} from "../../../support/api/utils/users";
import { giftCardsPage } from "../../../support/pages";

describe("As an admin I want to export gift card", () => {
const startsWith = "updateGCard";

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
activatePlugin({ id: "mirumee.notifications.admin_email" });
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

it(
11 changes: 7 additions & 4 deletions cypress/e2e/catalog/giftCards/purchaseGiftCard.js
Original file line number Diff line number Diff line change
@@ -2,8 +2,11 @@
import faker from "faker";

import * as channelsUtils from "../../../support/api/utils/channelsUtils";
import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersUtils";
import * as productsUtils from "../../../support/api/utils/products/productsUtils";
import {
createWaitingForCaptureOrder,
} from "../../../support/api/utils/ordersUtils";
import * as productsUtils
from "../../../support/api/utils/products/productsUtils";
import { createShipping } from "../../../support/api/utils/shippingUtils";

describe("As a customer I should be able to purchase gift card as a product", () => {
@@ -25,7 +28,7 @@ describe("As a customer I should be able to purchase gift card as a product", ()
};

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();

const name = `${startsWith}${faker.datatype.number()}`;

@@ -84,7 +87,7 @@ describe("As a customer I should be able to purchase gift card as a product", ()
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

it(
16 changes: 8 additions & 8 deletions cypress/e2e/catalog/giftCards/updatingGiftCards.js
Original file line number Diff line number Diff line change
@@ -3,10 +3,15 @@

import faker from "faker";

import { GIFT_CARD_UPDATE } from "../../../elements/catalog/giftCard/giftCardUpdate";
import {
GIFT_CARD_UPDATE,
} from "../../../elements/catalog/giftCard/giftCardUpdate";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { MESSAGES } from "../../../fixtures";
import { giftCardDetailsUrl, urlList } from "../../../fixtures/urlList";
import {
giftCardDetailsUrl,
urlList,
} from "../../../fixtures/urlList";
import {
createGiftCard,
getGiftCardWithId,
@@ -16,13 +21,8 @@ import { giftCardsPage } from "../../../support/pages";

describe("As an admin I want to update gift card", () => {
const startsWith = "updateGCard";

before(() => {
cy.clearSessionData().loginUserViaRequest();
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

it(
8 changes: 5 additions & 3 deletions cypress/e2e/checkout/clickAndCollect.js
Original file line number Diff line number Diff line change
@@ -3,7 +3,9 @@

import faker from "faker";

import { WAREHOUSES_DETAILS } from "../../elements/warehouses/warehouse-details";
import {
WAREHOUSES_DETAILS,
} from "../../elements/warehouses/warehouse-details";
import {
completeCheckout,
createCheckout,
@@ -39,7 +41,7 @@ describe("Warehouses in checkout", () => {
const warehouseSlug = `${faker.lorem.slug()}slug`;

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
cy.fixture("addresses")
.then(addresses => {
usAddress = addresses.usAddress;
@@ -101,7 +103,7 @@ describe("Warehouses in checkout", () => {
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

it(
2 changes: 1 addition & 1 deletion cypress/e2e/checkout/productWithoutShipping.js
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ describe("Products without shipment option", () => {
let productWithoutShipping;

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();

createChannel({
name,
8 changes: 5 additions & 3 deletions cypress/e2e/checkout/purchaseWithProductTypes.js
Original file line number Diff line number Diff line change
@@ -17,7 +17,9 @@ import {
getShippingMethodIdFromCheckout,
updateShippingInCheckout,
} from "../../support/api/utils/ordersUtils";
import { createDigitalAndPhysicalProductWithNewDataAndDefaultChannel } from "../../support/api/utils/products/productsUtils";
import {
createDigitalAndPhysicalProductWithNewDataAndDefaultChannel,
} from "../../support/api/utils/products/productsUtils";

describe("As an unlogged customer I want to order physical and digital products", () => {
const startsWith = `CyPurchaseByType`;
@@ -33,7 +35,7 @@ describe("As an unlogged customer I want to order physical and digital products"
let physicalVariants;

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
createDigitalAndPhysicalProductWithNewDataAndDefaultChannel({
physicalProductName: physicalName,
digitalProductName: digitalName,
@@ -54,7 +56,7 @@ describe("As an unlogged customer I want to order physical and digital products"
});

beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
});

it(
10 changes: 7 additions & 3 deletions cypress/e2e/checkout/stocksInCheckout.js
Original file line number Diff line number Diff line change
@@ -8,8 +8,12 @@ import {
createCheckout,
} from "../../support/api/requests/Checkout";
import { getVariants } from "../../support/api/requests/Product";
import { createWaitingForCaptureOrder } from "../../support/api/utils/ordersUtils";
import { createNewProductWithSeveralVariants } from "../../support/api/utils/products/productsUtils";
import {
createWaitingForCaptureOrder,
} from "../../support/api/utils/ordersUtils";
import {
createNewProductWithSeveralVariants,
} from "../../support/api/utils/products/productsUtils";

describe("Manage products stocks in checkout", () => {
const startsWith = "CyStocksCheckout-";
@@ -23,7 +27,7 @@ describe("Manage products stocks in checkout", () => {
let lastVariantInStock;

before(() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();

const variantsData = [
{
2 changes: 1 addition & 1 deletion cypress/e2e/checkout/warehouses.js
Original file line number Diff line number Diff line change
@@ -21,7 +21,7 @@ describe("Warehouses in checkout", () => {
"should not be possible to buy product for country not listed in warehouse",
{ tags: ["@checkout", "@allEnv", "@stable", "@oldRelease"] },
() => {
cy.clearSessionData().loginUserViaRequest();
cy.loginUserViaRequest();
const name = `${startsWith}${faker.datatype.number()}`;
cy.fixture("addresses")
.then(addresses => {
Loading