Change way of tagging tests, add stable tag (#2102)

* change tags in tests

* change tags in tests

* add finde-names

* correct critical tag

* fix navigation

* remove comments

* fix config

* fix baseUrl port
This commit is contained in:
Karolina Rakoczy 2022-06-27 11:30:51 +02:00 committed by GitHub
parent 69eeb4c280
commit fd7813692a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
91 changed files with 5134 additions and 4187 deletions

View file

@ -1,73 +0,0 @@
version: 2
jobs:
build-lint-benchmark:
docker:
- image: circleci/node:14.4.0-browsers
steps:
- checkout
- restore_cache:
keys:
- cache-{{ .Branch }}-{{ checksum "package.json" }}
- run:
name: Install system dependencies
command: sudo apt-get install -y libpng-dev
- run:
name: Install dependencies
command: npm install
- save_cache:
key: cache-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- ~/.npm
- ~/.cache
- run:
name: Build application
command: npm run build
- run:
name: Install Lighthouse tools
command: sudo npm install -g @lhci/cli
- run:
name: Lighthouse audit
command: npx lhci autorun --upload.target=temporary-public-storage
cypress:
docker:
- image: cypress/base:10
environment:
TERM: xterm
parallelism: 1
steps:
- checkout
- restore_cache:
keys:
- cache-{{ .Branch }}-{{ checksum "package.json" }}
- run:
name: Npm CI
command: npm ci
- run:
command: npx cypress verify
- save_cache:
key: cache-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- ~/.npm
- ~/.cache
- persist_to_workspace:
root: ~/
paths:
- project
- .cache/Cypress
- attach_workspace:
at: ~/
- run:
name: Running E2E tests
command: npm run test:e2e:run
- store_artifacts:
path: cypress/videos
- store_artifacts:
path: cypress/screenshots
workflows:
version: 2
qa:
jobs:
- build-lint-benchmark:
context: Lighthouse

View file

@ -173,9 +173,7 @@ jobs:
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }} CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
COMMIT_INFO_MESSAGE: Critical tests triggered on PR - ${{ github.ref_name }} COMMIT_INFO_MESSAGE: Critical tests triggered on PR - ${{ github.ref_name }}
CYPRESS_grepTags: '@critical'
with: with:
command: npx cypress run --record --env tags=critical --spec cypress/e2e/navigation.js,cypress/e2e/products/createProduct.js,cypress/e2e/products/productsVariants.js --tag Critical, PR_Deploy record: true
- uses: actions/upload-artifact@v1 tag: Critical, ${{github.event.action}}
with:
name: cypress-videos
path: cypress/videos

View file

@ -3,14 +3,15 @@ name: Execute nightly tests
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
tests: tags:
required: true required: true
description: 'Select tests to run' description: 'Select tests to run'
default: 'All' default: '@allEnv'
type: choice type: choice
options: options:
- 'All' - '@allEnv'
- 'Critical' - '@critical'
- '@stable'
environment: environment:
required: true required: true
description: 'Environment to run tests against' description: 'Environment to run tests against'
@ -87,7 +88,7 @@ jobs:
run-tests-in-parallel: run-tests-in-parallel:
needs: revert-automation-env-to-snap needs: revert-automation-env-to-snap
if: always() #Wait for revert-automation-env-to-snap, bot run always, even if skipped if: ${{ always() && github.event_name != 'repository_dispatch' }} #Wait for revert-automation-env-to-snap, bot run always, even if skipped
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: cypress/browsers:node14.16.0-chrome89-ff86 container: cypress/browsers:node14.16.0-chrome89-ff86
strategy: strategy:
@ -131,33 +132,16 @@ jobs:
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }} CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: All tests triggered via ${{github.event_name}} on ${{ steps.get-env-uri.outputs.ENV_URI }} COMMIT_INFO_MESSAGE: All tests triggered via ${{ github.event_name}} on ${{ steps.get-env-uri.outputs.ENV_URI }}
CYPRESS_grepTags: ${{ github.event.inputs.tags }}
with: with:
parallel: true parallel: true
group: 'UI - Chrome' group: 'UI - Chrome'
command: npx cypress run --record --env tags=all --parallel --tag ${{ steps.get-env-uri.outputs.ENV_URI }}, All_Tests record: true
tag: ${{ steps.get-env-uri.outputs.ENV_URI }},${{ github.event.inputs.tags }}
- name: Cypress run - Critical
if: ${{ github.event.inputs.tests == 'Critical' && github.event_name != 'repository_dispatch'}}
uses: cypress-io/github-action@v4
env:
API_URI: ${{ steps.get-env-uri.outputs.ENV_URI }}graphql/
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
CYPRESS_baseUrl: ${{ steps.get-env-uri.outputs.ENV_URI }}dashboard/
CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }}
CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: Critical tests triggered via ${{github.event_name}} on ${{ steps.get-env-uri.outputs.ENV_URI }}
with:
parallel: true
group: 'UI - Chrome'
command: npx cypress run --record --env tags=critical --spec cypress/e2e/navigation.js,cypress/e2e/products/createProduct.js,cypress/e2e/products/productsVariants.js --parallel --tag ${{ steps.get-env-uri.outputs.ENV_URI }}, Critical
run-tests-on-release: run-tests-on-release:
if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.project != 'PROD' && github.event.client_payload.project != 'ENTERPRISE'}} if: ${{ github.event_name == 'repository_dispatch' && github.event.client_payload.environment != 'PROD' && github.event.client_payload.environment != 'ENTERPRISE'}}
runs-on: ubuntu-latest runs-on: ubuntu-latest
container: cypress/browsers:node14.16.0-chrome89-ff86 container: cypress/browsers:node14.16.0-chrome89-ff86
strategy: strategy:
@ -173,32 +157,14 @@ jobs:
id: version id: version
env: env:
version: ${{github.event.client_payload.version}} version: ${{github.event.client_payload.version}}
pattern: \\.
run: | run: |
echo "::set-output name=version::$(echo $version | sed s/$pattern// | head -n 1 )" echo "::set-output name=formatted_version::$(echo $version | grep -Eo "\d\.\d" | sed s/\\.// | head -n 1 )"
- name: Get formatted version - demo
if: ${{ github.event.client_payload.project == 'DEMO' }}
id: version-demo
env:
version: ${{github.event.client_payload.version}}
pattern: demo-
run: |
echo "::set-output name=version::$(echo $version | sed s/$pattern// | head -n 1 )"
- name: Get domain
id: domain
env:
correct-version: ${{ steps.version-demo.outputs.version-demo || steps.version.outputs.version }}
run: |
echo "::set-output name=version::$(echo https://v${{ steps.version-demo.outputs.version-demo }}.staging.saleor.cloud/ | head -n 1 )"
- name: Cypress run - automatically - name: Cypress run - automatically
uses: cypress-io/github-action@v4 uses: cypress-io/github-action@v4
env: env:
API_URI: ${{ steps.domain.outputs.domain }}graphql/ API_URI: https://v${{ steps.version.outputs.formatted_version }}.staging.saleor.cloud/graphql/
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }} APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
CYPRESS_baseUrl: ${{ steps.domain.outputs.domain }}dashboard/ CYPRESS_baseUrl: https://v${{ steps.version.outputs.formatted_version }}.staging.saleor.cloud/dashboard/
CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }} CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }}
CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }} CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }} CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
@ -206,7 +172,9 @@ jobs:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COMMIT_INFO_MESSAGE: Critical triggered via release - ${{github.event.client_payload.project}} ${{github.event.client_payload.version}}, ${{github.event.client_payload.pullRequestUrl}} COMMIT_INFO_MESSAGE: Critical triggered via release - ${{github.event.client_payload.project}} ${{github.event.client_payload.version}}, ${{github.event.client_payload.pullRequestUrl}}
CYPRESS_grepTags: ${{ github.event.inputs.tags }}
with: with:
parallel: true parallel: true
group: 'UI - Chrome' group: 'UI - Chrome'
command: npx cypress run --record --env tags=critical --spec cypress/e2e/navigation.js,cypress/e2e/products/createProduct.js,cypress/e2e/products/productsVariants.js --parallel --tag ${{github.event.client_payload.environment}}, Critical record: true
tag: ${{github.event.client_payload.project}}, ${{github.event.client_payload.environment}}, Critical, https://v${{ steps.version.outputs.formatted_version }}.staging.saleor.cloud

View file

@ -5,15 +5,18 @@ module.exports = defineConfig({
projectId: "51ef7c", projectId: "51ef7c",
chromeWebSecurity: false, chromeWebSecurity: false,
videoUploadOnPasses: false, videoUploadOnPasses: false,
defaultCommandTimeout: 15000, defaultCommandTimeout: 20000,
requestTimeout: 15000, requestTimeout: 20000,
viewportWidth: 1400, viewportWidth: 1400,
viewportHeight: 660, viewportHeight: 660,
e2e: { e2e: {
// We've imported your old cypress plugins here. env: {
// You may want to clean this up later by importing these. grepFilterSpecs: true
},
setupNodeEvents(on, config) { setupNodeEvents(on, config) {
return require("./cypress/plugins/index.js")(on, config); config = require("./cypress/support/cypress-grep/plugin")(config);
config = require("./cypress/plugins/index.js")(on, 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}"

View file

@ -11,31 +11,29 @@ import { appDetailsUrl, urlList } from "../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../fixtures/users"; import { ONE_PERMISSION_USERS } from "../fixtures/users";
import { createApp, getApp } from "../support/api/requests/Apps"; import { createApp, getApp } from "../support/api/requests/Apps";
import { deleteAppsStartsWith } from "../support/api/utils/appUtils"; import { deleteAppsStartsWith } from "../support/api/utils/appUtils";
import filterTests from "../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Tests for apps", () => {
describe("Tests for apps", () => { const startsWith = "Apps";
const startsWith = "Apps"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`;
let createdApp; let createdApp;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteAppsStartsWith(startsWith); deleteAppsStartsWith(startsWith);
createApp(name, "MANAGE_APPS").then(app => { createApp(name, "MANAGE_APPS").then(app => {
createdApp = app; createdApp = app;
});
}); });
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.clearSessionData().loginUserViaRequest("auth", ONE_PERMISSION_USERS.app);
"auth", });
ONE_PERMISSION_USERS.app
);
});
it("should create app", () => { it(
"should create app. TC: SALEOR_3001",
{ tags: ["@app", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.apps) cy.visit(urlList.apps)
@ -59,9 +57,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should create webhook", () => { it(
"should create webhook. TC: SALEOR_3002",
{ tags: ["@app", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const targetUrl = `http://example.${randomName}`; const targetUrl = `http://example.${randomName}`;
@ -79,9 +81,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should create token", () => { it(
"should create token. TC: SALEOR_3003",
{ tags: ["@app", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
let expectedToken; let expectedToken;
@ -107,6 +113,6 @@ filterTests({ definedTags: ["all"] }, () => {
); );
expect(token.authToken).to.eq(tokenLastFourDigits); expect(token.authToken).to.eq(tokenLastFourDigits);
}); });
}); }
}); );
}); });

View file

@ -19,63 +19,64 @@ import { deleteCategoriesStartsWith } from "../../support/api/utils/catalog/cate
import * as channelsUtils from "../../support/api/utils/channelsUtils"; import * as channelsUtils from "../../support/api/utils/channelsUtils";
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 filterTests from "../../support/filterTests";
import { import {
createCategory, createCategory,
updateCategory updateCategory
} from "../../support/pages/catalog/categoriesPage"; } from "../../support/pages/catalog/categoriesPage";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to manage categories", () => {
describe("As an admin I want to manage categories", () => { const startsWith = "CyCategories";
const startsWith = "CyCategories"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`;
let attribute; let attribute;
let category; let category;
let productType; let productType;
let product; let product;
let defaultChannel; let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
deleteCategoriesStartsWith(startsWith); deleteCategoriesStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
channelsUtils.deleteChannelsStartsWith(startsWith); channelsUtils.deleteChannelsStartsWith(startsWith);
channelsUtils channelsUtils
.getDefaultChannel() .getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
productsUtils.createTypeAttributeAndCategoryForProduct({ name }); productsUtils.createTypeAttributeAndCategoryForProduct({ name });
}) })
.then( .then(
({ ({
category: categoryResp, category: categoryResp,
attribute: attributeResp, attribute: attributeResp,
productType: productTypeResp productType: productTypeResp
}) => { }) => {
category = categoryResp; category = categoryResp;
attribute = attributeResp; attribute = attributeResp;
productType = productTypeResp; productType = productTypeResp;
productsUtils.createProductInChannel({ productsUtils.createProductInChannel({
name, name,
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));
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to create category. TC: SALEOR_0201", () => { it(
"should be able to create category. TC: SALEOR_0201",
{ tags: ["@category", "@allEnv"] },
() => {
const categoryName = `${startsWith}${faker.datatype.number()}`; const categoryName = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.categories) cy.visit(urlList.categories)
@ -91,9 +92,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should be able to create category as subcategory. TC: SALEOR_0202", () => { it(
"should be able to create category as subcategory. TC: SALEOR_0202",
{ tags: ["@category", "@allEnv", "@stable"] },
() => {
const categoryName = `${startsWith}${faker.datatype.number()}`; const categoryName = `${startsWith}${faker.datatype.number()}`;
cy.visit(categoryDetailsUrl(category.id)) cy.visit(categoryDetailsUrl(category.id))
@ -106,9 +111,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should be able to add product to category. TC: SALEOR_0203", () => { it(
"should be able to add product to category. TC: SALEOR_0203",
{ tags: ["@category", "@allEnv", "@stable"] },
() => {
cy.visit(categoryDetailsUrl(category.id)) cy.visit(categoryDetailsUrl(category.id))
.get(CATEGORY_DETAILS.productsTab) .get(CATEGORY_DETAILS.productsTab)
.click() .click()
@ -116,9 +125,13 @@ filterTests({ definedTags: ["all"] }, () => {
.click() .click()
.url() .url()
.should("include", urlList.addProduct); .should("include", urlList.addProduct);
}); }
);
it("should be able to remove product from category. TC: SALEOR_0204", () => { it(
"should be able to remove product from category. TC: SALEOR_0204",
{ tags: ["@category", "@allEnv"] },
() => {
cy.visit(categoryDetailsUrl(category.id)) cy.visit(categoryDetailsUrl(category.id))
.get(CATEGORY_DETAILS.productsTab) .get(CATEGORY_DETAILS.productsTab)
.click(); .click();
@ -137,17 +150,25 @@ filterTests({ definedTags: ["all"] }, () => {
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("should be able to enter category details page. TC: SALEOR_0205", () => { it(
"should be able to enter category details page. TC: SALEOR_0205",
{ tags: ["@category", "@allEnv"] },
() => {
cy.visit(urlList.categories) cy.visit(urlList.categories)
.get(SHARED_ELEMENTS.searchInput) .get(SHARED_ELEMENTS.searchInput)
.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("should be able to delete category. TC: SALEOR_0206", () => { it(
"should be able to delete category. TC: SALEOR_0206",
{ tags: ["@category", "@allEnv", "@stable"] },
() => {
const categoryName = `${startsWith}${faker.datatype.number()}`; const categoryName = `${startsWith}${faker.datatype.number()}`;
createCategoryRequest({ createCategoryRequest({
@ -162,9 +183,13 @@ filterTests({ definedTags: ["all"] }, () => {
.waitForRequestAndCheckIfNoErrors("@CategoryDelete"); .waitForRequestAndCheckIfNoErrors("@CategoryDelete");
getCategory(categoryResp.id).should("be.null"); getCategory(categoryResp.id).should("be.null");
}); });
}); }
);
it("should be able to update category. TC: SALEOR_0207", () => { it(
"should be able to update category. TC: SALEOR_0207",
{ tags: ["@category", "@allEnv", "@stable"] },
() => {
const categoryName = `${startsWith}${faker.datatype.number()}`; const categoryName = `${startsWith}${faker.datatype.number()}`;
const updatedName = `${startsWith}updatedCategory`; const updatedName = `${startsWith}updatedCategory`;
@ -184,9 +209,13 @@ 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);
}); });
}); }
);
it("should be able to delete several categories on categories list page. TC: SALEOR_0209", () => { it(
"should be able to delete several categories on categories list page. TC: SALEOR_0209",
{ tags: ["@category", "@allEnv"] },
() => {
const firstCategoryName = `${startsWith}${faker.datatype.number()}`; const firstCategoryName = `${startsWith}${faker.datatype.number()}`;
const secondCategoryName = `${startsWith}${faker.datatype.number()}`; const secondCategoryName = `${startsWith}${faker.datatype.number()}`;
let firstCategory; let firstCategory;
@ -219,9 +248,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should be able to remove subcategory from category. TC: SALEOR_0208", () => { it(
"should be able to remove subcategory from category. TC: SALEOR_0208",
{ tags: ["@category", "@allEnv", "@stable"] },
() => {
const subCategoryName = `${startsWith}${faker.datatype.number()}`; const subCategoryName = `${startsWith}${faker.datatype.number()}`;
const mainCategoryName = `${startsWith}${faker.datatype.number()}`; const mainCategoryName = `${startsWith}${faker.datatype.number()}`;
let subCategory; let subCategory;
@ -255,6 +288,6 @@ filterTests({ definedTags: ["all"] }, () => {
.then(categoryResp => { .then(categoryResp => {
expect(categoryResp.children.edges).to.be.empty; expect(categoryResp.children.edges).to.be.empty;
}); });
}); }
}); );
}); });

View file

@ -82,282 +82,318 @@ filterTests({ definedTags: ["all"] }, () => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
xit("should create hidden collection. TC: SALEOR_0301", () => { xit(
const collectionName = `${startsWith}${faker.datatype.number()}`; "should create hidden collection. TC: SALEOR_0301",
let collection; { tags: ["@collection", "@allEnv"] },
() => {
const collectionName = `${startsWith}${faker.datatype.number()}`;
let collection;
cy.visit(urlList.collections); cy.visit(urlList.collections);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
createCollection(collectionName, false, defaultChannel) createCollection(collectionName, false, defaultChannel)
.then(collectionResp => { .then(collectionResp => {
collection = collectionResp; collection = collectionResp;
assignProductsToCollection(name); assignProductsToCollection(name);
})
.then(() => {
getCollection({
collectionId: collection.id,
channelSlug: defaultChannel.slug
});
})
.then(({ collection: resp }) => {
const isVisible = isCollectionVisible(resp, collection.id);
expect(isVisible).to.equal(false);
});
});
it("should create published collection. TC: SALEOR_0302", () => {
const collectionName = `${startsWith}${faker.datatype.number()}`;
let collection;
cy.visit(urlList.collections);
cy.softExpectSkeletonIsVisible();
createCollection(collectionName, true, defaultChannel)
.then(collectionResp => {
collection = collectionResp;
assignProductsToCollection(name);
getCollection({
collectionId: collection.id,
channelSlug: defaultChannel.slug
});
})
.then(({ collection: resp }) => {
const isVisible = isCollectionVisible(resp, collection.id);
expect(isVisible).to.equal(true);
});
});
it("create collection not available for channel. TC: SALEOR_0303", () => {
const collectionName = `${startsWith}${faker.datatype.number()}`;
let collection;
let channel;
createChannel({ name: collectionName })
.then(channelResp => {
channel = channelResp;
updateChannelInProduct(product.id, channel.id);
})
.then(() => {
cy.visit(urlList.collections);
cy.softExpectSkeletonIsVisible();
createCollection(collectionName, true, channel);
})
.then(collectionResp => {
collection = collectionResp;
assignProductsToCollection(name);
getCollection({
collectionId: collection.id,
channelSlug: defaultChannel.slug
});
})
.then(({ collection: resp }) => {
const isVisible = isCollectionVisible(resp, collection.id);
expect(isVisible).to.equal(false);
});
});
it("create published collection with products hidden in listings. TC: SALEOR_0304", () => {
// Products "hidden in listings" are not displayed in Category listings or search results,
// but are listed on Collections
const collectionName = `${startsWith}${faker.datatype.number()}`;
let collection;
let createdProduct;
productsUtils
.createProductInChannel({
name: collectionName,
channelId: defaultChannel.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
visibleInListings: false
})
.then(({ product: productResp }) => (createdProduct = productResp));
cy.visit(urlList.collections);
cy.softExpectSkeletonIsVisible();
createCollection(collectionName, true, defaultChannel)
.then(collectionResp => {
collection = collectionResp;
assignProductsToCollection(collectionName);
})
.then(() => {
getCollection({
collectionId: collection.id,
channelSlug: defaultChannel.slug
});
})
.then(({ collection: resp }) => {
const isVisible = isProductInCollectionVisible(
resp,
createdProduct.id
);
expect(isVisible).to.equal(true);
})
.then(() => {
searchInShop(createdProduct.name);
})
.then(resp => {
const isVisible = isProductVisibleInSearchResult(
resp,
createdProduct.name
);
expect(isVisible).to.equal(false);
});
});
it("should delete collection. TC: SALEOR_0305", () => {
const collectionName = `${startsWith}${faker.datatype.number()}`;
createCollectionRequest(collectionName).then(collectionResp => {
cy.visit(collectionDetailsUrl(collectionResp.id))
.get(BUTTON_SELECTORS.deleteButton)
.click()
.addAliasToGraphRequest("RemoveCollection")
.get(BUTTON_SELECTORS.submit)
.click()
.waitForRequestAndCheckIfNoErrors("@RemoveCollection");
getCollection({ collectionId: collectionResp.id, auth: "auth" })
.its("collection")
.should("be.null");
});
});
it("delete several collections on collections list page. TC: SALEOR_0309", () => {
const deleteSeveral = "delete-several-";
const firstCollectionName = `${deleteSeveral}${startsWith}${faker.datatype.number()}`;
const secondCollectionName = `${deleteSeveral}${startsWith}${faker.datatype.number()}`;
let firstCollection;
let secondCollection;
createCollectionRequest(firstCollectionName).then(collectionResp => {
firstCollection = collectionResp;
});
createCollectionRequest(secondCollectionName).then(collectionResp => {
secondCollection = collectionResp;
cy.visit(urlList.collections)
.searchInTable(deleteSeveral)
.get(collectionRow(firstCollection.id))
.find(BUTTON_SELECTORS.checkbox)
.click()
.get(collectionRow(secondCollection.id))
.find(BUTTON_SELECTORS.checkbox)
.click()
.get(BUTTON_SELECTORS.deleteIcon)
.click()
.addAliasToGraphRequest("CollectionBulkDelete")
.get(BUTTON_SELECTORS.submit)
.click()
.waitForRequestAndCheckIfNoErrors("@CollectionBulkDelete");
getCollection({ collectionId: firstCollection.id, auth: "auth" })
.its("collection")
.should("be.null");
getCollection({ collectionId: secondCollection.id, auth: "auth" })
.its("collection")
.should("be.null");
});
});
xit("should assign product to collection. TC: SALEOR_0307", () => {
const collectionName = `Assign-${startsWith}${faker.datatype.number()}`;
const productName = `Product-To-Assign-${startsWith}${faker.datatype.number()}`;
let collection;
let productToAssign;
createCollectionRequest(collectionName).then(collectionResp => {
collection = collectionResp;
productsUtils
.createProductInChannel({
name: productName,
channelId: defaultChannel.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
visibleInListings: false
}) })
.then(({ product: productResp }) => { .then(() => {
productToAssign = productResp; getCollection({
cy.visit(collectionDetailsUrl(collection.id));
assignProductsToCollection(productToAssign.name);
getCollection({ collectionId: collection.id, auth: "auth" })
.its("collection.products.edges")
.should("have.length", 1)
.then(productArray => {
expect(productArray[0].node.id).to.equal(productToAssign.id);
});
});
});
});
it("remove product from collection. TC: SALEOR_0308", () => {
const collectionName = `Remove-With-Assigned-Product-${startsWith}${faker.datatype.number()}`;
const productName = `Product-To-Assign-${startsWith}${faker.datatype.number()}`;
let collection;
let productToAssign;
createCollectionRequest(collectionName).then(collectionResp => {
collection = collectionResp;
productsUtils
.createProductInChannel({
name: productName,
channelId: defaultChannel.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
visibleInListings: false
})
.then(({ product: productResp }) => {
productToAssign = productResp;
addProductToCollection({
collectionId: collection.id, collectionId: collection.id,
productId: productToAssign.id channelSlug: defaultChannel.slug
}); });
})
cy.visit(collectionDetailsUrl(collection.id)); .then(({ collection: resp }) => {
const isVisible = isCollectionVisible(resp, collection.id);
getProductDetails(productToAssign.id, defaultChannel.slug, "auth") expect(isVisible).to.equal(false);
.its("body.data.product.collections")
.should("have.length", 1);
getCollection({ collectionId: collection.id, auth: "auth" })
.its("collection.products.edges")
.should("have.length", 1);
removeProductsFromCollection(productToAssign.name);
getCollection({ collectionId: collection.id, auth: "auth" })
.its("collection.products.edges")
.should("be.empty");
}); });
}); }
}); );
it("should update collection. TC: SALEOR_0306", () => { it(
const collectionName = `${startsWith}${faker.datatype.number()}`; "should create published collection. TC: SALEOR_0302",
const updatedName = `${startsWith}updatedCollection`; { tags: ["@collection", "@allEnv", "@stable"] },
() => {
const collectionName = `${startsWith}${faker.datatype.number()}`;
let collection;
createCollectionRequest(collectionName) cy.visit(urlList.collections);
.then(collectionResp => { cy.expectSkeletonIsVisible();
cy.visitAndWaitForProgressBarToDisappear(
collectionDetailsUrl(collectionResp.id) createCollection(collectionName, true, defaultChannel)
); .then(collectionResp => {
updateCollection({ name: updatedName, description: updatedName }); collection = collectionResp;
getCollection({ collectionId: collectionResp.id, auth: "auth" }); assignProductsToCollection(name);
}) getCollection({
.then(({ collection: collectionResp }) => { collectionId: collection.id,
expect(collectionResp.name).to.eq(updatedName); channelSlug: defaultChannel.slug
const descriptionJson = JSON.parse(collectionResp.description); });
const descriptionText = descriptionJson.blocks[0].data.text; })
expect(descriptionText).to.eq(updatedName); .then(({ collection: resp }) => {
const isVisible = isCollectionVisible(resp, collection.id);
expect(isVisible).to.equal(true);
});
}
);
it(
"create collection not available for channel. TC: SALEOR_0303",
{ tags: ["@collection", "@allEnv", "@stable"] },
() => {
const collectionName = `${startsWith}${faker.datatype.number()}`;
let collection;
let channel;
createChannel({ name: collectionName })
.then(channelResp => {
channel = channelResp;
updateChannelInProduct(product.id, channel.id);
})
.then(() => {
cy.visit(urlList.collections);
cy.expectSkeletonIsVisible();
createCollection(collectionName, true, channel);
})
.then(collectionResp => {
collection = collectionResp;
assignProductsToCollection(name);
getCollection({
collectionId: collection.id,
channelSlug: defaultChannel.slug
});
})
.then(({ collection: resp }) => {
const isVisible = isCollectionVisible(resp, collection.id);
expect(isVisible).to.equal(false);
});
}
);
it(
"create published collection with products hidden in listings. TC: SALEOR_0304",
{ tags: ["@collection", "@allEnv", "@stable"] },
() => {
// Products "hidden in listings" are not displayed in Category listings or search results,
// but are listed on Collections
const collectionName = `${startsWith}${faker.datatype.number()}`;
let collection;
let createdProduct;
productsUtils
.createProductInChannel({
name: collectionName,
channelId: defaultChannel.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
visibleInListings: false
})
.then(({ product: productResp }) => (createdProduct = productResp));
cy.visit(urlList.collections);
cy.expectSkeletonIsVisible();
createCollection(collectionName, true, defaultChannel)
.then(collectionResp => {
collection = collectionResp;
assignProductsToCollection(collectionName);
})
.then(() => {
getCollection({
collectionId: collection.id,
channelSlug: defaultChannel.slug
});
})
.then(({ collection: resp }) => {
const isVisible = isProductInCollectionVisible(
resp,
createdProduct.id
);
expect(isVisible).to.equal(true);
})
.then(() => {
searchInShop(createdProduct.name);
})
.then(resp => {
const isVisible = isProductVisibleInSearchResult(
resp,
createdProduct.name
);
expect(isVisible).to.equal(false);
});
}
);
it(
"should delete collection. TC: SALEOR_0305",
{ tags: ["@collection", "@allEnv", "@stable"] },
() => {
const collectionName = `${startsWith}${faker.datatype.number()}`;
createCollectionRequest(collectionName).then(collectionResp => {
cy.visit(collectionDetailsUrl(collectionResp.id))
.get(BUTTON_SELECTORS.deleteButton)
.click()
.addAliasToGraphRequest("RemoveCollection")
.get(BUTTON_SELECTORS.submit)
.click()
.waitForRequestAndCheckIfNoErrors("@RemoveCollection");
getCollection({ collectionId: collectionResp.id, auth: "auth" })
.its("collection")
.should("be.null");
}); });
}); }
);
it(
"delete several collections on collections list page. TC: SALEOR_0309",
{ tags: ["@collection", "@allEnv"] },
() => {
const deleteSeveral = "delete-several-";
const firstCollectionName = `${deleteSeveral}${startsWith}${faker.datatype.number()}`;
const secondCollectionName = `${deleteSeveral}${startsWith}${faker.datatype.number()}`;
let firstCollection;
let secondCollection;
createCollectionRequest(firstCollectionName).then(collectionResp => {
firstCollection = collectionResp;
});
createCollectionRequest(secondCollectionName).then(collectionResp => {
secondCollection = collectionResp;
cy.visit(urlList.collections)
.searchInTable(deleteSeveral)
.get(collectionRow(firstCollection.id))
.find(BUTTON_SELECTORS.checkbox)
.click()
.get(collectionRow(secondCollection.id))
.find(BUTTON_SELECTORS.checkbox)
.click()
.get(BUTTON_SELECTORS.deleteIcon)
.click()
.addAliasToGraphRequest("CollectionBulkDelete")
.get(BUTTON_SELECTORS.submit)
.click()
.waitForRequestAndCheckIfNoErrors("@CollectionBulkDelete");
getCollection({ collectionId: firstCollection.id, auth: "auth" })
.its("collection")
.should("be.null");
getCollection({ collectionId: secondCollection.id, auth: "auth" })
.its("collection")
.should("be.null");
});
}
);
xit(
"should assign product to collection. TC: SALEOR_0307",
{ tags: ["@collection", "@allEnv"] },
() => {
const collectionName = `Assign-${startsWith}${faker.datatype.number()}`;
const productName = `Product-To-Assign-${startsWith}${faker.datatype.number()}`;
let collection;
let productToAssign;
createCollectionRequest(collectionName).then(collectionResp => {
collection = collectionResp;
productsUtils
.createProductInChannel({
name: productName,
channelId: defaultChannel.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
visibleInListings: false
})
.then(({ product: productResp }) => {
productToAssign = productResp;
cy.visit(collectionDetailsUrl(collection.id));
assignProductsToCollection(productToAssign.name);
getCollection({ collectionId: collection.id, auth: "auth" })
.its("collection.products.edges")
.should("have.length", 1)
.then(productArray => {
expect(productArray[0].node.id).to.equal(productToAssign.id);
});
});
});
}
);
it(
"remove product from collection. TC: SALEOR_0308",
{ tags: ["@collection", "@allEnv"] },
() => {
const collectionName = `Remove-With-Assigned-Product-${startsWith}${faker.datatype.number()}`;
const productName = `Product-To-Assign-${startsWith}${faker.datatype.number()}`;
let collection;
let productToAssign;
createCollectionRequest(collectionName).then(collectionResp => {
collection = collectionResp;
productsUtils
.createProductInChannel({
name: productName,
channelId: defaultChannel.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
visibleInListings: false
})
.then(({ product: productResp }) => {
productToAssign = productResp;
addProductToCollection({
collectionId: collection.id,
productId: productToAssign.id
});
cy.visit(collectionDetailsUrl(collection.id));
getProductDetails(productToAssign.id, defaultChannel.slug, "auth")
.its("body.data.product.collections")
.should("have.length", 1);
getCollection({ collectionId: collection.id, auth: "auth" })
.its("collection.products.edges")
.should("have.length", 1);
removeProductsFromCollection(productToAssign.name);
getCollection({ collectionId: collection.id, auth: "auth" })
.its("collection.products.edges")
.should("be.empty");
});
});
}
);
it(
"should update collection. TC: SALEOR_0306",
{ tags: ["@collection", "@allEnv"] },
() => {
const collectionName = `${startsWith}${faker.datatype.number()}`;
const updatedName = `${startsWith}updatedCollection`;
createCollectionRequest(collectionName)
.then(collectionResp => {
cy.visitAndWaitForProgressBarToDisappear(
collectionDetailsUrl(collectionResp.id)
);
updateCollection({ name: updatedName, description: updatedName });
getCollection({ collectionId: collectionResp.id, auth: "auth" });
})
.then(({ collection: collectionResp }) => {
expect(collectionResp.name).to.eq(updatedName);
const descriptionJson = JSON.parse(collectionResp.description);
const descriptionText = descriptionJson.blocks[0].data.text;
expect(descriptionText).to.eq(updatedName);
});
}
);
}); });
}); });

View file

@ -20,59 +20,60 @@ import {
} 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 filterTests from "../../../support/filterTests";
import { import {
changeGiftCardActiveStatus, changeGiftCardActiveStatus,
enterAndSelectGiftCards enterAndSelectGiftCards
} from "../../../support/pages/catalog/giftCardPage"; } from "../../../support/pages/catalog/giftCardPage";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { 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", () => { const startsWith = "GiftCardsCheckout";
const startsWith = "GiftCardsCheckout"; const productPrice = 50;
const productPrice = 50; const shippingPrice = 50;
const shippingPrice = 50; 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;
let address; let address;
let dataForCheckout; let dataForCheckout;
before(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
channelsUtils.deleteChannelsStartsWith(startsWith); channelsUtils.deleteChannelsStartsWith(startsWith);
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteGiftCardsWithTagStartsWith(startsWith); deleteGiftCardsWithTagStartsWith(startsWith);
productsUtils productsUtils
.createProductWithShipping({ name, shippingPrice, productPrice }) .createProductWithShipping({ name, shippingPrice, productPrice })
.then(resp => { .then(resp => {
defaultChannel = resp.defaultChannel; defaultChannel = resp.defaultChannel;
address = resp.address; address = resp.address;
dataForCheckout = { dataForCheckout = {
address, address,
email, email,
auth: "token", auth: "token",
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
shippingMethodName: resp.shippingMethod.name, shippingMethodName: resp.shippingMethod.name,
variantsList: resp.variantsList variantsList: resp.variantsList
}; };
}); });
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to enable gift card and use it in checkout. TC: SALEOR_1006", () => { it(
"should be able to enable gift card and use it in checkout. TC: SALEOR_1006",
{ tags: ["@giftCard", "@allEnv"] },
() => {
const expectedGiftCardBalance = const expectedGiftCardBalance =
giftCardData.amount - productPrice - shippingPrice; giftCardData.amount - productPrice - shippingPrice;
@ -102,9 +103,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
.then(dataAsExpected => { .then(dataAsExpected => {
expect(dataAsExpected).to.be.true; expect(dataAsExpected).to.be.true;
}); });
}); }
);
it("should not be able to disable gift card and use it in checkout. TC: SALEOR_1007", () => { it(
"should not be able to disable gift card and use it in checkout. TC: SALEOR_1007",
{ tags: ["@giftCard", "@allEnv", "@stable"] },
() => {
giftCardData.tag = `${startsWith}${faker.datatype.number()}`; giftCardData.tag = `${startsWith}${faker.datatype.number()}`;
let giftCard; let giftCard;
@ -128,9 +133,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
.then(dataAsExpected => { .then(dataAsExpected => {
expect(dataAsExpected).to.be.true; expect(dataAsExpected).to.be.true;
}); });
}); }
);
it("should not be able to disable several gift cards on gift card list page and use it in checkout. TC: SALEOR_1013", () => { it(
"should not be able to disable several gift cards on gift card list page and use it in checkout. TC: SALEOR_1013",
{ tags: ["@giftCard", "@allEnv", "@stable"] },
() => {
const firstGiftCardName = `${startsWith}${faker.datatype.number()}`; const firstGiftCardName = `${startsWith}${faker.datatype.number()}`;
const secondGiftCardName = `${startsWith}${faker.datatype.number()}`; const secondGiftCardName = `${startsWith}${faker.datatype.number()}`;
const amount = 10; const amount = 10;
@ -178,9 +187,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
expectedAmount: amount expectedAmount: amount
}).then(dataAsExpected => expect(dataAsExpected).to.be.true); }).then(dataAsExpected => expect(dataAsExpected).to.be.true);
}); });
}); }
);
xit("should be able to enable several gift cards on gift card list page and use it in checkout. TC: SALEOR_1012", () => { xit(
"should be able to enable several gift cards on gift card list page and use it in checkout. TC: SALEOR_1012",
{ tags: ["@giftCard", "@allEnv"] },
() => {
const firstGiftCardName = `${startsWith}${faker.datatype.number()}`; const firstGiftCardName = `${startsWith}${faker.datatype.number()}`;
const secondGiftCardName = `${startsWith}${faker.datatype.number()}`; const secondGiftCardName = `${startsWith}${faker.datatype.number()}`;
const amount = 10; const amount = 10;
@ -228,6 +241,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
expectedOrderPrice expectedOrderPrice
}).then(isDataAsExpected => expect(isDataAsExpected).to.be.true); }).then(isDataAsExpected => expect(isDataAsExpected).to.be.true);
}); });
}); }
}); );
}); });

View file

@ -6,7 +6,6 @@ import faker from "faker";
import { getGiftCardsWithCode } from "../../../support/api/requests/GiftCard"; import { getGiftCardsWithCode } from "../../../support/api/requests/GiftCard";
import { deleteGiftCardsWithTagStartsWith } from "../../../support/api/utils/catalog/giftCardUtils"; import { deleteGiftCardsWithTagStartsWith } from "../../../support/api/utils/catalog/giftCardUtils";
import { addToDate } from "../../../support/api/utils/misc"; import { addToDate } from "../../../support/api/utils/misc";
import filterTests from "../../../support/filterTests";
import { formatDate } from "../../../support/formatData/formatDate"; import { formatDate } from "../../../support/formatData/formatDate";
import { import {
expiryPeriods, expiryPeriods,
@ -16,22 +15,24 @@ import {
setExpiryPeriod setExpiryPeriod
} from "../../../support/pages/catalog/giftCardPage"; } from "../../../support/pages/catalog/giftCardPage";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { describe("As an admin I want to create gift card", () => {
describe("As an admin I want to create gift card", () => { const startsWith = "GiftCards";
const startsWith = "GiftCards"; const amount = 50;
const amount = 50; const currency = "USD";
const currency = "USD";
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteGiftCardsWithTagStartsWith(startsWith); deleteGiftCardsWithTagStartsWith(startsWith);
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to create never expire gift card. TC: SALEOR_1001", () => { it(
"should be able to create never expire gift card. TC: SALEOR_1001",
{ tags: ["@giftCard", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let giftCard; let giftCard;
@ -51,9 +52,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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("should be able to create gift card with two moths expiry. TC: SALEOR_1002", () => { it(
"should be able to create gift card with two moths expiry. TC: SALEOR_1002",
{ tags: ["@giftCard", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let giftCard; let giftCard;
const expectedExpiryDate = addToDate(new Date(), 2, "M"); const expectedExpiryDate = addToDate(new Date(), 2, "M");
@ -76,9 +81,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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("should be able to create gift card with date expiry. TC: SALEOR_1003", () => { it(
"should be able to create gift card with date expiry. TC: SALEOR_1003",
{ tags: ["@giftCard", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const date = formatDate(new Date(new Date().getFullYear() + 2, 1, 1)); const date = formatDate(new Date(new Date().getFullYear() + 2, 1, 1));
let giftCard; let giftCard;
@ -101,6 +110,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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);
}); });
}); }
}); );
}); });

View file

@ -9,88 +9,87 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../../support/api/utils/shippingUtils"; } from "../../../support/api/utils/shippingUtils";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { 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", () => { const startsWith = "GiftCardsCheckout";
const startsWith = "GiftCardsCheckout"; const productPrice = 50;
const productPrice = 50; const shippingPrice = 50;
const shippingPrice = 50; const email = "example@example.com";
const email = "example@example.com";
let defaultChannel; let defaultChannel;
let productType; let productType;
let attribute; let attribute;
let category; let category;
let shippingMethod; let shippingMethod;
let variants; let variants;
let address; let address;
const giftCardData = { const giftCardData = {
amount: 150, amount: 150,
currency: "USD" currency: "USD"
}; };
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
channelsUtils.deleteChannelsStartsWith(startsWith); channelsUtils.deleteChannelsStartsWith(startsWith);
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteGiftCardsWithTagStartsWith(startsWith); deleteGiftCardsWithTagStartsWith(startsWith);
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name, kind: "GIFT_CARD" }) .createTypeAttributeAndCategoryForProduct({ name, kind: "GIFT_CARD" })
.then( .then(
({ ({
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;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addresses => { .then(addresses => {
address = addresses.plAddress; address = addresses.plAddress;
createShipping({ createShipping({
channelId: defaultChannel.id, channelId: defaultChannel.id,
name, name,
address, address,
price: shippingPrice price: shippingPrice
});
})
.then(
({ shippingMethod: shippingMethodResp, warehouse: warehouse }) => {
shippingMethod = shippingMethodResp;
productsUtils.createProductInChannel({
name,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
price: productPrice
});
}
)
.then(({ variantsList: variantsResp }) => {
variants = variantsResp;
}); });
}); })
.then(({ shippingMethod: shippingMethodResp, warehouse: warehouse }) => {
shippingMethod = shippingMethodResp;
productsUtils.createProductInChannel({
name,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
price: productPrice
});
})
.then(({ variantsList: variantsResp }) => {
variants = variantsResp;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to purchase gift card as a product. TC: SALEOR_1008", () => { it(
"should be able to purchase gift card as a product. TC: SALEOR_1008",
{ tags: ["@giftCard", "@allEnv", "@stable"] },
() => {
giftCardData.tag = `${startsWith}${faker.datatype.number()}`; giftCardData.tag = `${startsWith}${faker.datatype.number()}`;
createWaitingForCaptureOrder({ createWaitingForCaptureOrder({
@ -102,6 +101,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
}).then(({ order }) => { }).then(({ order }) => {
expect(order.id).to.be.ok; expect(order.id).to.be.ok;
}); });
}); }
}); );
}); });

View file

@ -11,23 +11,24 @@ import {
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 filterTests from "../../../support/filterTests";
import { formatDate } from "../../../support/formatData/formatDate"; import { formatDate } from "../../../support/formatData/formatDate";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { describe("As an admin I want to update gift card", () => {
describe("As an admin I want to update gift card", () => { const startsWith = "GiftCards";
const startsWith = "GiftCards";
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteGiftCardsWithTagStartsWith(startsWith); deleteGiftCardsWithTagStartsWith(startsWith);
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to delete gift card. TC: SALEOR_1004", () => { it(
"should be able to delete gift card. TC: SALEOR_1004",
{ tags: ["@giftCard", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
createGiftCard({ createGiftCard({
@ -46,9 +47,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
.waitForRequestAndCheckIfNoErrors("@DeleteGiftCard"); .waitForRequestAndCheckIfNoErrors("@DeleteGiftCard");
getGiftCardWithId(giftCard.id).should("be.null"); getGiftCardWithId(giftCard.id).should("be.null");
}); });
}); }
);
it("should be able to update gift card. TC: SALEOR_1005", () => { it(
"should be able to update gift card. TC: SALEOR_1005",
{ tags: ["@giftCard", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const updatedName = `${startsWith}${faker.datatype.number()}`; const updatedName = `${startsWith}${faker.datatype.number()}`;
const date = formatDate(new Date(new Date().getFullYear() + 2, 1, 1)); const date = formatDate(new Date(new Date().getFullYear() + 2, 1, 1));
@ -85,6 +90,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
); );
expect(giftCard.expiryDate).to.eq(date); expect(giftCard.expiryDate).to.eq(date);
}); });
}); }
}); );
}); });

View file

@ -22,7 +22,6 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../support/api/utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
import { import {
createWarehouse, createWarehouse,
pickupOptions, pickupOptions,
@ -30,68 +29,70 @@ import {
visitSetPublicStockAndEnablePickup visitSetPublicStockAndEnablePickup
} from "../../support/pages/warehousePage"; } from "../../support/pages/warehousePage";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { describe("Warehouses in checkout", () => {
describe("Warehouses in checkout", () => { const startsWith = `CyWarehouseCheckout`;
const startsWith = `CyWarehouseCheckout`; let defaultChannel;
let defaultChannel; let usAddress;
let usAddress; let secondUsAddress;
let secondUsAddress; let plAddress;
let plAddress; let productData;
let productData; let checkoutData;
let checkoutData; let variantsInOtherWarehouse;
let variantsInOtherWarehouse;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
cy.fixture("addresses") cy.fixture("addresses")
.then(addresses => { .then(addresses => {
usAddress = addresses.usAddress; usAddress = addresses.usAddress;
secondUsAddress = addresses.secondUsAddress; secondUsAddress = addresses.secondUsAddress;
plAddress = addresses.plAddress; plAddress = addresses.plAddress;
getDefaultChannel(); getDefaultChannel();
}) })
.then(channelResp => { .then(channelResp => {
defaultChannel = channelResp; defaultChannel = channelResp;
createTypeAttributeAndCategoryForProduct({ name: startsWith }); createTypeAttributeAndCategoryForProduct({ name: startsWith });
}) })
.then(({ attribute, productType, category }) => { .then(({ attribute, productType, category }) => {
productData = { productData = {
attributeId: attribute.id, attributeId: attribute.id,
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 }) => {
productData.name = startsWith;
productData.warehouseId = warehouseResp.id;
updateWarehouse({ id: productData.warehouseId, isPrivate: false });
createProductInChannel(productData);
})
.then(({ variantsList }) => {
variantsInOtherWarehouse = variantsList;
}); });
}); })
.then(({ warehouse: warehouseResp }) => {
productData.name = startsWith;
productData.warehouseId = warehouseResp.id;
updateWarehouse({ id: productData.warehouseId, isPrivate: false });
createProductInChannel(productData);
})
.then(({ variantsList }) => {
variantsInOtherWarehouse = variantsList;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
xit("should create warehouse with all warehouses pickup and private stock", () => { xit(
"should create warehouse with all warehouses pickup and private stock",
{ tags: ["@checkout", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let warehouse; let warehouse;
@ -122,9 +123,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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("should create warehouse with all warehouses pickup and public stock", () => { xit(
"should create warehouse with all warehouses pickup and public stock",
{ tags: ["@checkout", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let warehouse; let warehouse;
@ -155,9 +160,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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("should create warehouse with local stock only pickup and public stock", () => { xit(
"should create warehouse with local stock only pickup and public stock",
{ tags: ["@checkout", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let warehouse; let warehouse;
let variantsInLocalStock; let variantsInLocalStock;
@ -196,17 +205,25 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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("should not be possible to set local pickup when private stock", () => { xit(
"should not be possible to set local pickup when private stock",
{ tags: ["@checkout", "@allEnv"] },
() => {
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("should create order with warehouse address", () => { it(
"should create order with warehouse address",
{ tags: ["@checkout", "@allEnv"] },
() => {
let checkout; let checkout;
checkoutData.variantsList = variantsInOtherWarehouse; checkoutData.variantsList = variantsInOtherWarehouse;
createCheckout(checkoutData) createCheckout(checkoutData)
@ -228,6 +245,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
cy.expectCorrectBasicAddress(order.shippingAddress, secondUsAddress); cy.expectCorrectBasicAddress(order.shippingAddress, secondUsAddress);
cy.expectCorrectBasicAddress(order.billingAddress, usAddress); cy.expectCorrectBasicAddress(order.billingAddress, usAddress);
}); });
}); }
}); );
}); });

View file

@ -19,83 +19,81 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../support/api/utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Products without shipment option", () => {
describe("Products without shipment option", () => { const startsWith = "WithoutShipmentCheckout-";
const startsWith = "WithoutShipmentCheckout-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; const nameProdWithoutShipping = `${startsWith}${faker.datatype.number()}`;
const nameProdWithoutShipping = `${startsWith}${faker.datatype.number()}`;
let channel; let channel;
let address; let address;
let warehouse; let warehouse;
let shippingMethod; let shippingMethod;
let productWithShipping; let productWithShipping;
let productWithoutShipping; let productWithoutShipping;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteChannelsStartsWith(startsWith); deleteChannelsStartsWith(startsWith);
createChannel({ createChannel({
name name
})
.then(channelResp => {
channel = channelResp;
cy.fixture("addresses");
}) })
.then(channelResp => { .then(({ usAddress }) => {
channel = channelResp; address = usAddress;
cy.fixture("addresses"); createShipping({
}) channelId: channel.id,
.then(({ usAddress }) => { name,
address = usAddress; address,
createShipping({ minProductPrice: 100
});
})
.then(
({ warehouse: warehouseResp, shippingMethod: shippingMethodResp }) => {
warehouse = warehouseResp;
shippingMethod = shippingMethodResp;
createTypeAttributeAndCategoryForProduct({ name });
}
)
.then(
({
attribute: attributeResp,
productType: productTypeResp,
category: categoryResp
}) => {
createProductInChannel({
attributeId: attributeResp.id,
categoryId: categoryResp.id,
channelId: channel.id, channelId: channel.id,
name, name,
address, productTypeId: productTypeResp.id,
minProductPrice: 100 warehouseId: warehouse.id
}); }).then(({ variantsList }) => (productWithShipping = variantsList));
}) createProductInChannel({
.then( attributeId: attributeResp.id,
({ categoryId: categoryResp.id,
warehouse: warehouseResp, channelId: channel.id,
shippingMethod: shippingMethodResp name: nameProdWithoutShipping,
}) => { productTypeId: productTypeResp.id,
warehouse = warehouseResp; warehouseId: warehouse.id
shippingMethod = shippingMethodResp; }).then(
createTypeAttributeAndCategoryForProduct({ name }); ({ variantsList }) => (productWithoutShipping = variantsList)
} );
) }
.then( );
({ });
attribute: attributeResp,
productType: productTypeResp,
category: categoryResp
}) => {
createProductInChannel({
attributeId: attributeResp.id,
categoryId: categoryResp.id,
channelId: channel.id,
name,
productTypeId: productTypeResp.id,
warehouseId: warehouse.id
}).then(({ variantsList }) => (productWithShipping = variantsList));
createProductInChannel({
attributeId: attributeResp.id,
categoryId: categoryResp.id,
channelId: channel.id,
name: nameProdWithoutShipping,
productTypeId: productTypeResp.id,
warehouseId: warehouse.id
}).then(
({ variantsList }) => (productWithoutShipping = variantsList)
);
}
);
});
it("should be not possible to buy product without shipping option", () => { it(
"should be not possible to buy product without shipping option",
{ tags: ["@checkout", "@allEnv", "@stable"] },
() => {
createCheckout({ createCheckout({
channelSlug: channel.slug, channelSlug: channel.slug,
email: "example@example.com", email: "example@example.com",
@ -122,6 +120,6 @@ filterTests({ definedTags: ["all"] }, () => {
"shippingMethodId" "shippingMethodId"
); );
}); });
}); }
}); );
}); });

View file

@ -18,38 +18,38 @@ import {
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";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all", "refactored"] }, () => { describe("As an unlogged customer I want to order physical and digital products", () => {
describe("As an unlogged customer I want to order physical and digital products", () => { const startsWith = `CyPurchaseByType`;
const startsWith = `CyPurchaseByType`; const email = `${startsWith}@example.com`;
const email = `${startsWith}@example.com`; const testsMessage = "Check order status";
const testsMessage = "Check order status"; const digitalName = `${startsWith}${faker.datatype.number()}`;
const digitalName = `${startsWith}${faker.datatype.number()}`; const physicalName = `${startsWith}${faker.datatype.number()}`;
const physicalName = `${startsWith}${faker.datatype.number()}`;
const { softExpect } = chai;
let defaultChannel; let defaultChannel;
let address; let address;
let shippingMethod; let shippingMethod;
let digitalVariants; let digitalVariants;
let physicalVariants; let physicalVariants;
before(() => { before(() => {
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;
shippingMethod = resp.shippingMethod; shippingMethod = resp.shippingMethod;
digitalVariants = resp.digitalVariants; digitalVariants = resp.digitalVariants;
physicalVariants = resp.physicalVariants; physicalVariants = resp.physicalVariants;
});
}); });
});
it("should purchase digital product as unlogged customer. TC: SALEOR_0402", () => { it(
"should purchase digital product as unlogged customer. TC: SALEOR_0402",
{ tags: ["@checkout", "@allEnv", "@stable"] },
() => {
createAndCompleteCheckoutWithoutShipping({ createAndCompleteCheckoutWithoutShipping({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
email, email,
@ -61,15 +61,19 @@ filterTests({ definedTags: ["all", "refactored"] }, () => {
getOrder(order.id); getOrder(order.id);
}) })
.then(order => { .then(order => {
softExpect( 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("should purchase physical product as unlogged customer. TC: SALEOR_0403", () => { it(
"should purchase physical product as unlogged customer. TC: SALEOR_0403",
{ tags: ["@checkout", "@allEnv", "@stable"] },
() => {
createWaitingForCaptureOrder({ createWaitingForCaptureOrder({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
email, email,
@ -81,15 +85,19 @@ filterTests({ definedTags: ["all", "refactored"] }, () => {
getOrder(order.id); getOrder(order.id);
}) })
.then(order => { .then(order => {
softExpect( 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("should purchase multiple products with all product types as unlogged customer. TC: SALEOR_0404", () => { it(
"should purchase multiple products with all product types as unlogged customer. TC: SALEOR_0404",
{ tags: ["@checkout", "@allEnv"] },
() => {
let checkout; let checkout;
createCheckout({ createCheckout({
@ -137,12 +145,12 @@ filterTests({ definedTags: ["all", "refactored"] }, () => {
getOrder(order.id); getOrder(order.id);
}) })
.then(order => { .then(order => {
softExpect( 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");
}); });
}); }
}); );
}); });

View file

@ -10,58 +10,59 @@ import {
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";
import { createNewProductWithSeveralVariants } from "../../support/api/utils/products/productsUtils"; import { createNewProductWithSeveralVariants } from "../../support/api/utils/products/productsUtils";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all", "refactored"] }, () => { describe("Manage products stocks in checkout", () => {
describe("Manage products stocks in checkout", () => { const startsWith = "CyStocksCheckout-";
const startsWith = "CyStocksCheckout-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`;
let defaultChannel; let defaultChannel;
let address; let address;
let shippingMethod; let shippingMethod;
let variantsWithLowStock; let variantsWithLowStock;
let variantsWithoutTrackInventory; let variantsWithoutTrackInventory;
let lastVariantInStock; let lastVariantInStock;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
const variantsData = [ const variantsData = [
{ {
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 => {
defaultChannel = resp.defaultChannel; defaultChannel = resp.defaultChannel;
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"
); );
});
}); });
});
it("should not be possible to add product with quantity greater than stock to checkout. TC: SALEOR_0405", () => { it(
"should not be possible to add product with quantity greater than stock to checkout. TC: SALEOR_0405",
{ tags: ["@checkout", "@allEnv", "@stable"] },
() => {
createCheckout({ createCheckout({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
address, address,
@ -79,9 +80,13 @@ filterTests({ definedTags: ["all", "refactored"] }, () => {
"should return error on field quantity" "should return error on field quantity"
).to.have.property("field", "quantity"); ).to.have.property("field", "quantity");
}); });
}); }
);
it("should buy product with no quantity if tracking is not set. TC: SALEOR_0406", () => { it(
"should buy product with no quantity if tracking is not set. TC: SALEOR_0406",
{ tags: ["@checkout", "@allEnv", "@stable"] },
() => {
createWaitingForCaptureOrder({ createWaitingForCaptureOrder({
address, address,
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
@ -91,9 +96,13 @@ filterTests({ definedTags: ["all", "refactored"] }, () => {
}).then(({ order }) => { }).then(({ order }) => {
expect(order, "order should be created").to.be.ok; expect(order, "order should be created").to.be.ok;
}); });
}); }
);
it("should create checkout with last product in stock. TC: SALEOR_0419", () => { it(
"should create checkout with last product in stock. TC: SALEOR_0419",
{ tags: ["@checkout", "@allEnv", "@stable"] },
() => {
createWaitingForCaptureOrder({ createWaitingForCaptureOrder({
address, address,
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
@ -110,6 +119,6 @@ filterTests({ definedTags: ["all", "refactored"] }, () => {
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);
}); });
}); }
}); );
}); });

View file

@ -14,17 +14,18 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../support/api/utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Warehouses in checkout", () => {
describe("Warehouses in checkout", () => { const startsWith = `CyWarehouseCheckout`;
const startsWith = `CyWarehouseCheckout`; let defaultChannel;
let defaultChannel; let usAddress;
let usAddress; let plAddress;
let plAddress; let warehouse;
let warehouse;
it("should not be possible to buy product for country not listed in warehouse", () => { it(
"should not be possible to buy product for country not listed in warehouse",
{ tags: ["@checkout", "@allEnv", "@stable"] },
() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
@ -69,6 +70,6 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ errors }) => { .then(({ errors }) => {
expect(errors[0]).to.have.property("field", "quantity"); expect(errors[0]).to.have.property("field", "quantity");
}); });
}); }
}); );
}); });

View file

@ -12,39 +12,40 @@ import {
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 filterTests from "../../../support/filterTests";
import { fillUpVariantDetails } from "../../../support/pages/catalog/products/VariantsPage"; import { fillUpVariantDetails } from "../../../support/pages/catalog/products/VariantsPage";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { describe("As an admin I want to use attributes in variant selection", () => {
describe("As an admin I want to use attributes in variant selection", () => { const startsWith = "VarSel";
const startsWith = "VarSel";
const attributesTypes = [ const attributesTypes = [
{ key: "DROPDOWN", TC: "SALEOR_0534" }, { key: "DROPDOWN", TC: "SALEOR_0534" },
{ 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;
let product; let product;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
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)
); );
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
attributesTypes.forEach(attributeType => { attributesTypes.forEach(attributeType => {
it(`should create variant with ${attributeType.key} attribute. TC: ${attributeType.TC}`, () => { it(
`should create variant with ${attributeType.key} attribute. TC: ${attributeType.TC}`,
{ tags: ["@attribute", "@allEnv"] },
() => {
const name = `${startsWith}${ const name = `${startsWith}${
attributeType.key attributeType.key
}${faker.datatype.number()}`; }${faker.datatype.number()}`;
@ -91,7 +92,7 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
expect(attributes[0].attribute.inputType).to.eq(inputType); expect(attributes[0].attribute.inputType).to.eq(inputType);
cy.confirmationMessageShouldAppear(); cy.confirmationMessageShouldAppear();
}); });
}); }
}); );
}); });
}); });

View file

@ -6,64 +6,62 @@ import faker from "faker";
import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details"; import { ATTRIBUTES_DETAILS } from "../../../elements/attribute/attributes_details";
import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list"; import { ATTRIBUTES_LIST } from "../../../elements/attribute/attributes_list";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { import { getAttribute } from "../../../support/api/requests/Attribute";
createAttribute,
getAttribute
} 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 filterTests from "../../../support/filterTests";
import { createAttributeWithInputType } from "../../../support/pages/attributesPage"; import { createAttributeWithInputType } from "../../../support/pages/attributesPage";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to create content attribute", () => {
describe("As an admin I want to create content attribute", () => { const startsWith = "AttrCont";
const startsWith = "AttrCont"; const attributesTypes = [
const attributesTypes = [ { type: "DROPDOWN", testCase: "SALEOR_0512" },
{ type: "DROPDOWN", testCase: "SALEOR_0512" }, { type: "MULTISELECT", testCase: "SALEOR_0513" },
{ type: "MULTISELECT", testCase: "SALEOR_0513" }, { type: "FILE", testCase: "SALEOR_0514" },
{ type: "FILE", testCase: "SALEOR_0514" }, { 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(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteAttributesStartsWith(startsWith); deleteAttributesStartsWith(startsWith);
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.attributes) .visit(urlList.attributes)
.get(ATTRIBUTES_LIST.createAttributeButton) .get(ATTRIBUTES_LIST.createAttributeButton)
.click() .click()
.get(ATTRIBUTES_DETAILS.pageTypeAttributeCheckbox) .get(ATTRIBUTES_DETAILS.pageTypeAttributeCheckbox)
.click(); .click();
}); });
attributesTypes.forEach(attributeType => { attributesTypes.forEach(attributeType => {
it(`should be able to create ${attributeType.type} attribute. TC:${attributeType.testCase}`, () => { it(
`should be able to create ${attributeType.type} attribute. TC:${attributeType.testCase}`,
{ tags: ["@attribute", "@allEnv"] },
() => {
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
createAttributeWithInputType({ createAttributeWithInputType({
name: attributeName, name: attributeName,
@ -78,11 +76,15 @@ filterTests({ definedTags: ["all"] }, () => {
attributeType: attributeType.type attributeType: attributeType.type
}); });
}); });
}); }
}); );
});
attributeReferenceType.forEach(entityType => { attributeReferenceType.forEach(entityType => {
it(`should be able to create reference to ${entityType.type} attribute. TC:${entityType.testCase}`, () => { it(
`should be able to create reference to ${entityType.type} attribute. TC:${entityType.testCase}`,
{ tags: ["@attribute", "@allEnv"] },
() => {
const attributeType = "REFERENCE"; const attributeType = "REFERENCE";
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
createAttributeWithInputType({ createAttributeWithInputType({
@ -100,11 +102,15 @@ filterTests({ definedTags: ["all"] }, () => {
entityType: entityType.type entityType: entityType.type
}); });
}); });
}); }
}); );
});
attributeNumericType.forEach(numericSystemType => { attributeNumericType.forEach(numericSystemType => {
it(`should be able to create numeric ${numericSystemType.unitSystem} attribute. TC: ${numericSystemType.testCase}`, () => { it(
`should be able to create numeric ${numericSystemType.unitSystem} attribute. TC: ${numericSystemType.testCase}`,
{ tags: ["@attribute", "@allEnv"] },
() => {
const attributeType = "NUMERIC"; const attributeType = "NUMERIC";
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
createAttributeWithInputType({ createAttributeWithInputType({
@ -122,10 +128,14 @@ filterTests({ definedTags: ["all"] }, () => {
unit: numericSystemType.unit unit: numericSystemType.unit
}); });
}); });
}); }
}); );
});
it("should be able to create attribute without require value TC:SALEOR_0522", () => { it(
"should be able to create attribute without require value TC:SALEOR_0522",
{ tags: ["@attribute", "@allEnv"] },
() => {
const attributeType = "BOOLEAN"; const attributeType = "BOOLEAN";
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
createAttributeWithInputType({ createAttributeWithInputType({
@ -143,6 +153,6 @@ filterTests({ definedTags: ["all"] }, () => {
valueRequired: false valueRequired: false
}); });
}); });
}); }
}); );
}); });

View file

@ -13,59 +13,60 @@ import {
} 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 filterTests from "../../../support/filterTests";
import { import {
createAttributeWithInputType, createAttributeWithInputType,
fillUpAttributeNameAndCode fillUpAttributeNameAndCode
} from "../../../support/pages/attributesPage"; } from "../../../support/pages/attributesPage";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to create product attribute", () => {
describe("As an admin I want to create product attribute", () => { const startsWith = "AttrCreate";
const startsWith = "AttrCreate"; const attributesTypes = [
const attributesTypes = [ { type: "DROPDOWN", testCase: "SALEOR_0501" },
{ type: "DROPDOWN", testCase: "SALEOR_0501" }, { type: "MULTISELECT", testCase: "SALEOR_0502" },
{ type: "MULTISELECT", testCase: "SALEOR_0502" }, { type: "FILE", testCase: "SALEOR_0503" },
{ type: "FILE", testCase: "SALEOR_0503" }, { 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(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteAttributesStartsWith(startsWith); deleteAttributesStartsWith(startsWith);
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.attributes) .visit(urlList.attributes)
.get(ATTRIBUTES_LIST.createAttributeButton) .get(ATTRIBUTES_LIST.createAttributeButton)
.click(); .click();
}); });
attributesTypes.forEach(attributeType => { attributesTypes.forEach(attributeType => {
it(`should be able to create ${attributeType.type} attribute. TC:${attributeType.testCase}`, () => { it(
`should be able to create ${attributeType.type} attribute. TC:${attributeType.testCase}`,
{ tags: ["@attribute", "@allEnv"] },
() => {
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
createAttributeWithInputType({ createAttributeWithInputType({
@ -81,11 +82,15 @@ filterTests({ definedTags: ["all"] }, () => {
attributeType: attributeType.type attributeType: attributeType.type
}); });
}); });
}); }
}); );
});
attributeReferenceType.forEach(entityType => { attributeReferenceType.forEach(entityType => {
it(`should be able to create ${entityType.type} attribute. TC:${entityType.testCase}`, () => { it(
`should be able to create ${entityType.type} attribute. TC:${entityType.testCase}`,
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
const attributeType = "REFERENCE"; const attributeType = "REFERENCE";
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
@ -104,11 +109,15 @@ filterTests({ definedTags: ["all"] }, () => {
entityType: entityType.type entityType: entityType.type
}); });
}); });
}); }
}); );
});
attributeNumericType.forEach(numericSystemType => { attributeNumericType.forEach(numericSystemType => {
it(`should be able to create numeric ${numericSystemType.unitSystem} attribute. TC:${numericSystemType.testCase}`, () => { it(
`should be able to create numeric ${numericSystemType.unitSystem} attribute. TC:${numericSystemType.testCase}`,
{ tags: ["@attribute", "@allEnv"] },
() => {
const attributeType = "NUMERIC"; const attributeType = "NUMERIC";
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
@ -127,10 +136,14 @@ filterTests({ definedTags: ["all"] }, () => {
unit: numericSystemType.unit unit: numericSystemType.unit
}); });
}); });
}); }
}); );
});
it("should be able to create attribute without require value. TC:SALEOR_0511", () => { it(
"should be able to create attribute without require value. TC:SALEOR_0511",
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
const attributeType = "BOOLEAN"; const attributeType = "BOOLEAN";
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
@ -149,9 +162,13 @@ filterTests({ definedTags: ["all"] }, () => {
valueRequired: false valueRequired: false
}); });
}); });
}); }
);
it("should create swatch attribute. TC:SALEOR_0531", () => { it(
"should create swatch attribute. TC:SALEOR_0531",
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
const attributeType = "SWATCH"; const attributeType = "SWATCH";
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
createAttributeWithInputType({ createAttributeWithInputType({
@ -168,9 +185,13 @@ filterTests({ definedTags: ["all"] }, () => {
valueRequired: true valueRequired: true
}); });
}); });
}); }
);
it("should create swatch attribute with image. TC:SALEOR_0532", () => { it(
"should create swatch attribute with image. TC:SALEOR_0532",
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
const attributeType = "SWATCH"; const attributeType = "SWATCH";
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
const swatchImage = "images/saleorDemoProductSneakers.png"; const swatchImage = "images/saleorDemoProductSneakers.png";
@ -192,9 +213,13 @@ filterTests({ definedTags: ["all"] }, () => {
.invoke("attr", "style") .invoke("attr", "style")
.should("include", "saleorDemoProductSneakers"); .should("include", "saleorDemoProductSneakers");
}); });
}); }
);
it("should be able delete product attribute. TC:SALEOR_0525", () => { it(
"should be able delete product attribute. TC:SALEOR_0525",
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
createAttribute({ createAttribute({
@ -209,9 +234,13 @@ filterTests({ definedTags: ["all"] }, () => {
.waitForRequestAndCheckIfNoErrors("@AttributeDelete"); .waitForRequestAndCheckIfNoErrors("@AttributeDelete");
getAttribute(attribute.id).should("be.null"); getAttribute(attribute.id).should("be.null");
}); });
}); }
);
it("should be able update product attribute. TC:SALEOR_0526", () => { it(
"should be able update product attribute. TC:SALEOR_0526",
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
const attributeName = `${startsWith}${faker.datatype.number()}`; const attributeName = `${startsWith}${faker.datatype.number()}`;
const attributeUpdatedName = `${startsWith}${faker.datatype.number()}`; const attributeUpdatedName = `${startsWith}${faker.datatype.number()}`;
@ -231,6 +260,6 @@ filterTests({ definedTags: ["all"] }, () => {
expect(attribute.name).to.eq(attributeUpdatedName); expect(attribute.name).to.eq(attributeUpdatedName);
expect(attribute.slug).to.eq(attributeUpdatedName); expect(attribute.slug).to.eq(attributeUpdatedName);
}); });
}); }
}); );
}); });

View file

@ -10,30 +10,31 @@ import {
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 filterTests from "../../../support/filterTests";
import { fillUpAttributeNameAndCode } from "../../../support/pages/attributesPage"; import { fillUpAttributeNameAndCode } from "../../../support/pages/attributesPage";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to delete and update content attribute", () => {
describe("As an admin I want to delete and update content attribute", () => { const startsWith = "AttrContDel";
const startsWith = "AttrContDel"; let attribute;
let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteAttributesStartsWith(startsWith); deleteAttributesStartsWith(startsWith);
});
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
createAttribute({
name: `${startsWith}${faker.datatype.number()}`,
type: "PAGE_TYPE"
}).then(attributeResp => {
attribute = attributeResp;
}); });
});
beforeEach(() => { it(
cy.clearSessionData().loginUserViaRequest(); "should be able delete content attribute. TC:SALEOR_0529",
createAttribute({ { tags: ["@attribute", "@allEnv", "@stable"] },
name: `${startsWith}${faker.datatype.number()}`, () => {
type: "PAGE_TYPE"
}).then(attributeResp => {
attribute = attributeResp;
});
});
it("should be able delete content attribute. TC:SALEOR_0529", () => {
cy.visit(attributeDetailsUrl(attribute.id)) cy.visit(attributeDetailsUrl(attribute.id))
.get(BUTTON_SELECTORS.deleteButton) .get(BUTTON_SELECTORS.deleteButton)
.click() .click()
@ -42,9 +43,13 @@ filterTests({ definedTags: ["all"] }, () => {
.click() .click()
.waitForRequestAndCheckIfNoErrors("@AttributeDelete"); .waitForRequestAndCheckIfNoErrors("@AttributeDelete");
getAttribute(attribute.id).should("be.null"); getAttribute(attribute.id).should("be.null");
}); }
);
it("should be able update content attribute. TC:SALEOR_0530", () => { it(
"should be able update content attribute. TC:SALEOR_0530",
{ tags: ["@attribute", "@allEnv", "@stable"] },
() => {
const attributeUpdatedName = `${startsWith}${faker.datatype.number()}`; const attributeUpdatedName = `${startsWith}${faker.datatype.number()}`;
cy.visit(attributeDetailsUrl(attribute.id)); cy.visit(attributeDetailsUrl(attribute.id));
@ -57,6 +62,6 @@ filterTests({ definedTags: ["all"] }, () => {
expect(attributeResp.name).to.eq(attributeUpdatedName); expect(attributeResp.name).to.eq(attributeUpdatedName);
expect(attributeResp.slug).to.eq(attributeUpdatedName); expect(attributeResp.slug).to.eq(attributeUpdatedName);
}); });
}); }
}); );
}); });

View file

@ -19,35 +19,37 @@ import {
showFilters showFilters
} from "../../../support/pages/catalog/products/productsListPage"; } from "../../../support/pages/catalog/products/productsListPage";
filterTests({ definedTags: ["all"] }, () => { xdescribe("Tests for using attributes in filters", () => {
xdescribe("Tests for using attributes in filters", () => { const startsWith = "AttrFilter";
const startsWith = "AttrFilter";
let attribute; let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
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({
attributeId: attribute.id, attributeId: attribute.id,
attributeValue: startsWith, attributeValue: startsWith,
categoryId: category.id, categoryId: category.id,
productTypeId: productType.id, productTypeId: productType.id,
name: startsWith name: startsWith
});
}); });
}); });
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should use attribute as filter", () => { it(
"should use attribute as filter",
{ tags: ["@attribute", "@allEnv"] },
() => {
updateAttribute({ updateAttribute({
attributeId: attribute.id, attributeId: attribute.id,
filterableInDashboard: false filterableInDashboard: false
@ -58,9 +60,13 @@ filterTests({ definedTags: ["all"] }, () => {
cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should( cy.contains(SHARED_ELEMENTS.tableRow, attribute.name).should(
"be.visible" "be.visible"
); );
}); }
);
it("should remove attribute from filters", () => { it(
"should remove attribute from filters",
{ tags: ["@attribute", "@allEnv"] },
() => {
updateAttribute({ updateAttribute({
attributeId: attribute.id, attributeId: attribute.id,
filterableInDashboard: true filterableInDashboard: true
@ -69,6 +75,6 @@ filterTests({ definedTags: ["all"] }, () => {
enterProductListPage(); enterProductListPage();
showFilters(); showFilters();
cy.get(getElementByDataTestId(attribute.name)).should("not.exist"); cy.get(getElementByDataTestId(attribute.name)).should("not.exist");
}); }
}); );
}); });

View file

@ -18,38 +18,38 @@ import {
} 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";
import filterTests from "../../../support/filterTests";
import { createChannelByView } from "../../../support/pages/channelsPage"; import { createChannelByView } from "../../../support/pages/channelsPage";
filterTests({ definedTags: ["all"] }, () => { 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;
const defaultCountry = "Poland";
let shippingZone;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteChannelsStartsWith(channelStartsWith); deleteChannelsStartsWith(channelStartsWith);
deleteShippingStartsWith(channelStartsWith); deleteShippingStartsWith(channelStartsWith);
createShippingZone(randomName, "US").then(shippingZoneResp => { createShippingZone(randomName, "US").then(shippingZoneResp => {
shippingZone = shippingZoneResp; shippingZone = shippingZoneResp;
});
}); });
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.clearSessionData().loginUserViaRequest(
"auth", "auth",
ONE_PERMISSION_USERS.channel ONE_PERMISSION_USERS.channel
); );
}); });
it("should create new channel", () => { it(
"should create new channel. TC: SALEOR_0701",
{ tags: ["@channel", "@allEnv", "@stable"] },
() => {
const randomChannel = `${channelStartsWith} ${faker.datatype.number()}`; const randomChannel = `${channelStartsWith} ${faker.datatype.number()}`;
cy.addAliasToGraphRequest("Channels"); cy.addAliasToGraphRequest("Channels");
cy.visit(urlList.channels); cy.visit(urlList.channels);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
cy.waitForRequestAndCheckIfNoErrors("@Channels"); cy.waitForRequestAndCheckIfNoErrors("@Channels");
createChannelByView({ name: randomChannel, currency }); createChannelByView({ name: randomChannel, currency });
cy.waitForRequestAndCheckIfNoErrors("@Channel"); cy.waitForRequestAndCheckIfNoErrors("@Channel");
@ -83,16 +83,20 @@ filterTests({ definedTags: ["all"] }, () => {
.click() .click()
.get(SELECT_CHANNELS_TO_ASSIGN.listOfChannels) .get(SELECT_CHANNELS_TO_ASSIGN.listOfChannels)
.contains(randomChannel); .contains(randomChannel);
}); }
);
it("should create channel with shippingZone", () => { it(
"should create channel with shippingZone. TC: SALEOR_0702",
{ tags: ["@channel", "@allEnv"] },
() => {
// remove login after fixing SALEOR-3162 // remove login after fixing SALEOR-3162
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
const randomChannel = `${channelStartsWith} ${faker.datatype.number()}`; const randomChannel = `${channelStartsWith} ${faker.datatype.number()}`;
cy.addAliasToGraphRequest("Channels"); cy.addAliasToGraphRequest("Channels");
cy.visit(urlList.channels); cy.visit(urlList.channels);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
cy.wait("@Channels"); cy.wait("@Channels");
createChannelByView({ createChannelByView({
name: randomChannel, name: randomChannel,
@ -106,9 +110,13 @@ filterTests({ definedTags: ["all"] }, () => {
); );
expect(assignedChannel).to.be.ok; expect(assignedChannel).to.be.ok;
}); });
}); }
);
it("should validate slug name", () => { it(
"should validate slug name. TC: SALEOR_0703",
{ tags: ["@channel", "@allEnv", "@stable"] },
() => {
const randomChannel = `${channelStartsWith} ${faker.datatype.number()}`; const randomChannel = `${channelStartsWith} ${faker.datatype.number()}`;
createChannel({ createChannel({
isActive: false, isActive: false,
@ -117,17 +125,21 @@ filterTests({ definedTags: ["all"] }, () => {
currencyCode: currency currencyCode: currency
}); });
cy.visit(urlList.channels); cy.visit(urlList.channels);
cy.softExpectSkeletonIsVisible(); 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("should validate duplicated currency", () => { it(
"should validate not existing currency. TC: SALEOR_0704",
{ tags: ["@channel", "@allEnv", "@stable"] },
() => {
const randomChannel = `${channelStartsWith} ${faker.datatype.number()}`; const randomChannel = `${channelStartsWith} ${faker.datatype.number()}`;
cy.visit(urlList.channels); cy.visit(urlList.channels);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
createChannelByView({ createChannelByView({
name: randomChannel, name: randomChannel,
currency: "notExistingCurrency" currency: "notExistingCurrency"
@ -135,9 +147,13 @@ filterTests({ definedTags: ["all"] }, () => {
cy.get(ADD_CHANNEL_FORM_SELECTORS.currencyValidationMessage).should( cy.get(ADD_CHANNEL_FORM_SELECTORS.currencyValidationMessage).should(
"be.visible" "be.visible"
); );
}); }
);
it("should delete channel", () => { it(
"should delete channel. TC: SALEOR_0705",
{ tags: ["@channel", "@allEnv", "@stable"] },
() => {
const randomChannelToDelete = `${channelStartsWith} ${faker.datatype.number()}`; const randomChannelToDelete = `${channelStartsWith} ${faker.datatype.number()}`;
createChannel({ createChannel({
isActive: false, isActive: false,
@ -147,7 +163,7 @@ filterTests({ definedTags: ["all"] }, () => {
}); });
cy.addAliasToGraphRequest("Channels"); cy.addAliasToGraphRequest("Channels");
cy.visit(urlList.channels); cy.visit(urlList.channels);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
cy.wait("@Channels"); cy.wait("@Channels");
cy.contains(CHANNELS_SELECTORS.channelName, randomChannelToDelete) cy.contains(CHANNELS_SELECTORS.channelName, randomChannelToDelete)
.parentsUntil(CHANNELS_SELECTORS.channelsTable) .parentsUntil(CHANNELS_SELECTORS.channelsTable)
@ -160,6 +176,6 @@ filterTests({ definedTags: ["all"] }, () => {
cy.get(CHANNELS_SELECTORS.channelName) cy.get(CHANNELS_SELECTORS.channelName)
.contains(randomChannelToDelete) .contains(randomChannelToDelete)
.should("not.exist"); .should("not.exist");
}); }
}); );
}); });

View file

@ -23,41 +23,42 @@ import {
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";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Tests on inactive channel", () => {
describe("Tests on inactive channel", () => { const channelStartsWith = `InactiveChannel`;
const channelStartsWith = `InactiveChannel`; const randomName = `${channelStartsWith}${faker.datatype.number()}`;
const randomName = `${channelStartsWith}${faker.datatype.number()}`; const currency = "PLN";
const currency = "PLN";
let address; let address;
let defaultChannel; let defaultChannel;
let newChannel; let newChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteChannelsStartsWith(channelStartsWith); deleteChannelsStartsWith(channelStartsWith);
deleteProductsStartsWith(channelStartsWith); deleteProductsStartsWith(channelStartsWith);
cy.fixture("addresses").then(({ plAddress }) => { cy.fixture("addresses").then(({ plAddress }) => {
address = plAddress; address = plAddress;
});
getDefaultChannel().then(channel => (defaultChannel = channel));
createChannel({
isActive: false,
name: randomName,
slug: randomName,
currencyCode: currency
}).then(channel => {
newChannel = channel;
});
}); });
getDefaultChannel().then(channel => (defaultChannel = channel));
beforeEach(() => { createChannel({
cy.clearSessionData().loginUserViaRequest(); isActive: false,
name: randomName,
slug: randomName,
currencyCode: currency
}).then(channel => {
newChannel = channel;
}); });
});
it("should not be possible to add products to order with inactive channel", () => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
});
it(
"should not be possible to add products to order with inactive channel. TC: SALEOR_0706",
{ tags: ["@channel", "@allEnv"] },
() => {
cy.visit(urlList.orders) cy.visit(urlList.orders)
.get(ORDERS_SELECTORS.createOrder) .get(ORDERS_SELECTORS.createOrder)
.click() .click()
@ -75,9 +76,13 @@ filterTests({ definedTags: ["all"] }, () => {
}) })
.get(DRAFT_ORDER_SELECTORS.addProducts) .get(DRAFT_ORDER_SELECTORS.addProducts)
.should("not.exist"); .should("not.exist");
}); }
);
it("should not be possible to create checkout with inactive channel", () => { it(
"should not be possible to create checkout with inactive channel. TC: SALEOR_0707",
{ tags: ["@channel", "@allEnv", "@stable"] },
() => {
const randomChannel = `${channelStartsWith}${faker.datatype.number()}`; const randomChannel = `${channelStartsWith}${faker.datatype.number()}`;
createTypeAttributeAndCategoryForProduct({ name: randomChannel }) createTypeAttributeAndCategoryForProduct({ name: randomChannel })
.then(({ productType, attribute, category }) => { .then(({ productType, attribute, category }) => {
@ -103,9 +108,13 @@ filterTests({ definedTags: ["all"] }, () => {
"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("products in inactive channel should not be displayed", () => { it(
"products in inactive channel should not be displayed. TC: SALEOR_0708",
{ tags: ["@channel", "@allEnv", "@stable"] },
() => {
const randomChannel = `${channelStartsWith}${faker.datatype.number()}`; const randomChannel = `${channelStartsWith}${faker.datatype.number()}`;
let channel; let channel;
let product; let product;
@ -151,6 +160,6 @@ filterTests({ definedTags: ["all"] }, () => {
"product with active channel should be visible" "product with active channel should be visible"
).to.be.eq(true); ).to.be.eq(true);
}); });
}); }
}); );
}); });

View file

@ -8,35 +8,35 @@ import { CUSTOMERS_LIST } from "../../elements/customer/customers-list";
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";
import { customerDetailsUrl, urlList } from "../../fixtures/urlList"; import { customerDetailsUrl, urlList } from "../../fixtures/urlList";
import { ONE_PERMISSION_USERS } from "../../fixtures/users";
import { import {
addressCreate, addressCreate,
createCustomer, createCustomer,
deleteCustomersStartsWith, deleteCustomersStartsWith,
getCustomer getCustomer
} from "../../support/api/requests/Customer"; } from "../../support/api/requests/Customer";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Tests for customer", () => {
describe("Tests for customer", () => { const startsWith = `Customers`;
const startsWith = `Customers`; let address;
let address; let secondAddress;
let secondAddress;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteCustomersStartsWith(startsWith); deleteCustomersStartsWith(startsWith);
cy.fixture("addresses").then(({ usAddress, secondUsAddress }) => { cy.fixture("addresses").then(({ usAddress, secondUsAddress }) => {
address = usAddress; address = usAddress;
secondAddress = secondUsAddress; secondAddress = secondUsAddress;
});
}); });
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should create customer", () => { it(
"should create customer. TC: SALEOR_1201",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const email = `${randomName}@example.com`; const email = `${randomName}@example.com`;
const note = faker.lorem.paragraph(); const note = faker.lorem.paragraph();
@ -65,19 +65,23 @@ filterTests({ definedTags: ["all"] }, () => {
getCustomer(customer.id); getCustomer(customer.id);
}) })
.then(customer => { .then(customer => {
chai expect(customer.firstName, "Expect correct first name").to.eq(
.softExpect(customer.firstName, "Expect correct first name") randomName
.to.eq(randomName); );
chai expect(customer.lastName, "Expect correct last name").to.eq(
.softExpect(customer.lastName, "Expect correct last name") randomName
.to.eq(randomName); );
chai.softExpect(customer.email, "Expect correct email").to.eq(email); expect(customer.email, "Expect correct email").to.eq(email);
chai.softExpect(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("should add address to customer", () => { it(
"should add address to customer. TC: SALEOR_1204",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const email = `${randomName}@example.com`; const email = `${randomName}@example.com`;
@ -95,9 +99,13 @@ filterTests({ definedTags: ["all"] }, () => {
cy.expectCorrectFullAddress(addresses[0], secondAddress); cy.expectCorrectFullAddress(addresses[0], secondAddress);
}); });
}); });
}); }
);
it("should remove address from customer", () => { it(
"should remove address from customer. TC: SALEOR_1205",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const email = `${randomName}@example.com`; const email = `${randomName}@example.com`;
@ -120,9 +128,13 @@ filterTests({ definedTags: ["all"] }, () => {
expect(addresses).to.have.length(1); expect(addresses).to.have.length(1);
}); });
}); });
}); }
);
it("should set address as default", () => { it(
"should set address as default. TC: SALEOR_1206",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const email = `${randomName}@example.com`; const email = `${randomName}@example.com`;
let user; let user;
@ -147,7 +159,7 @@ filterTests({ definedTags: ["all"] }, () => {
getCustomer(user.id); getCustomer(user.id);
}) })
.then(({ addresses }) => { .then(({ addresses }) => {
chai.softExpect(addresses[0].isDefaultShippingAddress).to.eq(true); expect(addresses[0].isDefaultShippingAddress).to.eq(true);
cy.get(BUTTON_SELECTORS.showMoreButton) cy.get(BUTTON_SELECTORS.showMoreButton)
.should("be.enabled") .should("be.enabled")
.click() .click()
@ -160,9 +172,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ addresses }) => { .then(({ addresses }) => {
expect(addresses[0].isDefaultBillingAddress).to.be.true; expect(addresses[0].isDefaultBillingAddress).to.be.true;
}); });
}); }
);
it("should update address", () => { it(
"should update address. TC: SALEOR_1208",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const email = `${randomName}@example.com`; const email = `${randomName}@example.com`;
@ -188,9 +204,13 @@ filterTests({ definedTags: ["all"] }, () => {
cy.expectCorrectFullAddress(addedAddress, secondAddress); cy.expectCorrectFullAddress(addedAddress, secondAddress);
}); });
}); });
}); }
);
it("should delete customer", () => { it(
"should delete customer. TC: SALEOR_1203",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const email = `${randomName}@example.com`; const email = `${randomName}@example.com`;
@ -204,9 +224,13 @@ filterTests({ definedTags: ["all"] }, () => {
.wait("@RemoveCustomer"); .wait("@RemoveCustomer");
getCustomer(user.id).should("be.null"); getCustomer(user.id).should("be.null");
}); });
}); }
);
it("should deactivate customer", () => { it(
"should deactivate customer. TC: SALEOR_1209",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const email = `${randomName}@example.com`; const email = `${randomName}@example.com`;
@ -222,9 +246,13 @@ filterTests({ definedTags: ["all"] }, () => {
expect(isActive).to.be.false; expect(isActive).to.be.false;
}); });
}); });
}); }
);
it("should update customer", () => { it(
"should update customer. TC: SALEOR_1202",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const updatedName = `${startsWith}UpdatedName`; const updatedName = `${startsWith}UpdatedName`;
const email = `${randomName}@example.com`; const email = `${randomName}@example.com`;
@ -244,18 +272,16 @@ filterTests({ definedTags: ["all"] }, () => {
.click() .click()
.wait("@UpdateCustomer"); .wait("@UpdateCustomer");
getCustomer(user.id).then(user => { getCustomer(user.id).then(user => {
chai expect(user.firstName, "Expect correct first name").to.eq(
.softExpect(user.firstName, "Expect correct first name") updatedName
.to.eq(updatedName); );
chai expect(user.lastName, "Expect correct last name").to.eq(updatedName);
.softExpect(user.lastName, "Expect correct last name") expect(user.email, "Expect correct email").to.eq(
.to.eq(updatedName); `${updatedName}@example.com`
chai );
.softExpect(user.email, "Expect correct email") expect(user.note, "Expect correct note").to.eq(updatedName);
.to.eq(`${updatedName}@example.com`);
chai.softExpect(user.note, "Expect correct note").to.eq(updatedName);
}); });
}); });
}); }
}); );
}); });

View file

@ -8,33 +8,35 @@ import {
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 filterTests from "../../support/filterTests";
import { import {
createMenu, createMenu,
createNewMenuItem, createNewMenuItem,
MENU_ITEM_TYPES MENU_ITEM_TYPES
} from "../../support/pages/navigationPage"; } from "../../support/pages/navigationPage";
filterTests({ definedTags: ["all"] }, () => { describe("Tests for menu navigation", () => {
describe("Tests for menu navigation", () => { const startsWith = "Navigation";
const startsWith = "Navigation"; const randomName = `${startsWith}${faker.datatype.number()}`;
const randomName = `${startsWith}${faker.datatype.number()}`; let testCase = 1301;
let menu; let menu;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteMenusStartsWith(startsWith); deleteMenusStartsWith(startsWith);
createMenuViaApi(randomName).then( createMenuViaApi(randomName).then(
({ menu: menuResp }) => (menu = menuResp) ({ menu: menuResp }) => (menu = menuResp)
); );
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should create a menu", () => { it(
"should create a menu. TC: SALEOR_1301",
{ tags: ["@menuNavigation", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
createMenu(name) createMenu(name)
@ -44,10 +46,15 @@ filterTests({ definedTags: ["all"] }, () => {
.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 => {
it(`should add new ${itemType} item to menu`, () => { testCase += 1;
it(
`should add new ${itemType} item to menu. TC: SALEOR_${testCase}`,
{ tags: ["@menuNavigation", "@allEnv", "@stable"] },
() => {
const itemName = `${startsWith}${faker.datatype.number()}`; const itemName = `${startsWith}${faker.datatype.number()}`;
let selectedItem; let selectedItem;
@ -66,7 +73,7 @@ filterTests({ definedTags: ["all"] }, () => {
const name = itemType !== "page" ? "name" : "title"; const name = itemType !== "page" ? "name" : "title";
expect(itemOfType[name]).to.eq(selectedItem); expect(itemOfType[name]).to.eq(selectedItem);
}); });
}); }
}); );
}); });
}); });

View file

@ -21,20 +21,22 @@ import { getStaffMembersStartsWith } from "../../support/api/requests/StaffMembe
import { deletePermissionGroupsStartsWith } from "../../support/api/utils/permissionGroupUtils.js"; import { deletePermissionGroupsStartsWith } from "../../support/api/utils/permissionGroupUtils.js";
import filterTests from "../../support/filterTests.js"; import filterTests from "../../support/filterTests.js";
filterTests({ definedTags: ["all"] }, () => { describe("Permissions groups", () => {
describe("Permissions groups", () => { const startsWith = "CyPermissions-";
const startsWith = "CyPermissions-";
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deletePermissionGroupsStartsWith(startsWith); deletePermissionGroupsStartsWith(startsWith);
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should create permission group", () => { it(
"should create permission group. TC: SALEOR_1401",
{ tags: ["@permissions", "@allEnv", "@stable"] },
() => {
const permissionName = `${startsWith}${faker.datatype.number()}`; const permissionName = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.permissionsGroups) cy.visit(urlList.permissionsGroups)
@ -59,9 +61,13 @@ filterTests({ definedTags: ["all"] }, () => {
PERMISSION_GROUP_LIST.permissionGroupRow, PERMISSION_GROUP_LIST.permissionGroupRow,
permissionName permissionName
).should("be.visible"); ).should("be.visible");
}); }
);
it("should delete permission group", () => { it(
"should delete permission group. TC: SALEOR_1402",
{ tags: ["@permissions", "@allEnv"] },
() => {
const permissionName = `${startsWith}${faker.datatype.number()}`; const permissionName = `${startsWith}${faker.datatype.number()}`;
let staffMember; let staffMember;
getStaffMembersStartsWith(TEST_ADMIN_USER.email) getStaffMembersStartsWith(TEST_ADMIN_USER.email)
@ -86,9 +92,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should add user to permission group", () => { xit(
"should add user to permission group. TC: SALEOR_1403",
{ tags: ["@permissions", "@allEnv"] },
() => {
const permissionName = `${startsWith}${faker.datatype.number()}`; const permissionName = `${startsWith}${faker.datatype.number()}`;
createPermissionGroup({ createPermissionGroup({
name: permissionName, name: permissionName,
@ -119,9 +129,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should remove user from permission group", () => { it(
"should remove user from permission group. TC: SALEOR_1404",
{ tags: ["@permissions", "@allEnv", "@stable"] },
() => {
const permissionName = `${startsWith}${faker.datatype.number()}`; const permissionName = `${startsWith}${faker.datatype.number()}`;
let staffMember; let staffMember;
getStaffMembersStartsWith(TEST_ADMIN_USER.email) getStaffMembersStartsWith(TEST_ADMIN_USER.email)
@ -148,6 +162,6 @@ filterTests({ definedTags: ["all"] }, () => {
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");
}); });
}); }
}); );
}); });

View file

@ -23,98 +23,99 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../../support/api/utils/shippingUtils"; } from "../../../support/api/utils/shippingUtils";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["stagedOnly"] }, () => { describe("Adyen payments", () => {
describe("Adyen payments", () => { const startsWith = "CyChannelInDraftOrders-";
const startsWith = "CyChannelInDraftOrders-"; const name = startsWith + faker.datatype.number();
const name = startsWith + faker.datatype.number(); const email = `CyChannelInDraftOrders@example.com`;
const email = `CyChannelInDraftOrders@example.com`;
let address; let address;
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
let shippingMethod; let shippingMethod;
let variantsList; let variantsList;
let checkout; let checkout;
let paymentCards; let paymentCards;
let cardData; let cardData;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
cy.fixture("cards").then(cardsResp => { cy.fixture("cards").then(cardsResp => {
paymentCards = cardsResp.adyen; paymentCards = cardsResp.adyen;
cardData = { cardData = {
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")
.then(addresses => {
address = addresses.usAddress;
getDefaultChannel();
})
.then(channelResp => {
defaultChannel = channelResp;
createShipping({
channelId: channelResp.id,
name,
address,
price: 10
});
})
.then(
({
warehouse: warehouseResp,
shippingZone: shippingZoneResp,
shippingMethod: shippingMethodResp
}) => {
warehouse = warehouseResp;
shippingMethod = shippingMethodResp;
}
);
createTypeAttributeAndCategoryForProduct({ name })
.then(({ productType, attribute, category }) => {
createProductInChannel({
name,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id
});
})
.then(({ variantsList: variants }) => (variantsList = variants));
}); });
cy.fixture("addresses")
beforeEach(() => { .then(addresses => {
cy.clearSessionData().loginUserViaRequest(); address = addresses.usAddress;
createCheckout({ getDefaultChannel();
channelSlug: defaultChannel.slug,
email,
variantsList,
address,
billingAddress: address,
auth: "token"
}) })
.then(({ checkout: checkoutResp }) => { .then(channelResp => {
const shippingMethodId = getShippingMethodIdFromCheckout( defaultChannel = channelResp;
checkoutResp, createShipping({
shippingMethod.name channelId: channelResp.id,
); name,
checkout = checkoutResp; address,
addShippingMethod(checkout.id, shippingMethodId); price: 10
})
.then(({ checkout: checkoutResp }) => {
addAdyenPayment(checkout.id, checkoutResp.totalPrice.gross.amount);
}); });
}); })
.then(
({
warehouse: warehouseResp,
shippingZone: shippingZoneResp,
shippingMethod: shippingMethodResp
}) => {
warehouse = warehouseResp;
shippingMethod = shippingMethodResp;
}
);
createTypeAttributeAndCategoryForProduct({ name })
.then(({ productType, attribute, category }) => {
createProductInChannel({
name,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id
});
})
.then(({ variantsList: variants }) => (variantsList = variants));
});
it("should purchase products with simple card", () => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
createCheckout({
channelSlug: defaultChannel.slug,
email,
variantsList,
address,
billingAddress: address,
auth: "token"
})
.then(({ checkout: checkoutResp }) => {
const shippingMethodId = getShippingMethodIdFromCheckout(
checkoutResp,
shippingMethod.name
);
checkout = checkoutResp;
addShippingMethod(checkout.id, shippingMethodId);
})
.then(({ checkout: checkoutResp }) => {
addAdyenPayment(checkout.id, checkoutResp.totalPrice.gross.amount);
});
});
it(
"should purchase products with simple card",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const simpleCard = cardData; const simpleCard = cardData;
simpleCard.encryptedCardNumber = simpleCard.encryptedCardNumber =
paymentCards.cards.simpleCard.encryptedCardNumber; paymentCards.cards.simpleCard.encryptedCardNumber;
@ -126,9 +127,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
.then(order => { .then(order => {
expect(order.paymentStatus).to.eq("FULLY_CHARGED"); expect(order.paymentStatus).to.eq("FULLY_CHARGED");
}); });
}); }
);
it("should purchase product with 3D secure 2 Auth", () => { it(
"should purchase product with 3D secure 2 Auth",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const threeDSecureCard = cardData; const threeDSecureCard = cardData;
threeDSecureCard.encryptedCardNumber = threeDSecureCard.encryptedCardNumber =
paymentCards.cards.threeDSecureTwoAuth.encryptedCardNumber; paymentCards.cards.threeDSecureTwoAuth.encryptedCardNumber;
@ -140,9 +145,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
.then(order => { .then(order => {
expect(order.paymentStatus).to.eq("FULLY_CHARGED"); expect(order.paymentStatus).to.eq("FULLY_CHARGED");
}); });
}); }
);
it("should purchase product with 3D secure 1 Auth", () => { it(
"should purchase product with 3D secure 1 Auth",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const threeDSecureCardOneAuth = cardData; const threeDSecureCardOneAuth = cardData;
threeDSecureCardOneAuth.encryptedCardNumber = threeDSecureCardOneAuth.encryptedCardNumber =
paymentCards.cards.threeDSecureOneAuth.encryptedCardNumber; paymentCards.cards.threeDSecureOneAuth.encryptedCardNumber;
@ -155,9 +164,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
.then(order => { .then(order => {
expect(order.paymentStatus).to.eq("FULLY_CHARGED"); expect(order.paymentStatus).to.eq("FULLY_CHARGED");
}); });
}); }
);
it("should fail with unknown security number", () => { it(
"should fail with unknown security number",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const simpleCard = cardData; const simpleCard = cardData;
simpleCard.encryptedCardNumber = simpleCard.encryptedCardNumber =
paymentCards.cards.simpleCard.encryptedCardNumber; paymentCards.cards.simpleCard.encryptedCardNumber;
@ -167,9 +180,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
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("should fail with timeout in 3D authorization", () => { it(
"should fail with timeout in 3D authorization",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const errorCard = cardData; const errorCard = cardData;
errorCard.encryptedCardNumber = errorCard.encryptedCardNumber =
paymentCards.cards.errorCard.encryptedCardNumber; paymentCards.cards.errorCard.encryptedCardNumber;
@ -177,9 +194,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
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("should fail with closed account", () => { it(
"should fail with closed account",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const closeAccount = cardData; const closeAccount = cardData;
closeAccount.encryptedCardNumber = closeAccount.encryptedCardNumber =
paymentCards.cards.closeAccount.encryptedCardNumber; paymentCards.cards.closeAccount.encryptedCardNumber;
@ -187,6 +208,6 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
completeCheckout(checkout.id, closeAccount).then(({ errors }) => { completeCheckout(checkout.id, closeAccount).then(({ errors }) => {
expect(errors).to.have.length(1); expect(errors).to.have.length(1);
}); });
}); }
}); );
}); });

View file

@ -21,52 +21,53 @@ import {
getMailActivationLinkForUserAndSubject, getMailActivationLinkForUserAndSubject,
getMailsForUser getMailsForUser
} from "../../../support/api/utils/users"; } from "../../../support/api/utils/users";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["stagedOnly"], version: "3.1.0" }, () => { describe("Plugins", () => {
describe("Plugins", () => { const startsWith = "Plugins";
const startsWith = "Plugins"; const randomName = `${startsWith}${faker.datatype.number()}`;
const randomName = `${startsWith}${faker.datatype.number()}`; let defaultChannel;
let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteCustomersStartsWith(startsWith); deleteCustomersStartsWith(startsWith);
deleteChannelsStartsWith(startsWith); deleteChannelsStartsWith(startsWith);
createChannel({ name: randomName }); createChannel({ name: randomName });
getDefaultChannel().then(channel => (defaultChannel = channel)); getDefaultChannel().then(channel => (defaultChannel = channel));
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.plugins) .visit(urlList.plugins)
.softExpectSkeletonIsVisible(); .expectSkeletonIsVisible();
}); });
it("should change user email", () => { it("should change user email", { tags: ["@plugins", "@stagedOnly"] }, () => {
const customerEmail = `${randomName}@example.com`; const customerEmail = `${randomName}@example.com`;
cy.contains(PLUGINS_LIST.pluginRow, "User emails").click(); cy.contains(PLUGINS_LIST.pluginRow, "User emails").click();
cy.contains(PLUGINS_DETAILS.channel, defaultChannel.name) cy.contains(PLUGINS_DETAILS.channel, defaultChannel.name)
.click() .click()
.get(PLUGINS_DETAILS.accountConfirmationSubjectInput) .get(PLUGINS_DETAILS.accountConfirmationSubjectInput)
.clearAndType(randomName) .clearAndType(randomName)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click() .click()
.confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
customerRegistration({ customerRegistration({
email: customerEmail, email: customerEmail,
channel: defaultChannel.slug channel: defaultChannel.slug
})
.then(() => {
getMailsForUser(customerEmail);
}) })
.then(() => { .then(mails => {
getMailsForUser(customerEmail); expect(mails[0].Content.Headers.Subject[0]).to.eq(randomName);
}) });
.then(mails => { });
expect(mails[0].Content.Headers.Subject[0]).to.eq(randomName);
});
});
it("should change admin email plugin", () => { it(
"should change admin email plugin",
{ tags: ["@plugins", "@stagedOnly"] },
() => {
const customerEmail = `${randomName}@example.com`; const customerEmail = `${randomName}@example.com`;
cy.contains(PLUGINS_LIST.pluginRow, "Admin emails") cy.contains(PLUGINS_LIST.pluginRow, "Admin emails")
.click() .click()
@ -87,6 +88,6 @@ filterTests({ definedTags: ["stagedOnly"], version: "3.1.0" }, () => {
.then(link => { .then(link => {
expect(link).to.be.ok; expect(link).to.be.ok;
}); });
}); }
}); );
}); });

View file

@ -14,65 +14,66 @@ import {
} 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";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["stagedOnly"] }, () => { describe("Stripe payments", () => {
describe("Stripe payments", () => { const startsWith = "Stripe-";
const startsWith = "Stripe-"; const email = `example@example.com`;
const email = `example@example.com`;
let address; let address;
let defaultChannel; let defaultChannel;
let shippingMethod; let shippingMethod;
let variantsList; let variantsList;
let checkout; let checkout;
let paymentCards; let paymentCards;
let cardData; let cardData;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
cy.fixture("cards").then(({ stripe }) => { cy.fixture("cards").then(({ stripe }) => {
paymentCards = stripe; paymentCards = stripe;
cardData = { cardData = {
publicKey: paymentCards.publicApiKey, publicKey: paymentCards.publicApiKey,
cvc: 123, cvc: 123,
expMonth: 10, expMonth: 10,
expYear: 50 expYear: 50
}; };
});
createProductWithShipping({ name: startsWith }).then(values => {
address = values.address;
defaultChannel = values.defaultChannel;
shippingMethod = values.shippingMethod;
variantsList = values.variantsList;
});
}); });
createProductWithShipping({ name: startsWith }).then(values => {
address = values.address;
defaultChannel = values.defaultChannel;
shippingMethod = values.shippingMethod;
variantsList = values.variantsList;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
createCheckout({ createCheckout({
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
email, email,
variantsList, variantsList,
address, address,
billingAddress: address, billingAddress: address,
auth: "token" auth: "token"
})
.then(({ checkout: checkoutResp }) => {
checkout = checkoutResp;
const shippingMethodId = getShippingMethodIdFromCheckout(
checkoutResp,
shippingMethod.name
);
addShippingMethod(checkout.id, shippingMethodId);
}) })
.then(({ checkout: checkoutResp }) => { .then(({ checkout: checkoutResp }) => {
checkout = checkoutResp; checkout = checkoutResp;
const shippingMethodId = getShippingMethodIdFromCheckout( });
checkoutResp, });
shippingMethod.name
);
addShippingMethod(checkout.id, shippingMethodId);
})
.then(({ checkout: checkoutResp }) => {
checkout = checkoutResp;
});
});
it("should purchase products with simple card", () => { it(
"should purchase products with simple card",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const simpleCard = cardData; const simpleCard = cardData;
simpleCard.cardNumber = paymentCards.simpleCardNumber; simpleCard.cardNumber = paymentCards.simpleCardNumber;
addStripePaymentAndGetConfirmationData({ addStripePaymentAndGetConfirmationData({
@ -89,9 +90,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
.then(order => { .then(order => {
expect(order.paymentStatus).to.eq("FULLY_CHARGED"); expect(order.paymentStatus).to.eq("FULLY_CHARGED");
}); });
}); }
);
it("should not purchase products with card with insufficient funds", () => { it(
"should not purchase products with card with insufficient funds",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const simpleCard = cardData; const simpleCard = cardData;
simpleCard.cardNumber = paymentCards.insufficientFundsCard; simpleCard.cardNumber = paymentCards.insufficientFundsCard;
addStripePaymentAndGetConfirmationData({ addStripePaymentAndGetConfirmationData({
@ -101,9 +106,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
}).then(resp => { }).then(resp => {
expect(resp.body.error.code).to.equal("card_declined"); expect(resp.body.error.code).to.equal("card_declined");
}); });
}); }
);
it("should purchase products with 3D secure card", () => { it(
"should purchase products with 3D secure card",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const threeDSecureCard = cardData; const threeDSecureCard = cardData;
threeDSecureCard.cardNumber = paymentCards.threeDSecureAuthCard; threeDSecureCard.cardNumber = paymentCards.threeDSecureAuthCard;
addStripePaymentAndGetConfirmationData({ addStripePaymentAndGetConfirmationData({
@ -123,9 +132,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
.then(order => { .then(order => {
expect(order.paymentStatus).to.eq("FULLY_CHARGED"); expect(order.paymentStatus).to.eq("FULLY_CHARGED");
}); });
}); }
);
it("should not purchase product when 3D secure not pass", () => { it(
"should not purchase product when 3D secure not pass",
{ tags: ["@payments", "@stagedOnly"] },
() => {
const threeDSecureCard = cardData; const threeDSecureCard = cardData;
threeDSecureCard.cardNumber = paymentCards.threeDSecureAuthCard; threeDSecureCard.cardNumber = paymentCards.threeDSecureAuthCard;
addStripePaymentAndGetConfirmationData({ addStripePaymentAndGetConfirmationData({
@ -142,6 +155,6 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
.then(({ order }) => { .then(({ order }) => {
expect(order).to.not.be.ok; expect(order).to.not.be.ok;
}); });
}); }
}); );
}); });

View file

@ -15,28 +15,29 @@ import {
} 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";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to manage attributes in product types", () => {
describe("As an admin I want to manage attributes in product types", () => { const startsWith = "productType";
const startsWith = "productType"; let category;
let category; let channel;
let channel; let attribute;
let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
createAttribute({ name: startsWith }).then(resp => (attribute = resp)); createAttribute({ name: startsWith }).then(resp => (attribute = resp));
createCategory({ name: startsWith }).then(resp => (category = resp)); createCategory({ name: startsWith }).then(resp => (category = resp));
getDefaultChannel().then(resp => (channel = resp)); getDefaultChannel().then(resp => (channel = resp));
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to update product type with product attribute. TC: SALEOR_1503", () => { it(
"should be able to update product type with product attribute. TC: SALEOR_1503",
{ tags: ["@productType", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
createTypeProduct({ name }) createTypeProduct({ name })
@ -55,9 +56,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(productType => { .then(productType => {
expect(productType.productAttributes[0].name).to.eq(startsWith); expect(productType.productAttributes[0].name).to.eq(startsWith);
}); });
}); }
);
it("should be able to update product type with variant attribute. TC: SALEOR_1504", () => { it(
"should be able to update product type with variant attribute. TC: SALEOR_1504",
{ tags: ["@productType", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
createTypeProduct({ name, hasVariants: false }) createTypeProduct({ name, hasVariants: false })
@ -80,9 +85,13 @@ filterTests({ definedTags: ["all"] }, () => {
startsWith startsWith
); );
}); });
}); }
);
it("should be able to remove variant attribute from product type. TC: SALEOR_1506", () => { it(
"should be able to remove variant attribute from product type. TC: SALEOR_1506",
{ tags: ["@productType", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let productType; let productType;
@ -109,9 +118,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(productTypeResp => { .then(productTypeResp => {
expect(productTypeResp.assignedVariantAttributes).to.be.empty; expect(productTypeResp.assignedVariantAttributes).to.be.empty;
}); });
}); }
);
it("should be able to remove product attribute from product type. TC: SALEOR_1507", () => { it(
"should be able to remove product attribute from product type. TC: SALEOR_1507",
{ tags: ["@productType", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let productType; let productType;
@ -138,9 +151,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(productTypeResp => { .then(productTypeResp => {
expect(productTypeResp.assignedVariantAttributes).to.be.empty; expect(productTypeResp.assignedVariantAttributes).to.be.empty;
}); });
}); }
);
it("should be able to select attribute as variant selection. TC: SALEOR_1508", () => { it(
"should be able to select attribute as variant selection. TC: SALEOR_1508",
{ tags: ["@productType", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let productType; let productType;
@ -169,6 +186,6 @@ filterTests({ definedTags: ["all"] }, () => {
productType.assignedVariantAttributes[0].variantSelection productType.assignedVariantAttributes[0].variantSelection
).to.eq(true); ).to.eq(true);
}); });
}); }
}); );
}); });

View file

@ -6,26 +6,27 @@ import faker from "faker";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { getProductType } from "../../../support/api/requests/ProductType"; import { getProductType } from "../../../support/api/requests/ProductType";
import { deleteProductsStartsWith } from "../../../support/api/utils/products/productsUtils"; import { deleteProductsStartsWith } from "../../../support/api/utils/products/productsUtils";
import filterTests from "../../../support/filterTests";
import { createProductType } from "../../../support/pages/productTypePage"; import { createProductType } from "../../../support/pages/productTypePage";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to create product types", () => {
describe("As an admin I want to create product types", () => { const startsWith = "productType";
const startsWith = "productType";
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.productTypes) .visit(urlList.productTypes)
.softExpectSkeletonIsVisible(); .expectSkeletonIsVisible();
}); });
it("should be able to create product type without shipping required. TC: SALEOR_1501", () => { it(
"should be able to create product type without shipping required. TC: SALEOR_1501",
{ tags: ["@productType", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
createProductType({ name }) createProductType({ name })
@ -37,9 +38,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should be able to create product type with shipping required. TC: SALEOR_1502", () => { it(
"should be able to create product type with shipping required. TC: SALEOR_1502",
{ tags: ["@productType", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const shippingWeight = 10; const shippingWeight = 10;
@ -53,9 +58,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should be able to create product type with gift card kind. TC: SALEOR_1510", () => { it(
"should be able to create product type with gift card kind. TC: SALEOR_1510",
{ tags: ["@productType", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
createProductType({ name, giftCard: true }) createProductType({ name, giftCard: true })
@ -67,6 +76,6 @@ filterTests({ definedTags: ["all"] }, () => {
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");
}); });
}); }
}); );
}); });

View file

@ -4,7 +4,6 @@
import faker from "faker"; import faker from "faker";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
import { productTypeDetailsUrl } from "../../../fixtures/urlList"; import { productTypeDetailsUrl } from "../../../fixtures/urlList";
import { createAttribute } from "../../../support/api/requests/Attribute"; import { createAttribute } from "../../../support/api/requests/Attribute";
import { createCategory } from "../../../support/api/requests/Category"; import { createCategory } from "../../../support/api/requests/Category";
@ -18,28 +17,29 @@ import {
createProductInChannel, createProductInChannel,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../../support/api/utils/products/productsUtils"; } from "../../../support/api/utils/products/productsUtils";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to manage product types", () => {
describe("As an admin I want to manage product types", () => { const startsWith = "productType";
const startsWith = "productType"; let category;
let category; let channel;
let channel; let attribute;
let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
createAttribute({ name: startsWith }).then(resp => (attribute = resp)); createAttribute({ name: startsWith }).then(resp => (attribute = resp));
createCategory({ name: startsWith }).then(resp => (category = resp)); createCategory({ name: startsWith }).then(resp => (category = resp));
getDefaultChannel().then(resp => (channel = resp)); getDefaultChannel().then(resp => (channel = resp));
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to delete product type. TC: SALEOR_1505", () => { it(
"should be able to delete product type. TC: SALEOR_1505",
{ tags: ["@productType", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
createTypeProduct({ name, hasVariants: false }).then(productType => { createTypeProduct({ name, hasVariants: false }).then(productType => {
@ -54,9 +54,13 @@ filterTests({ definedTags: ["all"] }, () => {
.waitForRequestAndCheckIfNoErrors("@ProductTypeDelete"); .waitForRequestAndCheckIfNoErrors("@ProductTypeDelete");
getProductType(productType.id).should("be.null"); getProductType(productType.id).should("be.null");
}); });
}); }
);
it("should be able to delete product type with assigned product. TC: SALEOR_1509", () => { it(
"should be able to delete product type with assigned product. TC: SALEOR_1509",
{ tags: ["@productType", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let productType; let productType;
@ -89,6 +93,6 @@ filterTests({ definedTags: ["all"] }, () => {
.its("body.data.product") .its("body.data.product")
.should("be.null"); .should("be.null");
}); });
}); }
}); );
}); });

View file

@ -13,25 +13,26 @@ import {
} 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 filterTests from "../../../support/filterTests";
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";
filterTests({ definedTags: ["all"] }, () => { 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", () => { const startsWith = "ChannelShippingMethod";
const startsWith = "ChannelShippingMethod"; let defaultChannel;
let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
shippingUtils.deleteShippingStartsWith(startsWith); shippingUtils.deleteShippingStartsWith(startsWith);
channelsUtils.deleteChannelsStartsWith(startsWith); channelsUtils.deleteChannelsStartsWith(startsWith);
}); });
it("should be able to display different price for each channel. TC: SALEOR_0805", () => { it(
"should be able to display different price for each channel. TC: SALEOR_0805",
{ tags: ["@shipping", "@allEnv"] },
() => {
const shippingName = `${startsWith}${faker.datatype.number()}`; const shippingName = `${startsWith}${faker.datatype.number()}`;
const defaultChannelPrice = 11; const defaultChannelPrice = 11;
const createdChannelPrice = 7; const createdChannelPrice = 7;
@ -114,6 +115,6 @@ filterTests({ definedTags: ["all"] }, () => {
expect(text).to.includes(createdChannelCurrency); expect(text).to.includes(createdChannelCurrency);
}); });
}); });
}); }
}); );
}); });

View file

@ -13,103 +13,104 @@ 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 * as shippingUtils from "../../../support/api/utils/shippingUtils"; import * as shippingUtils from "../../../support/api/utils/shippingUtils";
import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils"; import { isShippingAvailableInCheckout } from "../../../support/api/utils/storeFront/checkoutUtils";
import filterTests from "../../../support/filterTests";
import { import {
createShippingRate, createShippingRate,
createShippingZone, createShippingZone,
rateOptions rateOptions
} from "../../../support/pages/shippingMethodPage"; } from "../../../support/pages/shippingMethodPage";
filterTests({ definedTags: ["all"] }, () => { 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", () => { const startsWith = "CreateShippingMethods-";
const startsWith = "CreateShippingMethods-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; const secondName = `${startsWith}${faker.datatype.number()}`;
const secondName = `${startsWith}${faker.datatype.number()}`; const price = 8;
const price = 8; const secondVariantPrice = 2;
const secondVariantPrice = 2; const deliveryTime = { min: 2, max: 5 };
const deliveryTime = { min: 2, max: 5 }; let defaultChannel;
let defaultChannel; let address;
let address; let variantsList;
let variantsList; let secondVariantsList;
let secondVariantsList; let warehouse;
let warehouse; let attribute;
let attribute; let category;
let category; let productType;
let productType;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
shippingUtils.deleteShippingStartsWith(startsWith); shippingUtils.deleteShippingStartsWith(startsWith);
channelsUtils channelsUtils
.getDefaultChannel() .getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addresses => { .then(addresses => {
address = addresses.usAddress; address = addresses.usAddress;
createWarehouse({ name, address }); createWarehouse({ name, address });
}) })
.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;
productType = productTypeResp; productType = productTypeResp;
productsUtils.createProductInChannel({ productsUtils.createProductInChannel({
name, name,
channelId: defaultChannel.id, channelId: defaultChannel.id,
productTypeId: productTypeResp.id, productTypeId: productTypeResp.id,
attributeId: attributeResp.id, attributeId: attributeResp.id,
categoryId: categoryResp.id, categoryId: categoryResp.id,
warehouseId: warehouse.id,
quantityInWarehouse: 10,
price
});
}
)
.then(({ variantsList: variantsListResp, product }) => {
variantsList = variantsListResp;
createVariant({
productId: product.id,
sku: secondName,
attributeId: attribute.id,
attributeName: "value2",
warehouseId: warehouse.id, warehouseId: warehouse.id,
quantityInWarehouse: 10, quantityInWarehouse: 10,
channelId: defaultChannel.id, price
price: secondVariantPrice,
weight: 10
}); });
}) }
.then(variantsListResp => { )
secondVariantsList = variantsListResp; .then(({ variantsList: variantsListResp, product }) => {
variantsList = variantsListResp;
createVariant({
productId: product.id,
sku: secondName,
attributeId: attribute.id,
attributeName: "value2",
warehouseId: warehouse.id,
quantityInWarehouse: 10,
channelId: defaultChannel.id,
price: secondVariantPrice,
weight: 10
}); });
}); })
.then(variantsListResp => {
secondVariantsList = variantsListResp;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to create price based shipping method. TC: SALEOR_0803", () => { it(
"should be able to create price based shipping method. TC: SALEOR_0803",
{ tags: ["@shipping", "@allEnv"] },
() => {
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).softExpectSkeletonIsVisible(); cy.visit(urlList.shippingMethods).expectSkeletonIsVisible();
createShippingZone( createShippingZone(
shippingName, shippingName,
warehouse.name, warehouse.name,
@ -147,15 +148,19 @@ filterTests({ definedTags: ["all"] }, () => {
); );
expect(isShippingAvailable).to.be.false; expect(isShippingAvailable).to.be.false;
}); });
}); }
);
it("should be able to create weight based shipping method. TC: SALEOR_0804", () => { it(
"should be able to create weight based shipping method. TC: SALEOR_0804",
{ tags: ["@shipping", "@allEnv"] },
() => {
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).softExpectSkeletonIsVisible(); cy.visit(urlList.shippingMethods).expectSkeletonIsVisible();
createShippingZone( createShippingZone(
shippingName, shippingName,
warehouse.name, warehouse.name,
@ -193,6 +198,6 @@ filterTests({ definedTags: ["all"] }, () => {
); );
expect(isShippingAvailable).to.be.false; expect(isShippingAvailable).to.be.false;
}); });
}); }
}); );
}); });

View file

@ -12,50 +12,51 @@ import {
} 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 filterTests from "../../../support/filterTests";
import { import {
fillUpShippingRate, fillUpShippingRate,
saveRateAfterUpdate saveRateAfterUpdate
} from "../../../support/pages/shippingMethodPage"; } from "../../../support/pages/shippingMethodPage";
filterTests({ definedTags: ["all"] }, () => { 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", () => { const startsWith = "EditShipping-";
const startsWith = "EditShipping-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; const price = 10;
const price = 10;
let defaultChannel; let defaultChannel;
let shippingZone; let shippingZone;
let shippingMethod; let shippingMethod;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
createShippingZone(name, "US", defaultChannel.id); createShippingZone(name, "US", defaultChannel.id);
}) })
.then(shippingZoneResp => { .then(shippingZoneResp => {
shippingZone = shippingZoneResp; shippingZone = shippingZoneResp;
});
});
beforeEach(() => {
const rateName = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest();
createShippingRate({
name: rateName,
shippingZone: shippingZone.id
}).then(({ shippingMethod: shippingResp }) => {
shippingMethod = shippingResp;
addChannelToShippingMethod(shippingMethod.id, defaultChannel.id, 1);
}); });
}); });
it("should be able to update shipping rate. TC: SALEOR_0806", () => { beforeEach(() => {
const rateName = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest();
createShippingRate({
name: rateName,
shippingZone: shippingZone.id
}).then(({ shippingMethod: shippingResp }) => {
shippingMethod = shippingResp;
addChannelToShippingMethod(shippingMethod.id, defaultChannel.id, 1);
});
});
it(
"should be able to update shipping rate. TC: SALEOR_0806",
{ tags: ["@shipping", "@allEnv", "@stable"] },
() => {
const updatedRateName = `${startsWith}Updated`; const updatedRateName = `${startsWith}Updated`;
const deliveryTime = { min: 1, max: 7 }; const deliveryTime = { min: 1, max: 7 };
@ -68,19 +69,23 @@ filterTests({ definedTags: ["all"] }, () => {
saveRateAfterUpdate(); saveRateAfterUpdate();
getShippingZone(shippingZone.id).then(({ shippingMethods }) => { getShippingZone(shippingZone.id).then(({ shippingMethods }) => {
expect(shippingMethods).to.have.length(1); expect(shippingMethods).to.have.length(1);
chai expect(shippingMethods[0].minimumDeliveryDays).to.be.eq(
.softExpect(shippingMethods[0].minimumDeliveryDays) deliveryTime.min
.to.be.eq(deliveryTime.min); );
chai expect(shippingMethods[0].maximumDeliveryDays).to.be.eq(
.softExpect(shippingMethods[0].maximumDeliveryDays) deliveryTime.max
.to.be.eq(deliveryTime.max); );
chai expect(shippingMethods[0].channelListings[0].price.amount).to.be.eq(
.softExpect(shippingMethods[0].channelListings[0].price.amount) price
.to.be.eq(price); );
}); });
}); }
);
it("should be able to delete shipping rate. TC: SALEOR_0807", () => { it(
"should be able to delete shipping rate. TC: SALEOR_0807",
{ tags: ["@shipping", "@allEnv", "@stable"] },
() => {
cy.visit( cy.visit(
shippingRateUrl(shippingZone.id, shippingMethod.id) shippingRateUrl(shippingZone.id, shippingMethod.id)
).deleteElementWithReqAlias("DeleteShippingRate"); ).deleteElementWithReqAlias("DeleteShippingRate");
@ -90,6 +95,6 @@ filterTests({ definedTags: ["all"] }, () => {
); );
expect(deletedShipping).to.be.not.ok; expect(deletedShipping).to.be.not.ok;
}); });
}); }
}); );
}); });

View file

@ -12,46 +12,45 @@ import {
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";
import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils"; import { deleteShippingStartsWith } from "../../../support/api/utils/shippingUtils";
import filterTests from "../../../support/filterTests";
import { fillUpShippingZoneData } from "../../../support/pages/shippingMethodPage"; import { fillUpShippingZoneData } from "../../../support/pages/shippingMethodPage";
import { enterAndSelectShippings } from "../../../support/pages/shippingZones"; import { enterAndSelectShippings } from "../../../support/pages/shippingZones";
filterTests({ definedTags: ["all"] }, () => { describe("As a user I should be able to update and delete shipping zone", () => {
describe("As a user I should be able to update and delete shipping zone", () => { const startsWith = "EditShipping-";
const startsWith = "EditShipping-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`;
let defaultChannel; let defaultChannel;
let shippingZone; let shippingZone;
let plAddress; let plAddress;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addresses => { .then(addresses => {
plAddress = addresses.plAddress; plAddress = addresses.plAddress;
createWarehouse({ name, address: plAddress }); createWarehouse({ name, address: plAddress });
}); });
});
beforeEach(() => {
const rateName = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest();
createShippingZone(name, "US", defaultChannel.id).then(shippingZoneResp => {
shippingZone = shippingZoneResp;
}); });
});
beforeEach(() => { it(
const rateName = `${startsWith}${faker.datatype.number()}`; "should be able to update shipping zone. TC: SALEOR_0808",
{ tags: ["@shipping", "@allEnv"] },
cy.clearSessionData().loginUserViaRequest(); () => {
createShippingZone(name, "US", defaultChannel.id).then(
shippingZoneResp => {
shippingZone = shippingZoneResp;
}
);
});
it("should be able to update shipping zone. TC: SALEOR_0808", () => {
const updatedName = `${startsWith}Updated`; const updatedName = `${startsWith}Updated`;
cy.visit(shippingZoneDetailsUrl(shippingZone.id)); cy.visit(shippingZoneDetailsUrl(shippingZone.id));
@ -62,22 +61,30 @@ filterTests({ definedTags: ["all"] }, () => {
warehouseName: name warehouseName: name
}); });
getShippingZone(shippingZone.id).then(shippingZone => { getShippingZone(shippingZone.id).then(shippingZone => {
chai.softExpect(shippingZone.channels).to.have.length(0); expect(shippingZone.channels).to.have.length(0);
chai.softExpect(shippingZone.name).to.eq(updatedName); expect(shippingZone.name).to.eq(updatedName);
chai.softExpect(shippingZone.description).to.eq(updatedName); expect(shippingZone.description).to.eq(updatedName);
chai.softExpect(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("should be able to delete shipping zone. TC: SALEOR_0809", () => { it(
"should be able to delete shipping zone. TC: SALEOR_0809",
{ 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("should be able to delete several shipping zones on shipping zones list page. TC: SALEOR_0810", () => { it(
"should be able to delete several shipping zones on shipping zones list page. TC: SALEOR_0810",
{ tags: ["@shipping", "@allEnv"] },
() => {
let secondShippingZone; let secondShippingZone;
createShippingZone(`${startsWith}Second`, "US", defaultChannel.id).then( createShippingZone(`${startsWith}Second`, "US", defaultChannel.id).then(
@ -94,6 +101,6 @@ filterTests({ definedTags: ["all"] }, () => {
getShippingZone(secondShippingZone.id).should("be.null"); getShippingZone(secondShippingZone.id).should("be.null");
} }
); );
}); }
}); );
}); });

View file

@ -16,80 +16,81 @@ import {
} 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 filterTests from "../../../support/filterTests";
import { import {
createRateWithPostalCode, createRateWithPostalCode,
postalCodesOptions postalCodesOptions
} from "../../../support/pages/shippingMethodPage"; } from "../../../support/pages/shippingMethodPage";
filterTests({ definedTags: ["all"] }, () => { 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", () => { const startsWith = "CyShippingMethods-";
const startsWith = "CyShippingMethods-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`;
const price = 10; const price = 10;
let defaultChannel; let defaultChannel;
let usAddress; let usAddress;
let secondUsAddress; let secondUsAddress;
let shippingZone; let shippingZone;
let warehouse; let warehouse;
let variantsList; let variantsList;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.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 => {
warehouse = warehouseResp;
createTypeAttributeAndCategoryForProduct({ name });
})
.then(({ attribute, productType, category }) => {
createProductInChannel({
name,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
attributeId: attribute.id,
categoryId: category.id,
productTypeId: productType.id
});
})
.then(({ variantsList: variantsListResp }) => {
variantsList = variantsListResp;
}); });
}); })
.then(warehouseResp => {
warehouse = warehouseResp;
createTypeAttributeAndCategoryForProduct({ name });
})
.then(({ attribute, productType, category }) => {
createProductInChannel({
name,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
attributeId: attribute.id,
categoryId: category.id,
productTypeId: productType.id
});
})
.then(({ variantsList: variantsListResp }) => {
variantsList = variantsListResp;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping) .loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping)
.visit(shippingZoneDetailsUrl(shippingZone.id)); .visit(shippingZoneDetailsUrl(shippingZone.id));
}); });
it("should be able to create shipping method with included postal codes. TC: SALEOR_0801", () => { it(
"should be able to create shipping method with included postal codes. TC: SALEOR_0801",
{ tags: ["@shipping", "@allEnv", "@stable"] },
() => {
const rateName = `${startsWith}${faker.datatype.number()}`; const rateName = `${startsWith}${faker.datatype.number()}`;
createRateWithPostalCode({ createRateWithPostalCode({
@ -105,9 +106,13 @@ filterTests({ definedTags: ["all"] }, () => {
isShippingAvailableForAddress(secondUsAddress, rateName).then( isShippingAvailableForAddress(secondUsAddress, rateName).then(
isAvailable => expect(isAvailable).to.be.false isAvailable => expect(isAvailable).to.be.false
); );
}); }
);
it("should be able to create shipping method with excluded postal codes. TC: SALEOR_0802", () => { it(
"should be able to create shipping method with excluded postal codes. TC: SALEOR_0802",
{ tags: ["@shipping", "@allEnv", "@stable"] },
() => {
const rateName = `${startsWith}${faker.datatype.number()}`; const rateName = `${startsWith}${faker.datatype.number()}`;
createRateWithPostalCode({ createRateWithPostalCode({
@ -123,17 +128,17 @@ filterTests({ definedTags: ["all"] }, () => {
isShippingAvailableForAddress(secondUsAddress, rateName).then( isShippingAvailableForAddress(secondUsAddress, rateName).then(
isAvailable => expect(isAvailable).to.be.true isAvailable => expect(isAvailable).to.be.true
); );
});
function isShippingAvailableForAddress(address, rateName) {
return createCheckout({
address,
channelSlug: defaultChannel.slug,
email: "example@example.com",
variantsList
}).then(({ checkout }) =>
isShippingAvailableInCheckout(checkout, rateName)
);
} }
}); );
function isShippingAvailableForAddress(address, rateName) {
return createCheckout({
address,
channelSlug: defaultChannel.slug,
email: "example@example.com",
variantsList
}).then(({ checkout }) =>
isShippingAvailableInCheckout(checkout, rateName)
);
}
}); });

View file

@ -16,74 +16,75 @@ import {
} 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 filterTests from "../../../../support/filterTests";
import { import {
createShippingRate, createShippingRate,
rateOptions rateOptions
} from "../../../../support/pages/shippingMethodPage"; } from "../../../../support/pages/shippingMethodPage";
filterTests({ definedTags: ["all"] }, () => { describe("As a staff user I want to manage shipping weights", () => {
describe("As a staff user I want to manage shipping weights", () => { const startsWith = "CyWeightRates-";
const startsWith = "CyWeightRates-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`;
const price = 10; const price = 10;
let defaultChannel; let defaultChannel;
let usAddress; let usAddress;
let shippingZone; let shippingZone;
let warehouse; let warehouse;
let variantsList; let variantsList;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(({ usAddress: usAddressResp }) => { .then(({ usAddress: usAddressResp }) => {
usAddress = usAddressResp; usAddress = usAddressResp;
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 => {
warehouse = warehouseResp;
createTypeAttributeAndCategoryForProduct({ name });
})
.then(({ attribute, productType, category }) => {
createProductInChannel({
name,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
attributeId: attribute.id,
categoryId: category.id,
productTypeId: productType.id,
weight: 10
});
})
.then(({ variantsList: variantsListResp }) => {
variantsList = variantsListResp;
}); });
}); })
.then(warehouseResp => {
warehouse = warehouseResp;
createTypeAttributeAndCategoryForProduct({ name });
})
.then(({ attribute, productType, category }) => {
createProductInChannel({
name,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
attributeId: attribute.id,
categoryId: category.id,
productTypeId: productType.id,
weight: 10
});
})
.then(({ variantsList: variantsListResp }) => {
variantsList = variantsListResp;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping) .loginUserViaRequest("auth", ONE_PERMISSION_USERS.shipping)
.visit(shippingZoneDetailsUrl(shippingZone.id)); .visit(shippingZoneDetailsUrl(shippingZone.id));
}); });
it("should be possible to buy product in a shipping weight limits. TC: SALEOR_0902", () => { it(
"should be possible to buy product in a shipping weight limits. TC: SALEOR_0902",
{ tags: ["@shipping", "@allEnv", "@stable"] },
() => {
const rateName = `${startsWith}${faker.datatype.number()}`; const rateName = `${startsWith}${faker.datatype.number()}`;
createShippingRate({ createShippingRate({
@ -106,9 +107,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ checkout }) => { .then(({ checkout }) => {
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.true; expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.true;
}); });
}); }
);
it("should not be possible to buy product not in a shipping weight limits. TC: SALEOR_0903", () => { it(
"should not be possible to buy product not in a shipping weight limits. TC: SALEOR_0903",
{ tags: ["@shipping", "@allEnv", "@stable"] },
() => {
const rateName = `${startsWith}${faker.datatype.number()}`; const rateName = `${startsWith}${faker.datatype.number()}`;
createShippingRate({ createShippingRate({
@ -131,6 +136,6 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ checkout }) => { .then(({ checkout }) => {
expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.false; expect(isShippingAvailableInCheckout(checkout, rateName)).to.be.false;
}); });
}); }
}); );
}); });

View file

@ -14,41 +14,42 @@ import { updateShopWeightUnit } from "../../../../support/api/requests/ShopSetti
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";
import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils"; import { deleteShippingStartsWith } from "../../../../support/api/utils/shippingUtils";
import filterTests from "../../../../support/filterTests";
import { changeWeightUnit } from "../../../../support/pages/shippingMethodPage"; import { changeWeightUnit } from "../../../../support/pages/shippingMethodPage";
filterTests({ definedTags: ["all"] }, () => { xdescribe("As a staff user I want to change shop default weight unit", () => {
xdescribe("As a staff user I want to change shop default weight unit", () => { const startsWith = "RecalculateWeight";
const startsWith = "RecalculateWeight"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`;
let defaultChannel; let defaultChannel;
let usAddress; let usAddress;
let shippingZone; let shippingZone;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
updateShopWeightUnit("KG") updateShopWeightUnit("KG")
.then(() => { .then(() => {
getDefaultChannel().then(channel => { getDefaultChannel().then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.fixture("addresses"); cy.fixture("addresses");
});
})
.then(({ usAddress: usAddressResp }) => {
usAddress = usAddressResp;
createShippingZone(name, "US", defaultChannel.id);
})
.then(shippingZoneResp => {
shippingZone = shippingZoneResp;
}); });
}); })
.then(({ usAddress: usAddressResp }) => {
usAddress = usAddressResp;
createShippingZone(name, "US", defaultChannel.id);
})
.then(shippingZoneResp => {
shippingZone = shippingZoneResp;
});
});
// Log in as user with shipping permissions after resolving SALEOR-3407 bug // Log in as user with shipping permissions after resolving SALEOR-3407 bug
it("should recalculate weight after changing shipping weight unit. TC: SALEOR_0901", () => { it(
"should recalculate weight after changing shipping weight unit. TC: SALEOR_0901",
{ tags: ["@shipping", "@allEnv", "@stable"] },
() => {
const rateName = `${startsWith}${faker.datatype.number()}`; const rateName = `${startsWith}${faker.datatype.number()}`;
const minWeightInKg = 1; const minWeightInKg = 1;
const maxWeightInKg = 10; const maxWeightInKg = 10;
@ -98,6 +99,6 @@ filterTests({ definedTags: ["all"] }, () => {
.then(actualMaxWeight => { .then(actualMaxWeight => {
expect(parseInt(actualMaxWeight, 10)).to.eq(maxWeightInG); expect(parseInt(actualMaxWeight, 10)).to.eq(maxWeightInG);
}); });
}); }
}); );
}); });

View file

@ -10,41 +10,42 @@ import {
getShopInfo, getShopInfo,
updateShopAddress updateShopAddress
} from "../../support/api/requests/ShopSettings"; } from "../../support/api/requests/ShopSettings";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { xdescribe("Tests for site settings", () => {
xdescribe("Tests for site settings", () => { let address;
let address;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
cy.fixture("addresses").then(({ usAddress, plAddress }) => { cy.fixture("addresses").then(({ usAddress, plAddress }) => {
address = usAddress; address = usAddress;
updateShopAddress(plAddress); updateShopAddress(plAddress);
});
}); });
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.siteSettings); .visit(urlList.siteSettings);
});
it("should change store name", { tags: ["@siteSettings", "@allEnv"] }, () => {
const name = `Cypress-${faker.datatype.number()}`;
cy.get(SITE_SETTINGS_DETAILS.nameInput)
.clearAndType(name)
.get(BUTTON_SELECTORS.confirm)
.click()
.confirmationMessageShouldDisappear();
getShopInfo().then(shopInfo => {
expect(shopInfo.name).to.eq(name);
}); });
});
it("should change store name", () => { it(
const name = `Cypress-${faker.datatype.number()}`; "should change store description",
{ tags: ["@siteSettings", "@allEnv"] },
cy.get(SITE_SETTINGS_DETAILS.nameInput) () => {
.clearAndType(name)
.get(BUTTON_SELECTORS.confirm)
.click()
.confirmationMessageShouldDisappear();
getShopInfo().then(shopInfo => {
expect(shopInfo.name).to.eq(name);
});
});
it("should change store description", () => {
const description = faker.lorem.sentence(); const description = faker.lorem.sentence();
cy.get(SITE_SETTINGS_DETAILS.descriptionInput) cy.get(SITE_SETTINGS_DETAILS.descriptionInput)
@ -55,9 +56,13 @@ filterTests({ definedTags: ["all"] }, () => {
getShopInfo().then(shopInfo => { getShopInfo().then(shopInfo => {
expect(shopInfo.description).to.eq(description); expect(shopInfo.description).to.eq(description);
}); });
}); }
);
it("should change store address", () => { it(
"should change store address",
{ tags: ["@siteSettings", "@allEnv"] },
() => {
cy.fillUpBasicAddress(address) cy.fillUpBasicAddress(address)
.get(BUTTON_SELECTORS.confirm) .get(BUTTON_SELECTORS.confirm)
.click() .click()
@ -66,6 +71,6 @@ filterTests({ definedTags: ["all"] }, () => {
expect(companyAddress.companyName).to.eq(address.companyName); expect(companyAddress.companyName).to.eq(address.companyName);
cy.expectCorrectBasicAddress(companyAddress, address); cy.expectCorrectBasicAddress(companyAddress, address);
}); });
}); }
}); );
}); });

View file

@ -19,51 +19,52 @@ import {
} 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";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Warehouse settings", () => {
describe("Warehouse settings", () => { const startsWith = "CyWarehouse";
const startsWith = "CyWarehouse"; let usAddress;
let usAddress; let secondUsAddress;
let secondUsAddress;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
cy.fixture("addresses").then(addresses => { cy.fixture("addresses").then(addresses => {
usAddress = addresses.usAddress; usAddress = addresses.usAddress;
secondUsAddress = addresses.secondUsAddress; secondUsAddress = addresses.secondUsAddress;
});
});
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
});
it("should create warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
const name = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.warehouses)
.get(WAREHOUSES_LIST.createNewButton)
.click()
.get(WAREHOUSES_DETAILS.nameInput)
.type(name)
.fillUpBasicAddress(usAddress)
.addAliasToGraphRequest("WarehouseCreate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@WarehouseCreate")
.its("response.body.data.createWarehouse.warehouse")
.then(warehouse => {
getWarehouse(warehouse.id);
})
.then(warehouse => {
const addressResp = warehouse.address;
expect(warehouse.name).to.be.eq(name);
cy.expectCorrectBasicAddress(addressResp, usAddress);
}); });
}); });
beforeEach(() => { it(
cy.clearSessionData().loginUserViaRequest(); "should add warehouse to shipping zone",
}); { tags: ["@warehouse", "@allEnv"] },
() => {
it("should create warehouse", () => {
const name = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.warehouses)
.get(WAREHOUSES_LIST.createNewButton)
.click()
.get(WAREHOUSES_DETAILS.nameInput)
.type(name)
.fillUpBasicAddress(usAddress)
.addAliasToGraphRequest("WarehouseCreate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@WarehouseCreate")
.its("response.body.data.createWarehouse.warehouse")
.then(warehouse => {
getWarehouse(warehouse.id);
})
.then(warehouse => {
const addressResp = warehouse.address;
chai.softExpect(warehouse.name).to.be.eq(name);
cy.expectCorrectBasicAddress(addressResp, usAddress);
});
});
it("should add warehouse to shipping zone", () => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
@ -99,26 +100,30 @@ filterTests({ definedTags: ["all"] }, () => {
shippingZone.id shippingZone.id
); );
}); });
}); }
);
it("should delete warehouse", () => { 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)
.click() .click()
.addAliasToGraphRequest("WarehouseDelete") .addAliasToGraphRequest("WarehouseDelete")
.get(BUTTON_SELECTORS.submit) .get(BUTTON_SELECTORS.submit)
.click() .click()
.waitForRequestAndCheckIfNoErrors("@WarehouseDelete"); .waitForRequestAndCheckIfNoErrors("@WarehouseDelete");
getWarehouse(warehouse.id).should("be.null"); getWarehouse(warehouse.id).should("be.null");
});
}); });
});
it("should remove warehouse from shipping zone", () => { it(
"should remove warehouse from shipping zone",
{ tags: ["@warehouse", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
@ -151,34 +156,34 @@ filterTests({ definedTags: ["all"] }, () => {
.then(warehouseResp => { .then(warehouseResp => {
expect(warehouseResp.shippingZones.edges).to.be.empty; expect(warehouseResp.shippingZones.edges).to.be.empty;
}); });
}); }
);
it("should update warehouse", () => { it("should update warehouse", { tags: ["@warehouse", "@allEnv"] }, () => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const updatedName = `${startsWith}${faker.datatype.number()}`; const updatedName = `${startsWith}${faker.datatype.number()}`;
let warehouse; let warehouse;
createWarehouseViaApi({ createWarehouseViaApi({
name, name,
address: usAddress address: usAddress
})
.then(warehouseResp => {
warehouse = warehouseResp;
cy.visit(warehouseDetailsUrl(warehouse.id))
.get(WAREHOUSES_DETAILS.nameInput)
.clearAndType(updatedName)
.fillUpBasicAddress(secondUsAddress)
.addAliasToGraphRequest("WarehouseUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@WarehouseUpdate");
getWarehouse(warehouse.id);
}) })
.then(warehouseResp => { .then(warehouseResp => {
warehouse = warehouseResp; const addressResp = warehouseResp.address;
cy.visit(warehouseDetailsUrl(warehouse.id)) expect(warehouseResp.name).to.be.eq(updatedName);
.get(WAREHOUSES_DETAILS.nameInput) cy.expectCorrectBasicAddress(addressResp, secondUsAddress);
.clearAndType(updatedName) });
.fillUpBasicAddress(secondUsAddress)
.addAliasToGraphRequest("WarehouseUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@WarehouseUpdate");
getWarehouse(warehouse.id);
})
.then(warehouseResp => {
const addressResp = warehouseResp.address;
chai.softExpect(warehouseResp.name).to.be.eq(updatedName);
cy.expectCorrectBasicAddress(addressResp, secondUsAddress);
});
});
}); });
}); });

View file

@ -29,32 +29,32 @@ describe("Tests for customer registration", () => {
}); });
}); });
filterTests({ definedTags: ["stagedOnly"] }, () => { it("should register customer", { tags: ["@customer", "@stagedOnly"] }, () => {
it("should register customer", () => { const email = `${startsWith}${faker.datatype.number()}@example.com`;
const email = `${startsWith}${faker.datatype.number()}@example.com`; customerRegistration({ email, channel: defaultChannel.slug });
customerRegistration({ email, channel: defaultChannel.slug }); getMailActivationLinkForUser(email)
getMailActivationLinkForUser(email) .then(urlLink => {
.then(urlLink => { const tokenRegex = /token=(.*)/;
const tokenRegex = /token=(.*)/; const token = urlLink.match(tokenRegex)[1];
const token = urlLink.match(tokenRegex)[1]; cy.clearSessionData();
cy.clearSessionData(); confirmAccount(email, token);
confirmAccount(email, token); })
}) .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 }) => { expect(errors.length).to.eq(0);
expect(errors.length).to.eq(0); expect(token).to.be.ok;
expect(token).to.be.ok; });
});
});
}); });
filterTests(["all"], () => { it(
it("shouldn't register customer with duplicated email", () => { "shouldn't register customer with duplicated email",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
const duplicatedEmail = Cypress.env("USER_NAME"); const duplicatedEmail = Cypress.env("USER_NAME");
customerRegistration({ customerRegistration({
duplicatedEmail, duplicatedEmail,
@ -63,9 +63,13 @@ describe("Tests for customer registration", () => {
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("should activate customer from dashboard", () => { it(
"should activate customer from dashboard",
{ tags: ["@customer", "@allEnv", "@stable"] },
() => {
customerRegistration({ email, channel: defaultChannel.slug }) customerRegistration({ email, channel: defaultChannel.slug })
.then(({ user }) => { .then(({ user }) => {
cy.clearSessionData() cy.clearSessionData()
@ -87,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;
}); });
}); }
}); );
}); });

View file

@ -25,67 +25,68 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../support/api/utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Create sale with assigned products", () => {
describe("Create sale with assigned products", () => { const startsWith = "CySales";
const startsWith = "CySales"; const saleValue = 10;
const saleValue = 10;
let channel; let channel;
let sale; let sale;
let warehouse; let warehouse;
let address; let address;
let productData; let productData;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteSalesStartsWith(startsWith); deleteSalesStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(defaultChannel => { .then(defaultChannel => {
channel = defaultChannel; channel = defaultChannel;
createSaleInChannel({ createSaleInChannel({
name: startsWith, name: startsWith,
type: "FIXED", type: "FIXED",
value: saleValue, value: saleValue,
channelId: channel.id channelId: channel.id
});
})
.then(saleResp => (sale = saleResp));
cy.fixture("addresses")
.then(addresses => {
address = addresses.usAddress;
createShipping({
channelId: channel.id,
address,
name: startsWith
});
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
}); });
createTypeAttributeAndCategoryForProduct({ })
name: startsWith, .then(saleResp => (sale = saleResp));
attributeValues: ["value1", "value2"] cy.fixture("addresses")
}).then(({ attribute, category, productType }) => { .then(addresses => {
productData = { address = addresses.usAddress;
attributeId: attribute.id, createShipping({
categoryId: category.id,
productTypeId: productType.id,
channelId: channel.id, channelId: channel.id,
warehouseId: warehouse.id, address,
price: 30 name: startsWith
}; });
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
}); });
createTypeAttributeAndCategoryForProduct({
name: startsWith,
attributeValues: ["value1", "value2"]
}).then(({ attribute, category, productType }) => {
productData = {
attributeId: attribute.id,
categoryId: category.id,
productTypeId: productType.id,
channelId: channel.id,
warehouseId: warehouse.id,
price: 30
};
}); });
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should discount only variants added to sale", () => { it(
"should discount only variants added to sale",
{ tags: ["@sales", "@allEnv", "@stable"] },
() => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
@ -132,52 +133,54 @@ filterTests({ definedTags: ["all"] }, () => {
productData.price - saleValue productData.price - saleValue
); );
}); });
}); }
);
it("should delete sale", () => { it("should delete sale", { tags: ["@sales", "@allEnv", "@stable"] }, () => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let variants; let variants;
let saleToDelete; let saleToDelete;
productData.name = name; productData.name = name;
productData.sku = name; productData.sku = name;
createProductInChannel(productData) createProductInChannel(productData)
.then(({ variantsList }) => { .then(({ variantsList }) => {
variants = variantsList; variants = variantsList;
createSaleInChannelWithProduct({ createSaleInChannelWithProduct({
name, name,
type: "FIXED", type: "FIXED",
value: saleValue, value: saleValue,
channelId: channel.id, channelId: channel.id,
variants variants
});
})
.then(saleResp => {
saleToDelete = saleResp;
getVariant(variants[0].id, channel.slug);
})
.then(variantResp => {
expect(variantResp.pricing.onSale).to.be.true;
expect(variantResp.pricing.price.gross.amount).to.eq(
productData.price - saleValue
);
cy.visit(saleDetailsUrl(saleToDelete.id))
.addAliasToGraphRequest("SaleDelete")
.get(BUTTON_SELECTORS.deleteButton)
.click()
.get(BUTTON_SELECTORS.submit)
.click()
.wait("@SaleDelete");
getVariant(variants[0].id, channel.slug);
})
.then(variantResp => {
expect(variantResp.pricing.onSale).to.be.false;
expect(variantResp.pricing.price.gross.amount).to.eq(
productData.price
);
}); });
}); })
.then(saleResp => {
saleToDelete = saleResp;
getVariant(variants[0].id, channel.slug);
})
.then(variantResp => {
expect(variantResp.pricing.onSale).to.be.true;
expect(variantResp.pricing.price.gross.amount).to.eq(
productData.price - saleValue
);
cy.visit(saleDetailsUrl(saleToDelete.id))
.addAliasToGraphRequest("SaleDelete")
.get(BUTTON_SELECTORS.deleteButton)
.click()
.get(BUTTON_SELECTORS.submit)
.click()
.wait("@SaleDelete");
getVariant(variants[0].id, channel.slug);
})
.then(variantResp => {
expect(variantResp.pricing.onSale).to.be.false;
expect(variantResp.pricing.price.gross.amount).to.eq(productData.price);
});
});
xit("should remove variant from sale", () => { xit(
"should remove variant from sale",
{ tags: ["@sales", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
let product; let product;
let variants; let variants;
@ -216,6 +219,6 @@ filterTests({ definedTags: ["all"] }, () => {
productData.price productData.price
); );
}); });
}); }
}); );
}); });

View file

@ -14,7 +14,6 @@ import {
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 filterTests from "../../support/filterTests";
import { import {
assignProducts, assignProducts,
createSale, createSale,
@ -22,61 +21,63 @@ import {
discountOptions discountOptions
} from "../../support/pages/discounts/salesPage"; } from "../../support/pages/discounts/salesPage";
filterTests({ definedTags: ["all"] }, () => { xdescribe("Sales discounts for products", () => {
xdescribe("Sales discounts for products", () => { const startsWith = "CySales-";
const startsWith = "CySales-";
let productType; let productType;
let attribute; let attribute;
let category; let category;
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
channelsUtils.deleteChannelsStartsWith(startsWith); channelsUtils.deleteChannelsStartsWith(startsWith);
deleteSalesStartsWith(startsWith); deleteSalesStartsWith(startsWith);
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name }) .createTypeAttributeAndCategoryForProduct({ name })
.then( .then(
({ ({
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;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addresses => { .then(addresses => {
createShipping({ createShipping({
channelId: defaultChannel.id, channelId: defaultChannel.id,
name, name,
address: addresses.plAddress, address: addresses.plAddress,
price: 100 price: 100
});
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
}); });
}); })
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should create percentage discount", () => { it(
"should create percentage discount",
{ tags: ["@sales", "@allEnv"] },
() => {
const saleName = `${startsWith}${faker.datatype.number()}`; const saleName = `${startsWith}${faker.datatype.number()}`;
const discountValue = 50; const discountValue = 50;
const productPrice = 100; const productPrice = 100;
@ -95,9 +96,13 @@ filterTests({ definedTags: ["all"] }, () => {
const expectedPrice = (productPrice * discountValue) / 100; const expectedPrice = (productPrice * discountValue) / 100;
expect(expectedPrice).to.be.eq(price); expect(expectedPrice).to.be.eq(price);
}); });
}); }
);
it("should create fixed price discount", () => { it(
"should create fixed price discount",
{ tags: ["@sales", "@allEnv"] },
() => {
const saleName = `${startsWith}${faker.datatype.number()}`; const saleName = `${startsWith}${faker.datatype.number()}`;
const discountValue = 50; const discountValue = 50;
const productPrice = 100; const productPrice = 100;
@ -116,9 +121,13 @@ filterTests({ definedTags: ["all"] }, () => {
const expectedPrice = productPrice - discountValue; const expectedPrice = productPrice - discountValue;
expect(expectedPrice).to.be.eq(price); expect(expectedPrice).to.be.eq(price);
}); });
}); }
);
it("should not displayed discount not assign to channel", () => { it(
"should not displayed discount not assign to channel",
{ tags: ["@sales", "@allEnv"] },
() => {
const saleName = `${startsWith}${faker.datatype.number()}`; const saleName = `${startsWith}${faker.datatype.number()}`;
let channel; let channel;
let product; let product;
@ -152,7 +161,7 @@ filterTests({ definedTags: ["all"] }, () => {
*/ */
cy.visit(urlList.sales); cy.visit(urlList.sales);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
createSale({ createSale({
saleName, saleName,
channelName: channel.name, channelName: channel.name,
@ -162,6 +171,6 @@ filterTests({ definedTags: ["all"] }, () => {
getProductPrice(product.id, defaultChannel.slug); getProductPrice(product.id, defaultChannel.slug);
}) })
.then(price => expect(price).to.equal(productPrice)); .then(price => expect(price).to.equal(productPrice));
}); }
}); );
}); });

View file

@ -10,66 +10,67 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../support/api/utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
import { import {
createSaleWithNewVariant, createSaleWithNewVariant,
discountOptions discountOptions
} from "../../support/pages/discounts/salesPage"; } from "../../support/pages/discounts/salesPage";
filterTests({ definedTags: ["all"] }, () => { xdescribe("Sales discounts for variant", () => {
xdescribe("Sales discounts for variant", () => { const startsWith = "CySales-";
const startsWith = "CySales-";
let productType; let productType;
let attribute; let attribute;
let category; let category;
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteSalesStartsWith(startsWith); deleteSalesStartsWith(startsWith);
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name }) .createTypeAttributeAndCategoryForProduct({ name })
.then( .then(
({ ({
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;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addresses => { .then(addresses => {
createShipping({ createShipping({
channelId: defaultChannel.id, channelId: defaultChannel.id,
name, name,
address: addresses.plAddress, address: addresses.plAddress,
price: 100 price: 100
});
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
}); });
}); })
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should create percentage discount", () => { it(
"should create percentage discount",
{ tags: ["@sales", "@allEnv"] },
() => {
const saleName = `${startsWith}${faker.datatype.number()}`; const saleName = `${startsWith}${faker.datatype.number()}`;
const discountValue = 50; const discountValue = 50;
const productPrice = 100; const productPrice = 100;
@ -89,9 +90,13 @@ filterTests({ definedTags: ["all"] }, () => {
const expectedPrice = (productPrice * discountValue) / 100; const expectedPrice = (productPrice * discountValue) / 100;
expect(expectedPrice).to.be.eq(priceInResponse); expect(expectedPrice).to.be.eq(priceInResponse);
}); });
}); }
);
it("should create fixed price discount", () => { it(
"should create fixed price discount",
{ tags: ["@sales", "@allEnv"] },
() => {
const saleName = `${startsWith}${faker.datatype.number()}`; const saleName = `${startsWith}${faker.datatype.number()}`;
const discountValue = 50; const discountValue = 50;
const productPrice = 100; const productPrice = 100;
@ -111,6 +116,6 @@ filterTests({ definedTags: ["all"] }, () => {
const expectedPrice = productPrice - discountValue; const expectedPrice = productPrice - discountValue;
expect(expectedPrice).to.be.eq(priceInResponse); expect(expectedPrice).to.be.eq(priceInResponse);
}); });
}); }
}); );
}); });

View file

@ -20,53 +20,55 @@ import {
loginAndCreateCheckoutForVoucherWithDiscount loginAndCreateCheckoutForVoucherWithDiscount
} from "../../../support/pages/discounts/vouchersPage"; } from "../../../support/pages/discounts/vouchersPage";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to create voucher", () => {
describe("As an admin I want to create voucher", () => { const startsWith = "CyVou-";
const startsWith = "CyVou-"; const productPrice = 100;
const productPrice = 100; const shippingPrice = 100;
const shippingPrice = 100;
let defaultChannel; let defaultChannel;
let createdChannel; let createdChannel;
let shippingMethod; let shippingMethod;
let variants; let variants;
let address; let address;
let dataForCheckout; let dataForCheckout;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
channelsUtils.deleteChannelsStartsWith(startsWith); channelsUtils.deleteChannelsStartsWith(startsWith);
deleteVouchersStartsWith(startsWith); deleteVouchersStartsWith(startsWith);
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
.createProductWithShipping({ name, productPrice, shippingPrice }) .createProductWithShipping({ name, productPrice, shippingPrice })
.then( .then(
({ ({
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;
dataForCheckout = { dataForCheckout = {
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
variantsList: variants, variantsList: variants,
address, address,
shippingMethodName: shippingMethod.name, shippingMethodName: shippingMethod.name,
auth: "token" auth: "token"
}; };
}); });
}); });
it("should be able to create fixed price voucher. TC: SALEOR_1901", () => { it(
"should be able to create fixed price voucher. TC: SALEOR_1901",
{ tags: ["@vouchers", "@allEnv", "@stable"] },
() => {
const voucherValue = 50; const voucherValue = 50;
const voucherCode = `${startsWith}${faker.datatype.number()}`; const voucherCode = `${startsWith}${faker.datatype.number()}`;
const expectedAmount = productPrice + shippingPrice - voucherValue; const expectedAmount = productPrice + shippingPrice - voucherValue;
@ -93,9 +95,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ order }) => { .then(({ order }) => {
expect(order.id).to.be.ok; expect(order.id).to.be.ok;
}); });
}); }
);
it("should be able to create percentage voucher. TC: SALEOR_1902", () => { it(
"should be able to create percentage voucher. TC: SALEOR_1902",
{ tags: ["@vouchers", "@allEnv", "@stable"] },
() => {
const voucherValue = 50; const voucherValue = 50;
const voucherCode = `${startsWith}${faker.datatype.number()}`; const voucherCode = `${startsWith}${faker.datatype.number()}`;
const expectedAmount = const expectedAmount =
@ -123,9 +129,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ order }) => { .then(({ order }) => {
expect(order.id).to.be.ok; expect(order.id).to.be.ok;
}); });
}); }
);
it("should be able to create free shipping voucher. TC: SALEOR_1903", () => { it(
"should be able to create free shipping voucher. TC: SALEOR_1903",
{ tags: ["@vouchers", "@allEnv", "@stable"] },
() => {
const voucherCode = `${startsWith}${faker.datatype.number()}`; const voucherCode = `${startsWith}${faker.datatype.number()}`;
const expectedAmount = productPrice; const expectedAmount = productPrice;
let checkout; let checkout;
@ -150,16 +160,20 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ order }) => { .then(({ order }) => {
expect(order.id).to.be.ok; expect(order.id).to.be.ok;
}); });
}); }
);
it("should be able to create voucher not available for selected channel. TC: SALEOR_1904", () => { it(
"should be able to create voucher not available for selected channel. TC: SALEOR_1904",
{ tags: ["@vouchers", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.vouchers); .visit(urlList.vouchers);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
createVoucher({ createVoucher({
voucherCode: randomName, voucherCode: randomName,
voucherValue, voucherValue,
@ -173,6 +187,6 @@ filterTests({ definedTags: ["all"] }, () => {
expect(errorField).to.be.eq("promoCode"); expect(errorField).to.be.eq("promoCode");
} }
); );
}); }
}); );
}); });

View file

@ -11,54 +11,55 @@ 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 filterTests from "../../../support/filterTests";
import { import {
discountOptions, discountOptions,
loginAndCreateCheckoutForVoucherWithDiscount loginAndCreateCheckoutForVoucherWithDiscount
} from "../../../support/pages/discounts/vouchersPage"; } from "../../../support/pages/discounts/vouchersPage";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to create voucher", () => {
describe("As an admin I want to create voucher", () => { const startsWith = "CyVou-";
const startsWith = "CyVou-"; const productPrice = 100;
const productPrice = 100; const shippingPrice = 100;
const shippingPrice = 100;
let defaultChannel; let defaultChannel;
let shippingMethod; let shippingMethod;
let variants; let variants;
let address; let address;
let dataForCheckout; let dataForCheckout;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
channelsUtils.deleteChannelsStartsWith(startsWith); channelsUtils.deleteChannelsStartsWith(startsWith);
deleteVouchersStartsWith(startsWith); deleteVouchersStartsWith(startsWith);
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
.createProductWithShipping({ name, productPrice, shippingPrice }) .createProductWithShipping({ name, productPrice, shippingPrice })
.then( .then(
({ ({
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;
dataForCheckout = { dataForCheckout = {
channelSlug: defaultChannel.slug, channelSlug: defaultChannel.slug,
variantsList: variants, variantsList: variants,
address, address,
shippingMethodName: shippingMethod.name, shippingMethodName: shippingMethod.name,
auth: "token" auth: "token"
}; };
} }
); );
}); });
it("should be able to create voucher with limited number of times discount can be used in total. TC: SALEOR_1907", () => { it(
"should be able to create voucher with limited number of times discount can be used in total. TC: SALEOR_1907",
{ tags: ["@vouchers", "@allEnv", "@stable"] },
() => {
const voucherCode = `${startsWith}${faker.datatype.number()}`; const voucherCode = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
const usageLimit = 1; const usageLimit = 1;
@ -90,9 +91,13 @@ filterTests({ definedTags: ["all"] }, () => {
"promoCode" "promoCode"
); );
}); });
}); }
);
it("should be able to create voucher with limit to one use per customer. TC: SALEOR_1908", () => { it(
"should be able to create voucher with limit to one use per customer. TC: SALEOR_1908",
{ tags: ["@vouchers", "@allEnv", "@stable"] },
() => {
const voucherCode = `${startsWith}${faker.datatype.number()}`; const voucherCode = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
dataForCheckout.auth = "token"; dataForCheckout.auth = "token";
@ -135,9 +140,13 @@ filterTests({ definedTags: ["all"] }, () => {
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 be able to create voucher with limit to staff only. TC: SALEOR_1909", () => { xit(
"should be able to create voucher with limit to staff only. TC: SALEOR_1909",
{ tags: ["@vouchers", "@allEnv"] },
() => {
const voucherCode = `${startsWith}${faker.datatype.number()}`; const voucherCode = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
dataForCheckout.auth = "auth"; dataForCheckout.auth = "auth";
@ -170,9 +179,13 @@ filterTests({ definedTags: ["all"] }, () => {
"promoCode" "promoCode"
); );
}); });
}); }
);
xit("should be able to create voucher with minimum value of order. TC: SALEOR_1910", () => { xit(
"should be able to create voucher with minimum value of order. TC: SALEOR_1910",
{ tags: ["@vouchers", "@allEnv"] },
() => {
const voucherCode = `${startsWith}${faker.datatype.number()}`; const voucherCode = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
const minOrderValue = productPrice * 1.5; const minOrderValue = productPrice * 1.5;
@ -200,36 +213,36 @@ filterTests({ definedTags: ["all"] }, () => {
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", () => {
const voucherCode = `${startsWith}${faker.datatype.number()}`; const voucherCode = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
const minAmountOfItems = 2; const minAmountOfItems = 2;
dataForCheckout.productQuantity = 1; dataForCheckout.productQuantity = 1;
loginAndCreateCheckoutForVoucherWithDiscount({ loginAndCreateCheckoutForVoucherWithDiscount({
discount: discountOptions.PERCENTAGE, discount: discountOptions.PERCENTAGE,
voucherValue, voucherValue,
voucherCode, voucherCode,
channelName: defaultChannel.name, channelName: defaultChannel.name,
dataForCheckout, dataForCheckout,
minAmountOfItems minAmountOfItems
})
.then(({ addPromoCodeResp }) => {
const errorField = addPromoCodeResp.errors[0].field;
dataForCheckout.voucherCode = voucherCode;
expect(errorField, "error in promo code should occur").to.be.eq(
"promoCode"
);
dataForCheckout.productQuantity = 2;
createCheckoutWithVoucher(dataForCheckout);
}) })
.then(({ addPromoCodeResp }) => { .then(({ addPromoCodeResp }) => {
const errorField = addPromoCodeResp.errors[0].field; const errorField = addPromoCodeResp.errors;
dataForCheckout.voucherCode = voucherCode; expect(errorField, "No errors when adding promo code").to.be.empty;
});
expect(errorField, "error in promo code should occur").to.be.eq(
"promoCode"
);
dataForCheckout.productQuantity = 2;
createCheckoutWithVoucher(dataForCheckout);
})
.then(({ addPromoCodeResp }) => {
const errorField = addPromoCodeResp.errors;
expect(errorField, "No errors when adding promo code").to.be.empty;
});
});
}); });
}); });

View file

@ -12,49 +12,50 @@ import {
} 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";
import filterTests from "../../../support/filterTests";
import { formatDate, formatTime } from "../../../support/formatData/formatDate"; import { formatDate, formatTime } from "../../../support/formatData/formatDate";
import { setVoucherDate } from "../../../support/pages/discounts/vouchersPage"; import { setVoucherDate } from "../../../support/pages/discounts/vouchersPage";
filterTests({ definedTags: ["all"] }, () => { describe("As an admin I want to update vouchers", () => {
describe("As an admin I want to update vouchers", () => { const startsWith = "CyVou-";
const startsWith = "CyVou-"; const productPrice = 100;
const productPrice = 100; const shippingPrice = 100;
const shippingPrice = 100;
let defaultChannel; let defaultChannel;
let product; let product;
let dataForCheckout; let dataForCheckout;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteVouchersStartsWith(startsWith); deleteVouchersStartsWith(startsWith);
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
.createProductWithShipping({ name, productPrice, shippingPrice }) .createProductWithShipping({ name, productPrice, shippingPrice })
.then( .then(
({ ({
variantsList: variantsResp,
defaultChannel: channel,
shippingMethod: shippingMethodResp,
address: addressResp,
product: productResp
}) => {
defaultChannel = channel;
product = productResp;
dataForCheckout = {
channelSlug: defaultChannel.slug,
variantsList: variantsResp, variantsList: variantsResp,
defaultChannel: channel,
shippingMethod: shippingMethodResp,
address: addressResp, address: addressResp,
product: productResp shippingMethodName: shippingMethodResp.name,
}) => { auth: "token"
defaultChannel = channel; };
product = productResp; }
);
});
dataForCheckout = { it(
channelSlug: defaultChannel.slug, "should delete voucher. TC: SALEOR_1905",
variantsList: variantsResp, { tags: ["@vouchers", "@allEnv"] },
address: addressResp, () => {
shippingMethodName: shippingMethodResp.name,
auth: "token"
};
}
);
});
it("should delete voucher. TC: SALEOR_1905", () => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
@ -84,9 +85,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should update voucher. TC: SALEOR_1906", () => { it(
"should update voucher. TC: SALEOR_1906",
{ tags: ["@vouchers", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
const voucherUpdatedValue = 20; const voucherUpdatedValue = 20;
@ -123,9 +128,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should set date on voucher. TC: SALEOR_1912", () => { it(
"should set date on voucher. TC: SALEOR_1912",
{ tags: ["@vouchers", "@allEnv", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
const today = new Date(); const today = new Date();
@ -159,9 +168,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ addPromoCodeResp }) => { .then(({ addPromoCodeResp }) => {
expect(addPromoCodeResp.errors).to.be.empty; expect(addPromoCodeResp.errors).to.be.empty;
}); });
}); }
);
it("should set end date on voucher. TC: SALEOR_1913", () => { it(
"should set end date on voucher. TC: SALEOR_1913",
{ tags: ["@vouchers", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
const today = new Date(); const today = new Date();
@ -204,9 +217,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ addPromoCodeResp }) => { .then(({ addPromoCodeResp }) => {
expect(addPromoCodeResp.errors).to.be.empty; expect(addPromoCodeResp.errors).to.be.empty;
}); });
}); }
);
it("should set country on voucher. TC: SALEOR_1914", () => { it(
"should set country on voucher. TC: SALEOR_1914",
{ tags: ["@vouchers", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const voucherValue = 50; const voucherValue = 50;
@ -251,6 +268,6 @@ filterTests({ definedTags: ["all"] }, () => {
const errorField = addPromoCodeResp.errors[0].field; const errorField = addPromoCodeResp.errors[0].field;
expect(errorField).to.be.eq("promoCode"); expect(errorField).to.be.eq("promoCode");
}); });
}); }
}); );
}); });

View file

@ -3,24 +3,33 @@
import { urlList } from "../../fixtures/urlList"; import { urlList } from "../../fixtures/urlList";
import { TEST_ADMIN_USER, USER_WITHOUT_NAME } from "../../fixtures/users"; import { TEST_ADMIN_USER, USER_WITHOUT_NAME } from "../../fixtures/users";
import filterTests from "../../support/filterTests";
import { expectWelcomeMessageIncludes } from "../../support/pages/homePage"; import { expectWelcomeMessageIncludes } from "../../support/pages/homePage";
filterTests({ definedTags: ["all"] }, () => { describe("Displaying welcome message on home page", () => {
describe("Displaying welcome message on home page", () => { it(
it("should display user name on home page", () => { "should display user name on home page",
{ tags: ["@homePage", "@allEnv", "@stable"] },
() => {
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("should display user email on home page", () => { it(
"should display user email on home page",
{ tags: ["@homePage", "@allEnv", "@stable"] },
() => {
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("should refresh page without errors", () => { it(
"should refresh page without errors",
{ tags: ["@homePage", "@allEnv", "@stable"] },
() => {
cy.loginUserViaRequest() cy.loginUserViaRequest()
.visit(urlList.homePage) .visit(urlList.homePage)
.waitForProgressBarToNotExist() .waitForProgressBarToNotExist()
@ -28,6 +37,6 @@ filterTests({ definedTags: ["all"] }, () => {
expectWelcomeMessageIncludes( expectWelcomeMessageIncludes(
`${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}` `${TEST_ADMIN_USER.name} ${TEST_ADMIN_USER.lastName}`
); );
}); }
}); );
}); });

View file

@ -22,133 +22,133 @@ import {
getTodaysOrdersRegex getTodaysOrdersRegex
} from "../../support/pages/homePage"; } from "../../support/pages/homePage";
filterTests({ definedTags: ["all", "critical", "refactored"] }, () => { 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", () => { const startsWith = "CyHomeAnalytics";
const startsWith = "CyHomeAnalytics"; const productPrice = 22;
const productPrice = 22; const shippingPrice = 12;
const shippingPrice = 12; const randomName = startsWith + faker.datatype.number();
const randomName = startsWith + faker.datatype.number(); const randomEmail = `${startsWith}${randomName}@example.com`;
const randomEmail = `${startsWith}${randomName}@example.com`;
let customer; let customer;
let defaultChannel; let defaultChannel;
let createdVariants; let createdVariants;
let productType; let productType;
let attribute; let attribute;
let category; let category;
let warehouse; let warehouse;
let shippingMethod; let shippingMethod;
let address; let address;
let ordersReadyToFulfillRegexp; let ordersReadyToFulfillRegexp;
let ordersReadyForCaptureRegexp; let ordersReadyForCaptureRegexp;
let productsOutOfStockRegexp; let productsOutOfStockRegexp;
let salesAmountRegexp; let salesAmountRegexp;
let ordersRegexp; let ordersRegexp;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
productsUtils productsUtils
.createProductWithShipping({ .createProductWithShipping({
name: randomName, name: randomName,
productPrice, productPrice,
shippingPrice, shippingPrice,
newChannel: true newChannel: true
}) })
.then(resp => { .then(resp => {
createdVariants = resp.variantsList; createdVariants = resp.variantsList;
address = resp.address; address = resp.address;
warehouse = resp.warehouse; warehouse = resp.warehouse;
defaultChannel = resp.defaultChannel; defaultChannel = resp.defaultChannel;
shippingMethod = resp.shippingMethod; shippingMethod = resp.shippingMethod;
attribute = resp.attribute; attribute = resp.attribute;
category = resp.category; category = resp.category;
productType = resp.productType; productType = resp.productType;
createCustomer(randomEmail, randomName, address).then( createCustomer(randomEmail, randomName, address).then(
customerResp => (customer = customerResp) customerResp => (customer = customerResp)
);
homePageUtils
.getOrdersReadyToFulfill(defaultChannel.slug)
.then(ordersReadyToFulfillBefore => {
ordersReadyToFulfillRegexp = getOrdersReadyToFulfillRegex(
ordersReadyToFulfillBefore,
1
);
});
homePageUtils
.getOrdersReadyForCapture(defaultChannel.slug)
.then(ordersReadyForCaptureBefore => {
ordersReadyForCaptureRegexp = getOrdersReadyForCaptureRegex(
ordersReadyForCaptureBefore,
1
);
});
homePageUtils
.getProductsOutOfStock(defaultChannel.slug)
.then(productsOutOfStockBefore => {
productsOutOfStockRegexp = getProductsOutOfStockRegex(
productsOutOfStockBefore,
1
);
});
homePageUtils.getSalesAmount(defaultChannel.slug).then(salesAmount => {
salesAmountRegexp = getSalesAmountRegex(
salesAmount,
productPrice * 2 + shippingPrice
); );
homePageUtils
.getOrdersReadyToFulfill(defaultChannel.slug)
.then(ordersReadyToFulfillBefore => {
ordersReadyToFulfillRegexp = getOrdersReadyToFulfillRegex(
ordersReadyToFulfillBefore,
1
);
});
homePageUtils
.getOrdersReadyForCapture(defaultChannel.slug)
.then(ordersReadyForCaptureBefore => {
ordersReadyForCaptureRegexp = getOrdersReadyForCaptureRegex(
ordersReadyForCaptureBefore,
1
);
});
homePageUtils
.getProductsOutOfStock(defaultChannel.slug)
.then(productsOutOfStockBefore => {
productsOutOfStockRegexp = getProductsOutOfStockRegex(
productsOutOfStockBefore,
1
);
});
homePageUtils
.getSalesAmount(defaultChannel.slug)
.then(salesAmount => {
salesAmountRegexp = getSalesAmountRegex(
salesAmount,
productPrice * 2 + shippingPrice
);
});
homePageUtils
.getTodaysOrders(defaultChannel.slug)
.then(ordersBefore => {
ordersRegexp = getTodaysOrdersRegex(ordersBefore, 2);
});
})
.then(() => {
createReadyToFulfillOrder({
customerId: customer.id,
shippingMethodId: shippingMethod.id,
channelId: defaultChannel.id,
variantsList: createdVariants,
address
});
createWaitingForCaptureOrder({
channelSlug: defaultChannel.slug,
email: randomEmail,
variantsList: createdVariants,
shippingMethodName: shippingMethod.name,
address
});
const productOutOfStockRandomName =
startsWith + faker.datatype.number();
productsUtils.createProductInChannel({
name: productOutOfStockRandomName,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
quantityInWarehouse: 0,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
price: productPrice
});
}); });
});
beforeEach(() => { homePageUtils
cy.clearSessionData().loginUserViaRequest(); .getTodaysOrders(defaultChannel.slug)
}); .then(ordersBefore => {
ordersRegexp = getTodaysOrdersRegex(ordersBefore, 2);
});
})
.then(() => {
createReadyToFulfillOrder({
customerId: customer.id,
shippingMethodId: shippingMethod.id,
channelId: defaultChannel.id,
variantsList: createdVariants,
address
});
it("should display correct information on dashboard home page. SALEOR_2004", () => { createWaitingForCaptureOrder({
channelSlug: defaultChannel.slug,
email: randomEmail,
variantsList: createdVariants,
shippingMethodName: shippingMethod.name,
address
});
const productOutOfStockRandomName =
startsWith + faker.datatype.number();
productsUtils.createProductInChannel({
name: productOutOfStockRandomName,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
quantityInWarehouse: 0,
productTypeId: productType.id,
attributeId: attribute.id,
categoryId: category.id,
price: productPrice
});
});
});
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
});
it(
"should display correct information on dashboard home page. SALEOR_2004",
{ tags: ["@homePage", "@allEnv"] },
() => {
cy.visit(urlList.homePage); cy.visit(urlList.homePage);
changeChannel(defaultChannel.name); changeChannel(defaultChannel.name);
cy.contains(HOMEPAGE_SELECTORS.orders, ordersRegexp).should("be.visible"); cy.contains(HOMEPAGE_SELECTORS.orders, ordersRegexp).should("be.visible");
@ -167,6 +167,6 @@ filterTests({ definedTags: ["all", "critical", "refactored"] }, () => {
HOMEPAGE_SELECTORS.productsOutOfStock, HOMEPAGE_SELECTORS.productsOutOfStock,
productsOutOfStockRegexp productsOutOfStockRegexp
).should("be.visible"); ).should("be.visible");
}); }
}); );
}); });

View file

@ -2,23 +2,28 @@
/// <reference types="../support"/> /// <reference types="../support"/>
import { LOGIN_SELECTORS } from "../elements/account/login-selectors"; import { LOGIN_SELECTORS } from "../elements/account/login-selectors";
import { HOMEPAGE_SELECTORS } from "../elements/homePage/homePage-selectors";
import { urlList } from "../fixtures/urlList"; import { urlList } from "../fixtures/urlList";
import filterTests from "../support/filterTests"; import filterTests from "../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("User authorization", () => {
describe("User authorization", () => { beforeEach(() => {
beforeEach(() => { cy.clearSessionData();
cy.clearSessionData(); });
});
it("should successfully log in an user", () => { it(
"should successfully log in an user",
{ tags: ["@login", "@allEnv", "@stable"] },
() => {
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("should fail for wrong password", () => { it(
"should fail for wrong password",
{ tags: ["@login", "@allEnv", "@stable"] },
() => {
cy.visit(urlList.homePage) cy.visit(urlList.homePage)
.get(LOGIN_SELECTORS.emailAddressInput) .get(LOGIN_SELECTORS.emailAddressInput)
.type("admin@example.com") .type("admin@example.com")
@ -28,9 +33,13 @@ filterTests({ definedTags: ["all"] }, () => {
.click() .click()
.get(LOGIN_SELECTORS.warningCredentialMessage) .get(LOGIN_SELECTORS.warningCredentialMessage)
.should("be.visible"); .should("be.visible");
}); }
);
it("should successfully log out an user", () => { it(
"should successfully log out an user",
{ tags: ["@login", "@allEnv", "@stable"] },
() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.homePage) .visit(urlList.homePage)
@ -40,6 +49,6 @@ filterTests({ definedTags: ["all"] }, () => {
.click() .click()
.get(LOGIN_SELECTORS.emailAddressInput) .get(LOGIN_SELECTORS.emailAddressInput)
.should("be.visible"); .should("be.visible");
}); }
}); );
}); });

View file

@ -14,39 +14,40 @@ import {
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../support/api/utils/products/productsUtils"; } from "../support/api/utils/products/productsUtils";
import filterTests from "../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Test for metadata", () => {
describe("Test for metadata", () => { const startsWith = "Metadata";
const startsWith = "Metadata"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; const metadata = { key: "metadataKey", value: "metadataValue" };
const metadata = { key: "metadataKey", value: "metadataValue" }; let channel;
let channel; let product;
let product;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(channelResp => { .then(channelResp => {
channel = channelResp; channel = channelResp;
createTypeAttributeAndCategoryForProduct({ name }); createTypeAttributeAndCategoryForProduct({ name });
}) })
.then(({ attribute, category, productType }) => { .then(({ attribute, category, productType }) => {
createProductInChannel({ createProductInChannel({
attributeId: attribute.id, attributeId: attribute.id,
categoryId: category.id, categoryId: category.id,
channelId: channel.id, channelId: channel.id,
name, name,
productTypeId: productType.id productTypeId: productType.id
});
})
.then(({ product: productResp }) => {
product = productResp;
}); });
}); })
.then(({ product: productResp }) => {
product = productResp;
});
});
it("should create metadata for product", () => { it(
"should create metadata for product",
{ tags: ["@metadata", "@allEnv", "@stable"] },
() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
updateMetadata(product.id, metadata.key, metadata.value); updateMetadata(product.id, metadata.key, metadata.value);
updatePrivateMetadata(product.id, metadata.key, metadata.value) updatePrivateMetadata(product.id, metadata.key, metadata.value)
@ -83,8 +84,12 @@ filterTests({ definedTags: ["all"] }, () => {
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("should create metadata for order", () => { );
it(
"should create metadata for order",
{ tags: ["@metadata", "@allEnv", "@stable"] },
() => {
let order; let order;
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
createDraftOrder({ channelId: channel.id }) createDraftOrder({ channelId: channel.id })
@ -102,6 +107,6 @@ filterTests({ definedTags: ["all"] }, () => {
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);
}); });
}); }
}); );
}); });

View file

@ -7,7 +7,6 @@ import {
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 filterTests from "../support/filterTests";
import * as permissionsSteps from "../support/pages/permissionsPage"; import * as permissionsSteps from "../support/pages/permissionsPage";
describe("As a staff user I want to navigate through shop using different permissions", () => { describe("As a staff user I want to navigate through shop using different permissions", () => {
@ -45,50 +44,61 @@ describe("As a staff user I want to navigate through shop using different permis
}); });
Object.keys(permissionsOptions).forEach(key => { Object.keys(permissionsOptions).forEach(key => {
const tags = if (key !== "all") {
key === "all" ? ["critical", "all", "refactored"] : ["all", "refactored"]; it(
filterTests({ definedTags: tags }, () => { `should be able to navigate through shop as a staff member using ${key} permission. ${permissionsOptions[key].testCase}`,
it(`should be able to navigate through shop as a staff member using ${key} permission. ${permissionsOptions[key].testCase}`, () => { { tags: ["@allEnv", "@navigation"] },
const permissionOption = permissionsOptions[key]; () => {
const permissions = permissionOption.permissions; const permissionOption = permissionsOptions[key];
cy.clearSessionData(); const permissions = permissionOption.permissions;
permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed( cy.clearSessionData();
permissionOption permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed(
); permissionOption
if (key === "all") { );
return; permissionsSteps
} .getDisplayedSelectors()
permissionsSteps .then(selectors => {
.getDisplayedSelectors() permissionsSteps.expectAllSelectorsPermitted(
.then(selectors => { permissions,
permissionsSteps.expectAllSelectorsPermitted( selectors
permissions, );
selectors })
); .then(() => {
}) if (!permissions) {
.then(() => { return;
if (!permissions) {
return;
}
permissions.forEach(permission => {
if (permission.parent) {
cy.get(permission.parent.parentMenuSelector)
.click()
.then(() => {
permissionsSteps.getDisplayedSelectors(
permission.parent.parentSelectors
);
})
.then(parentSelectors => {
permissionsSteps.expectAllSelectorsPermitted(
permissions,
parentSelectors
);
});
} }
permissions.forEach(permission => {
if (permission.parent) {
cy.get(permission.parent.parentMenuSelector)
.click()
.then(() => {
permissionsSteps.getDisplayedSelectors(
permission.parent.parentSelectors
);
})
.then(parentSelectors => {
permissionsSteps.expectAllSelectorsPermitted(
permissions,
parentSelectors
);
});
}
});
}); });
}); }
}); );
}); }
}); });
it(
`should be able to navigate through shop as a staff member using all permissions. ${permissionsOptions.all.testCase}`,
{ tags: ["@critical", "@allEnv", "@navigation", "@stable"] },
() => {
const permissionOption = permissionsOptions.all;
cy.clearSessionData();
permissionsSteps.navigateToAllAvailablePageAndCheckIfDisplayed(
permissionOption
);
}
);
}); });

View file

@ -10,39 +10,40 @@ import { ORDERS_SELECTORS } from "../../elements/orders/orders-selectors";
import { urlList } from "../../fixtures/urlList"; import { urlList } from "../../fixtures/urlList";
import { createChannel } from "../../support/api/requests/Channels"; import { createChannel } from "../../support/api/requests/Channels";
import * as channelsUtils from "../../support/api/utils/channelsUtils"; import * as channelsUtils from "../../support/api/utils/channelsUtils";
import filterTests from "../../support/filterTests";
import { import {
selectChannelInHeader, selectChannelInHeader,
selectChannelInPicker selectChannelInPicker
} from "../../support/pages/channelsPage"; } from "../../support/pages/channelsPage";
filterTests({ definedTags: ["all"] }, () => { xdescribe("Channels in draft orders", () => {
xdescribe("Channels in draft orders", () => { const startsWith = "CyChannelInDraftOrders-";
const startsWith = "CyChannelInDraftOrders-"; const randomName = startsWith + faker.datatype.number();
const randomName = startsWith + faker.datatype.number();
let defaultChannel; let defaultChannel;
let otherChannel; let otherChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
channelsUtils.deleteChannelsStartsWith(startsWith); channelsUtils.deleteChannelsStartsWith(startsWith);
channelsUtils channelsUtils
.getDefaultChannel() .getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
createChannel({ name: randomName }); createChannel({ name: randomName });
}) })
.then(channelResp => { .then(channelResp => {
otherChannel = channelResp; otherChannel = channelResp;
}); });
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("Draft order channel should be taken from global channel picker", () => { it(
"Draft order channel should be taken from global channel picker",
{ tags: ["@orders", "@allEnv"] },
() => {
let channelName; let channelName;
cy.visit(urlList.homePage); cy.visit(urlList.homePage);
cy.getTextFromElement(HEADER_SELECTORS.channelSelect).then( cy.getTextFromElement(HEADER_SELECTORS.channelSelect).then(
@ -64,9 +65,13 @@ filterTests({ definedTags: ["all"] }, () => {
expect(channelName).to.contains(channelNameInDraftOrder); expect(channelName).to.contains(channelNameInDraftOrder);
} }
); );
}); }
);
it("Draft order channel should be taken from global channel picker when changed", () => { it(
"Draft order channel should be taken from global channel picker when changed",
{ tags: ["@orders", "@allEnv"] },
() => {
cy.visit(urlList.homePage); cy.visit(urlList.homePage);
selectChannelInHeader(otherChannel.name); selectChannelInHeader(otherChannel.name);
cy.visit(urlList.orders); cy.visit(urlList.orders);
@ -82,9 +87,13 @@ filterTests({ definedTags: ["all"] }, () => {
expect(channelInDraftOrder).to.be.eq(otherChannel.name); expect(channelInDraftOrder).to.be.eq(otherChannel.name);
} }
); );
}); }
);
it("should create draft order with chosen channel", () => { it(
"should create draft order with chosen channel",
{ tags: ["@orders", "@allEnv"] },
() => {
cy.visit(urlList.homePage); cy.visit(urlList.homePage);
selectChannelInHeader(defaultChannel.name); selectChannelInHeader(defaultChannel.name);
cy.visit(urlList.orders); cy.visit(urlList.orders);
@ -100,6 +109,6 @@ filterTests({ definedTags: ["all"] }, () => {
expect(channelInDraftOrder).to.be.eq(otherChannel.name); expect(channelInDraftOrder).to.be.eq(otherChannel.name);
} }
); );
}); }
}); );
}); });

View file

@ -17,78 +17,79 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../support/api/utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
import { selectChannelInPicker } from "../../support/pages/channelsPage"; import { selectChannelInPicker } from "../../support/pages/channelsPage";
import { finalizeDraftOrder } from "../../support/pages/draftOrderPage"; import { finalizeDraftOrder } from "../../support/pages/draftOrderPage";
filterTests({ definedTags: ["all"] }, () => { xdescribe("Draft orders", () => {
xdescribe("Draft orders", () => { const startsWith = "CyDraftOrders-";
const startsWith = "CyDraftOrders-"; const randomName = startsWith + faker.datatype.number();
const randomName = startsWith + faker.datatype.number();
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
let address; let address;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteCustomersStartsWith(startsWith); deleteCustomersStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
updateOrdersSettings(); updateOrdersSettings();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
}) })
.then(() => { .then(() => {
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addresses => { .then(addresses => {
address = addresses.plAddress; address = addresses.plAddress;
createCustomer( createCustomer(
`${randomName}@example.com`, `${randomName}@example.com`,
randomName, randomName,
addresses.plAddress, addresses.plAddress,
true true
);
createShipping({
channelId: defaultChannel.id,
name: randomName,
address: addresses.plAddress
});
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
productsUtils.createTypeAttributeAndCategoryForProduct({
name: randomName
});
})
.then(
({
productType: productTypeResp,
attribute: attributeResp,
category: categoryResp
}) => {
productsUtils.createProductInChannel({
name: randomName,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
productTypeId: productTypeResp.id,
attributeId: attributeResp.id,
categoryId: categoryResp.id
});
}
); );
}); createShipping({
channelId: defaultChannel.id,
name: randomName,
address: addresses.plAddress
});
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
productsUtils.createTypeAttributeAndCategoryForProduct({
name: randomName
});
})
.then(
({
productType: productTypeResp,
attribute: attributeResp,
category: categoryResp
}) => {
productsUtils.createProductInChannel({
name: randomName,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
productTypeId: productTypeResp.id,
attributeId: attributeResp.id,
categoryId: categoryResp.id
});
}
);
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should move draft order to orders", () => { it(
"should move draft order to orders",
{ tags: ["@orders", "@allEnv"] },
() => {
cy.visit(urlList.orders); cy.visit(urlList.orders);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
cy.get(ORDERS_SELECTORS.createOrder).click(); cy.get(ORDERS_SELECTORS.createOrder).click();
selectChannelInPicker(defaultChannel.name); selectChannelInPicker(defaultChannel.name);
finalizeDraftOrder(randomName, address).then(draftOrderNumber => { finalizeDraftOrder(randomName, address).then(draftOrderNumber => {
@ -106,6 +107,6 @@ filterTests({ definedTags: ["all"] }, () => {
expect($draftOrder).to.not.exist; expect($draftOrder).to.not.exist;
}); });
}); });
}); }
}); );
}); });

View file

@ -15,89 +15,90 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../support/api/utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
import { import {
enterSiteSettingAndSetStockReservation, enterSiteSettingAndSetStockReservation,
userType userType
} from "../../support/pages/siteSettings"; } from "../../support/pages/siteSettings";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { xdescribe("As an admin I want to manage stock reservation", () => {
xdescribe("As an admin I want to manage stock reservation", () => { const startsWith = "manageStocks";
const startsWith = "manageStocks"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; const productQuantity = 10;
const productQuantity = 10; const customerType = {
const customerType = { authenticated: "auth",
authenticated: "auth", anonymous: "token"
anonymous: "token" };
};
let defaultChannel; let defaultChannel;
let address; let address;
let warehouse; let warehouse;
let attribute; let attribute;
let category; let category;
let productType; let productType;
let dataForCheckout; let dataForCheckout;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
cy.fixture("addresses") cy.fixture("addresses")
.then(addresses => { .then(addresses => {
address = addresses.usAddress; address = addresses.usAddress;
getDefaultChannel(); getDefaultChannel();
}) })
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
createShipping({ createShipping({
channelId: defaultChannel.id, channelId: defaultChannel.id,
name, name,
address address
}); });
}) })
.then(({ warehouse: warehouseResp }) => { .then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp; warehouse = warehouseResp;
createTypeAttributeAndCategoryForProduct({ name }); createTypeAttributeAndCategoryForProduct({ name });
}) })
.then( .then(
({ ({
attribute: attributeResp, attribute: attributeResp,
category: categoryResp, category: categoryResp,
productType: productTypeResp productType: productTypeResp
}) => { }) => {
attribute = attributeResp; attribute = attributeResp;
category = categoryResp; category = categoryResp;
productType = productTypeResp; productType = productTypeResp;
} }
); );
});
beforeEach(() => {
const productName = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest();
createProductInChannel({
attributeId: attribute.id,
categoryId: category.id,
channelId: defaultChannel.id,
name: productName,
productTypeId: productType.id,
warehouseId: warehouse.id,
quantityInWarehouse: productQuantity
}).then(({ variantsList }) => {
dataForCheckout = {
email: "example@example.pl",
address,
channelSlug: defaultChannel.slug,
variantsList,
productQuantity
};
}); });
});
beforeEach(() => { it(
const productName = `${startsWith}${faker.datatype.number()}`; "should be able to set stock reservation for authenticated customer in checkout. TC: SALEOR_0415",
{ tags: ["@orders", "@allEnv"] },
cy.clearSessionData().loginUserViaRequest(); () => {
createProductInChannel({
attributeId: attribute.id,
categoryId: category.id,
channelId: defaultChannel.id,
name: productName,
productTypeId: productType.id,
warehouseId: warehouse.id,
quantityInWarehouse: productQuantity
}).then(({ variantsList }) => {
dataForCheckout = {
email: "example@example.pl",
address,
channelSlug: defaultChannel.slug,
variantsList,
productQuantity
};
});
});
it("should be able to set stock reservation for authenticated customer in checkout. TC: SALEOR_0415", () => {
dataForCheckout.auth = customerType.authenticated; dataForCheckout.auth = customerType.authenticated;
updateStockReservation({}) updateStockReservation({})
@ -117,9 +118,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
"error should be on field quantity" "error should be on field quantity"
).to.be.eq("quantity"); ).to.be.eq("quantity");
}); });
}); }
);
it("should be able to set stock reservation for anonymous customer in checkout. TC: SALEOR_0416", () => { it(
"should be able to set stock reservation for anonymous customer in checkout. TC: SALEOR_0416",
{ tags: ["@orders", "@allEnv"] },
() => {
dataForCheckout.auth = customerType.anonymous; dataForCheckout.auth = customerType.anonymous;
updateStockReservation({}) updateStockReservation({})
@ -139,9 +144,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
"error should be on field quantity" "error should be on field quantity"
).to.be.eq("quantity"); ).to.be.eq("quantity");
}); });
}); }
);
it("should be able to leave empty stock reservation for authenticated customer in checkout. TC: SALEOR_0417", () => { it(
"should be able to leave empty stock reservation for authenticated customer in checkout. TC: SALEOR_0417",
{ tags: ["@orders", "@allEnv"] },
() => {
dataForCheckout.auth = customerType.authenticated; dataForCheckout.auth = customerType.authenticated;
updateStockReservation({ authenticatedUserStock: 10 }) updateStockReservation({ authenticatedUserStock: 10 })
@ -157,9 +166,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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("should be able to leave empty stock reservation for anonymous customer in checkout. TC: SALEOR_0418", () => { it(
"should be able to leave empty stock reservation for anonymous customer in checkout. TC: SALEOR_0418",
{ tags: ["@orders", "@allEnv"] },
() => {
dataForCheckout.auth = customerType.anonymous; dataForCheckout.auth = customerType.anonymous;
updateStockReservation({ anonymousUserStock: 10 }) updateStockReservation({ anonymousUserStock: 10 })
@ -175,6 +188,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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;
}); });
}); }
}); );
}); });

View file

@ -28,94 +28,87 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../support/api/utils/shippingUtils"; } from "../../support/api/utils/shippingUtils";
import filterTests from "../../support/filterTests";
import { selectChannelInPicker } from "../../support/pages/channelsPage"; import { selectChannelInPicker } from "../../support/pages/channelsPage";
import { finalizeDraftOrder } from "../../support/pages/draftOrderPage"; import { finalizeDraftOrder } from "../../support/pages/draftOrderPage";
filterTests({ definedTags: ["all"] }, () => { describe("Orders", () => {
describe("Orders", () => { const startsWith = "CyOrders-";
const startsWith = "CyOrders-"; const randomName = startsWith + faker.datatype.number();
const randomName = startsWith + faker.datatype.number();
let customer; let customer;
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
let shippingMethod; let shippingMethod;
let variantsList; let variantsList;
let address; let address;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteCustomersStartsWith(startsWith); deleteCustomersStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
updateOrdersSettings(); updateOrdersSettings();
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
}) })
.then(() => { .then(() => {
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addresses => { .then(addresses => {
address = addresses.plAddress; address = addresses.plAddress;
createCustomer( createCustomer(`${randomName}@example.com`, randomName, address, true);
`${randomName}@example.com`, })
randomName, .then(customerResp => {
address, customer = customerResp.user;
true createShipping({
); channelId: defaultChannel.id,
}) name: randomName,
.then(customerResp => { address
customer = customerResp.user;
createShipping({
channelId: defaultChannel.id,
name: randomName,
address
});
})
.then(
({
warehouse: warehouseResp,
shippingMethod: shippingMethodResp
}) => {
shippingMethod = shippingMethodResp;
warehouse = warehouseResp;
productsUtils.createTypeAttributeAndCategoryForProduct({
name: randomName
});
}
)
.then(
({
productType: productTypeResp,
attribute: attributeResp,
category: categoryResp
}) => {
productsUtils.createProductInChannel({
name: randomName,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
productTypeId: productTypeResp.id,
attributeId: attributeResp.id,
categoryId: categoryResp.id
});
}
)
.then(({ variantsList: variantsResp }) => {
variantsList = variantsResp;
}); });
}); })
.then(
({ warehouse: warehouseResp, shippingMethod: shippingMethodResp }) => {
shippingMethod = shippingMethodResp;
warehouse = warehouseResp;
productsUtils.createTypeAttributeAndCategoryForProduct({
name: randomName
});
}
)
.then(
({
productType: productTypeResp,
attribute: attributeResp,
category: categoryResp
}) => {
productsUtils.createProductInChannel({
name: randomName,
channelId: defaultChannel.id,
warehouseId: warehouse.id,
productTypeId: productTypeResp.id,
attributeId: attributeResp.id,
categoryId: categoryResp.id
});
}
)
.then(({ variantsList: variantsResp }) => {
variantsList = variantsResp;
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.clearSessionData().loginUserViaRequest(
"auth", "auth",
ONE_PERMISSION_USERS.order ONE_PERMISSION_USERS.order
); );
}); });
xit("should create order with selected channel", () => { xit(
"should create order with selected channel",
{ tags: ["@orders", "@allEnv"] },
() => {
cy.visit(urlList.orders) cy.visit(urlList.orders)
.get(ORDERS_SELECTORS.createOrder) .get(ORDERS_SELECTORS.createOrder)
.click(); .click();
@ -127,9 +120,13 @@ filterTests({ definedTags: ["all"] }, () => {
"be.visible" "be.visible"
); );
}); });
}); }
);
it("should not be possible to change channel in order", () => { it(
"should not be possible to change channel in order",
{ tags: ["@orders", "@allEnv", "@stable"] },
() => {
createOrder({ createOrder({
customerId: customer.id, customerId: customer.id,
channelId: defaultChannel.id, channelId: defaultChannel.id,
@ -143,43 +140,47 @@ filterTests({ definedTags: ["all"] }, () => {
.find("[button]") .find("[button]")
.should("not.exist"); .should("not.exist");
}); });
}); }
);
it("should cancel fulfillment", () => { it("should cancel fulfillment", { tags: ["@orders", "@allEnv"] }, () => {
let order; let order;
createFulfilledOrder({ createFulfilledOrder({
customerId: customer.id, customerId: customer.id,
channelId: defaultChannel.id, channelId: defaultChannel.id,
shippingMethodId: shippingMethod.id, shippingMethodId: shippingMethod.id,
variantsList, variantsList,
address, address,
warehouse: warehouse.id warehouse: warehouse.id
})
.then(({ order: orderResp }) => {
order = orderResp;
cy.visit(urlList.orders);
cy.expectSkeletonIsVisible();
cy.contains(ORDERS_SELECTORS.orderRow, order.number).click();
cy.get(SHARED_ELEMENTS.skeleton)
.should("not.exist")
.get(ORDERS_SELECTORS.cancelFulfillment)
.click()
.fillAutocompleteSelect(
ORDERS_SELECTORS.cancelFulfillmentSelectField,
warehouse.name
)
.addAliasToGraphRequest("OrderFulfillmentCancel")
.get(BUTTON_SELECTORS.submit)
.click()
.waitForRequestAndCheckIfNoErrors("@OrderFulfillmentCancel");
getOrder(order.id);
}) })
.then(({ order: orderResp }) => { .then(orderResp => {
order = orderResp; expect(orderResp.status).to.be.eq("UNFULFILLED");
cy.visit(urlList.orders); });
cy.softExpectSkeletonIsVisible(); });
cy.contains(ORDERS_SELECTORS.orderRow, order.number).click();
cy.get(SHARED_ELEMENTS.skeleton)
.should("not.exist")
.get(ORDERS_SELECTORS.cancelFulfillment)
.click()
.fillAutocompleteSelect(
ORDERS_SELECTORS.cancelFulfillmentSelectField,
warehouse.name
)
.addAliasToGraphRequest("OrderFulfillmentCancel")
.get(BUTTON_SELECTORS.submit)
.click()
.waitForRequestAndCheckIfNoErrors("@OrderFulfillmentCancel");
getOrder(order.id);
})
.then(orderResp => {
expect(orderResp.status).to.be.eq("UNFULFILLED");
});
});
it("should make a refund", () => { it(
"should make a refund",
{ tags: ["@orders", "@allEnv", "@stable"] },
() => {
let order; let order;
createReadyToFulfillOrder({ createReadyToFulfillOrder({
customerId: customer.id, customerId: customer.id,
@ -191,7 +192,7 @@ filterTests({ definedTags: ["all"] }, () => {
.then(({ order: orderResp }) => { .then(({ order: orderResp }) => {
order = orderResp; order = orderResp;
cy.visit(urlList.orders); cy.visit(urlList.orders);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
cy.contains(ORDERS_SELECTORS.orderRow, order.number).click(); cy.contains(ORDERS_SELECTORS.orderRow, order.number).click();
cy.get(ORDERS_SELECTORS.refundButton) cy.get(ORDERS_SELECTORS.refundButton)
.click() .click()
@ -208,6 +209,6 @@ filterTests({ definedTags: ["all"] }, () => {
.then(orderResp => { .then(orderResp => {
expect(orderResp.paymentStatus).to.be.eq("FULLY_REFUNDED"); expect(orderResp.paymentStatus).to.be.eq("FULLY_REFUNDED");
}); });
}); }
}); );
}); });

View file

@ -13,17 +13,18 @@ import {
createPageType, createPageType,
getPageType getPageType
} from "../../support/api/requests/PageType"; } from "../../support/api/requests/PageType";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Tests for page types", () => {
describe("Tests for page types", () => { const startsWith = "PageTypes";
const startsWith = "PageTypes";
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should create page type", () => { it(
"should create page type",
{ tags: ["@pages", "@allEnv", "@stable"] },
() => {
const randomName = startsWith + faker.datatype.number(); const randomName = startsWith + faker.datatype.number();
cy.visit(urlList.pageTypes) cy.visit(urlList.pageTypes)
@ -43,26 +44,26 @@ filterTests({ definedTags: ["all"] }, () => {
.then(pageType => { .then(pageType => {
expect(pageType.name).to.eq(randomName); expect(pageType.name).to.eq(randomName);
}); });
}); }
);
xit("should assign attribute", () => { xit("should assign attribute", { tags: ["@pages", "@allEnv"] }, () => {
const randomName = startsWith + faker.datatype.number(); const randomName = startsWith + faker.datatype.number();
createAttribute({ name: randomName, type: "PAGE_TYPE" }); createAttribute({ name: randomName, type: "PAGE_TYPE" });
createPageType(randomName) createPageType(randomName)
.then(({ pageType }) => { .then(({ pageType }) => {
cy.visit(pageTypeDetailsUrl(pageType.id)) cy.visit(pageTypeDetailsUrl(pageType.id))
.get(SHARED_ELEMENTS.progressBar) .get(SHARED_ELEMENTS.progressBar)
.should("be.not.visible") .should("be.not.visible")
.get(PAGE_TYPE_DETAILS.assignAttributesButton) .get(PAGE_TYPE_DETAILS.assignAttributesButton)
.click() .click()
.assignElements(randomName, false) .assignElements(randomName, false)
.confirmationMessageShouldDisappear(); .confirmationMessageShouldDisappear();
getPageType(pageType.id); getPageType(pageType.id);
}) })
.then(pageType => { .then(pageType => {
expect(pageType.attributes[0].name).to.eq(randomName); expect(pageType.attributes[0].name).to.eq(randomName);
}); });
});
}); });
}); });

View file

@ -5,7 +5,7 @@ import faker from "faker";
import { PAGE_DETAILS } from "../../elements/pages/page-details"; import { PAGE_DETAILS } from "../../elements/pages/page-details";
import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../elements/shared/button-selectors";
import { pageDetailsUrl, pageTypeDetailsUrl } from "../../fixtures/urlList"; 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,
@ -14,42 +14,43 @@ import {
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";
import { deletePageTypesStartsWith } from "../../support/api/utils/pageTypeUtils"; import { deletePageTypesStartsWith } from "../../support/api/utils/pageTypeUtils";
import filterTests from "../../support/filterTests";
import { attributesTypes, createPage } from "../../support/pages/pagesPage"; import { attributesTypes, createPage } from "../../support/pages/pagesPage";
filterTests({ definedTags: ["all"] }, () => { describe("Tests for pages", () => {
describe("Tests for pages", () => { const startsWith = `Pages`;
const startsWith = `Pages`; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; let attribute;
let attribute; let pageType;
let pageType;
const attributeValuesOnPage = { const attributeValuesOnPage = {
NUMERIC: 1, NUMERIC: 1,
RICH_TEXT: faker.lorem.sentence(), RICH_TEXT: faker.lorem.sentence(),
DROPDOWN: "value", DROPDOWN: "value",
MULTISELECT: "value", MULTISELECT: "value",
BOOLEAN: true BOOLEAN: true
}; };
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteAttributesStartsWith(startsWith); deleteAttributesStartsWith(startsWith);
deletePageTypesStartsWith(startsWith); deletePageTypesStartsWith(startsWith);
createAttribute({ name, type: "PAGE_TYPE" }) createAttribute({ name, type: "PAGE_TYPE" })
.then(attributeResp => { .then(attributeResp => {
attribute = attributeResp; attribute = attributeResp;
createPageType({ name, attributeId: attribute.id }); createPageType({ name, attributeId: attribute.id });
}) })
.then(({ pageType: pageTypeResp }) => (pageType = pageTypeResp)); .then(({ pageType: pageTypeResp }) => (pageType = pageTypeResp));
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should create not published page", () => { it(
"should create not published page",
{ tags: ["@pages", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
createPage({ pageName: randomName, pageTypeName: name }) createPage({ pageName: randomName, pageTypeName: name })
@ -62,9 +63,13 @@ filterTests({ definedTags: ["all"] }, () => {
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("should create published page", () => { it(
"should create published page",
{ tags: ["@pages", "@allEnv", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
createPage({ createPage({
@ -80,10 +85,14 @@ filterTests({ definedTags: ["all"] }, () => {
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 => {
it(`should create page with ${attributeType} attribute`, () => { it(
`should create page with ${attributeType} attribute`,
{ tags: ["@pages", "@allEnv"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
const attributeValues = [attributeValuesOnPage[attributeType]]; const attributeValues = [attributeValuesOnPage[attributeType]];
createAttribute({ createAttribute({
@ -116,51 +125,51 @@ filterTests({ definedTags: ["all"] }, () => {
); );
} }
}); });
}); }
}); );
});
it("should delete page", () => { it("should delete page", { tags: ["@pages", "@allEnv", "@stable"] }, () => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
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)
.click() .click()
.addAliasToGraphRequest("PageRemove") .addAliasToGraphRequest("PageRemove")
.get(BUTTON_SELECTORS.submit) .get(BUTTON_SELECTORS.submit)
.click() .click()
.waitForRequestAndCheckIfNoErrors("@PageRemove"); .waitForRequestAndCheckIfNoErrors("@PageRemove");
getPage(page.id).should("be.null"); getPage(page.id).should("be.null");
});
});
it("should update page", () => {
const randomName = `${startsWith}${faker.datatype.number()}`;
const updatedName = `${startsWith}${faker.datatype.number()}`;
createPageRequest({
pageTypeId: pageType.id,
title: randomName
})
.then(({ page }) => {
cy.visit(pageDetailsUrl(page.id))
.get(PAGE_DETAILS.nameInput)
.clearAndType(updatedName)
.get(PAGE_DETAILS.isPublishedCheckbox)
.click()
.addAliasToGraphRequest("PageUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@PageUpdate");
getPage(page.id);
})
.then(page => {
expect(page.title).to.eq(updatedName);
expect(page.isPublished).to.eq(true);
});
}); });
}); });
it("should update page", { tags: ["@pages", "@allEnv", "@stable"] }, () => {
const randomName = `${startsWith}${faker.datatype.number()}`;
const updatedName = `${startsWith}${faker.datatype.number()}`;
createPageRequest({
pageTypeId: pageType.id,
title: randomName
})
.then(({ page }) => {
cy.visit(pageDetailsUrl(page.id))
.get(PAGE_DETAILS.nameInput)
.clearAndType(updatedName)
.get(PAGE_DETAILS.isPublishedCheckbox)
.click()
.addAliasToGraphRequest("PageUpdate")
.get(BUTTON_SELECTORS.confirm)
.click()
.waitForRequestAndCheckIfNoErrors("@PageUpdate");
getPage(page.id);
})
.then(page => {
expect(page.title).to.eq(updatedName);
expect(page.isPublished).to.eq(true);
});
});
}); });

View file

@ -14,7 +14,6 @@ import {
} 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";
import filterTests from "../../support/filterTests";
import { formatDate, formatTime } from "../../support/formatData/formatDate"; import { formatDate, formatTime } from "../../support/formatData/formatDate";
import { import {
enablePreorderWithThreshold, enablePreorderWithThreshold,
@ -24,40 +23,42 @@ import {
setUpPreorderEndDate setUpPreorderEndDate
} from "../../support/pages/catalog/products/VariantsPage"; } from "../../support/pages/catalog/products/VariantsPage";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { describe("Creating variants in preorder", () => {
describe("Creating variants in preorder", () => { const name = `CreatePreOrder${faker.datatype.number()}`;
const name = `CreatePreOrder${faker.datatype.number()}`; const attributeValues = ["value1", "value2", "value3"];
const attributeValues = ["value1", "value2", "value3"]; const threshold = 100;
const threshold = 100; const futureDate = new Date().setDate(new Date().getDate() + 14);
const futureDate = new Date().setDate(new Date().getDate() + 14); const endDate = formatDate(futureDate);
const endDate = formatDate(futureDate); const endTime = formatTime(futureDate);
const endTime = formatTime(futureDate);
let defaultChannel; let defaultChannel;
let product; let product;
let variantsList; let variantsList;
let checkoutData; let checkoutData;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
createProductWithShipping({ name, attributeValues }).then(resp => { createProductWithShipping({ name, attributeValues }).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
}; };
defaultChannel = resp.defaultChannel; defaultChannel = resp.defaultChannel;
product = resp.product; product = resp.product;
variantsList = resp.variantsList; variantsList = resp.variantsList;
});
}); });
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
xit("should create variant in preorder", () => { xit(
"should create variant in preorder",
{ tags: ["@preorders", "@allEnv"] },
() => {
let variant; let variant;
cy.visit(productDetailsUrl(product.id)) cy.visit(productDetailsUrl(product.id))
@ -99,9 +100,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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("should enable preorder on active variant", () => { it(
"should enable preorder on active variant",
{ tags: ["@preorders", "@allEnv"] },
() => {
const variant = variantsList[0]; const variant = variantsList[0];
checkoutData.variantsList = [variant]; checkoutData.variantsList = [variant];
@ -118,9 +123,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
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("should set end date on preorder variant", () => { it(
"should set end date on preorder variant",
{ tags: ["@preorders", "@allEnv"] },
() => {
const variant = variantsList[0]; const variant = variantsList[0];
checkoutData.variantsList = [variant]; checkoutData.variantsList = [variant];
@ -133,6 +142,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
expect(endDate).to.eq(formatDate(respEndDate)); expect(endDate).to.eq(formatDate(respEndDate));
expect(endTime).to.eq(formatTime(respEndDate)); expect(endTime).to.eq(formatTime(respEndDate));
}); });
}); }
}); );
}); });

View file

@ -13,51 +13,52 @@ import {
createProductWithShipping, createProductWithShipping,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../support/api/utils/products/productsUtils"; } from "../../support/api/utils/products/productsUtils";
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" }, () => { describe("Stocks and threshold in preorder variants", () => {
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;
let product; let product;
let variantsList; let variantsList;
let warehouse; let warehouse;
let checkoutData; let checkoutData;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
deleteCollectionsStartsWith(startsWith); deleteCollectionsStartsWith(startsWith);
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;
product = resp.product; product = resp.product;
variantsList = resp.variantsList; variantsList = resp.variantsList;
});
}); });
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
xit("should not be able to order more products then channel threshold", () => { xit(
"should not be able to order more products then channel threshold",
{ tags: ["@preorders", "@allEnv"] },
() => {
cy.visit(variantDetailsUrl(product.id, variantsList[0].id)) cy.visit(variantDetailsUrl(product.id, variantsList[0].id))
.get(VARIANTS_SELECTORS.channelThresholdInput) .get(VARIANTS_SELECTORS.channelThresholdInput)
.type(5) .type(5)
@ -68,9 +69,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
createCheckout(checkoutData).then(({ errors }) => { createCheckout(checkoutData).then(({ errors }) => {
expect(errors[0].field).to.eq("quantity"); expect(errors[0].field).to.eq("quantity");
}); });
}); }
);
it("should not be able to order more products then threshold even if channel is not exceeded", () => { it(
"should not be able to order more products then threshold even if channel is not exceeded",
{ tags: ["@preorders", "@allEnv"] },
() => {
cy.visit(variantDetailsUrl(product.id, variantsList[0].id)) cy.visit(variantDetailsUrl(product.id, variantsList[0].id))
.get(VARIANTS_SELECTORS.channelThresholdInput) .get(VARIANTS_SELECTORS.channelThresholdInput)
.type(40); .type(40);
@ -79,9 +84,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
createCheckout(checkoutData).then(({ errors }) => { createCheckout(checkoutData).then(({ errors }) => {
expect(errors[0].field).to.eq("quantity"); expect(errors[0].field).to.eq("quantity");
}); });
}); }
);
it("should allocate variants bought in preorder to correct warehouses", () => { it(
"should allocate variants bought in preorder to correct warehouses",
{ tags: ["@preorders", "@allEnv"] },
() => {
let order; let order;
createWaitingForCaptureOrder(checkoutData) createWaitingForCaptureOrder(checkoutData)
.then(({ order: orderResp }) => { .then(({ order: orderResp }) => {
@ -118,6 +127,6 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
.then(({ errors }) => { .then(({ errors }) => {
expect(errors, "no errors when fulfilling order").to.be.empty; expect(errors, "no errors when fulfilling order").to.be.empty;
}); });
}); }
}); );
}); });

View file

@ -14,7 +14,6 @@ import {
expectCorrectProductInformation, expectCorrectProductInformation,
expectCorrectProductVariantInformation expectCorrectProductVariantInformation
} from "../../support/api/utils/products/checkProductInfo"; } from "../../support/api/utils/products/checkProductInfo";
import filterTests from "../../support/filterTests";
import { metadataForms } from "../../support/pages/catalog/metadataComponent"; import { metadataForms } from "../../support/pages/catalog/metadataComponent";
import { import {
fillUpPriceList, fillUpPriceList,
@ -23,44 +22,46 @@ import {
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";
filterTests({ definedTags: ["all", "critical"] }, () => { describe("As an admin I should be able to create product", () => {
describe("As an admin I should be able to create product", () => { const startsWith = "CyCreateProduct-";
const startsWith = "CyCreateProduct-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; 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;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
createAttribute({ name }).then(attributeResp => { createAttribute({ name }).then(attributeResp => {
attribute = attributeResp; attribute = attributeResp;
});
});
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
}); });
});
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
});
it("should be able to create product with variants as an admin. SALEOR_2701", () => { it(
"should be able to create product with variants as an admin. SALEOR_2701",
{ tags: ["@products", "@allEnv", "@critical", "@stable"] },
() => {
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
seo.slug = randomName; seo.slug = randomName;
const productData = { const productData = {
@ -90,9 +91,13 @@ filterTests({ definedTags: ["all", "critical"] }, () => {
} }
expectCorrectProductInformation(productResp, productData); expectCorrectProductInformation(productResp, productData);
}); });
}); }
);
it("should be able to create product without variants as an admin. SALEOR_2702", () => { it(
"should be able to create product without variants as an admin. SALEOR_2702",
{ tags: ["@products", "@allEnv", "@critical", "@stable"] },
() => {
const prices = { sellingPrice: 6, costPrice: 3 }; const prices = { sellingPrice: 6, costPrice: 3 };
const randomName = `${startsWith}${faker.datatype.number()}`; const randomName = `${startsWith}${faker.datatype.number()}`;
seo.slug = randomName; seo.slug = randomName;
@ -133,24 +138,24 @@ filterTests({ definedTags: ["all", "critical"] }, () => {
prices prices
); );
}); });
});
function createTpeAndFillUpProductFields(
randomName,
hasVariants,
productData
) {
createTypeProduct({
name: randomName,
attributeId: attribute.id,
hasVariants
});
cy.clearSessionData()
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product)
.visit(urlList.products)
.get(PRODUCTS_LIST.createProductBtn)
.click();
return fillUpCommonFieldsForAllProductTypes(productData);
} }
}); );
function createTpeAndFillUpProductFields(
randomName,
hasVariants,
productData
) {
createTypeProduct({
name: randomName,
attributeId: attribute.id,
hasVariants
});
cy.clearSessionData()
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product)
.visit(urlList.products)
.get(PRODUCTS_LIST.createProductBtn)
.click();
return fillUpCommonFieldsForAllProductTypes(productData);
}
}); });

View file

@ -8,15 +8,16 @@ 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 { createNewProductWithNewDataAndDefaultChannel } from "../../support/api/utils/products/productsUtils"; import { createNewProductWithNewDataAndDefaultChannel } from "../../support/api/utils/products/productsUtils";
import filterTests from "../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { xdescribe("Tests for images", () => {
xdescribe("Tests for images", () => { beforeEach(() => {
beforeEach(() => { cy.clearSessionData().loginUserViaRequest();
cy.clearSessionData().loginUserViaRequest(); });
});
it("Images on product list should be displayed", () => { it(
"Images on product list should be displayed",
{ tags: ["@products", "@allEnv"] },
() => {
cy.addAliasToGraphRequest("ProductList") cy.addAliasToGraphRequest("ProductList")
.visit(urlList.products) .visit(urlList.products)
.wait("@ProductList") .wait("@ProductList")
@ -26,7 +27,7 @@ filterTests({ definedTags: ["all"] }, () => {
element.data.hasOwnProperty("products") element.data.hasOwnProperty("products")
).data; ).data;
const products = data.products.edges; const products = data.products.edges;
cy.softExpectSkeletonIsVisible() cy.expectSkeletonIsVisible()
.get(SHARED_ELEMENTS.skeleton) .get(SHARED_ELEMENTS.skeleton)
.should("not.exist"); .should("not.exist");
cy.get(PRODUCTS_LIST.productImage) cy.get(PRODUCTS_LIST.productImage)
@ -48,49 +49,49 @@ filterTests({ definedTags: ["all"] }, () => {
.should("have.length", expectedProductsSvgAvatars); .should("have.length", expectedProductsSvgAvatars);
}); });
}); });
}); }
);
it("Should display product image", () => { it("Should display product image", { tags: ["@products", "@allEnv"] }, () => {
getFirstProducts(1, demoProductsNames.carrotJuice) getFirstProducts(1, demoProductsNames.carrotJuice)
.then(resp => { .then(resp => {
const product = resp[0].node; const product = resp[0].node;
cy.visit(productDetailsUrl(product.id)) cy.visit(productDetailsUrl(product.id))
.get(PRODUCT_DETAILS.productImage) .get(PRODUCT_DETAILS.productImage)
.find("img") .find("img")
.invoke("attr", "src"); .invoke("attr", "src");
}) })
.then(imageUrl => { .then(imageUrl => {
cy.request(imageUrl); cy.request(imageUrl);
}) })
.then(imageResp => { .then(imageResp => {
expect(imageResp.status).to.equal(200); expect(imageResp.status).to.equal(200);
}); });
}); });
it("Should upload saved image", () => { it("Should upload saved image", { tags: ["@products", "@allEnv"] }, () => {
const name = "CyImages"; const name = "CyImages";
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
createNewProductWithNewDataAndDefaultChannel({ name }) createNewProductWithNewDataAndDefaultChannel({ name })
.then(({ product }) => { .then(({ product }) => {
cy.visit(productDetailsUrl(product.id)) cy.visit(productDetailsUrl(product.id))
.waitForProgressBarToNotBeVisible() .waitForProgressBarToNotBeVisible()
.get(PRODUCT_DETAILS.uploadImageButton) .get(PRODUCT_DETAILS.uploadImageButton)
.click() .click()
.get(PRODUCT_DETAILS.uploadSavedImagesButton) .get(PRODUCT_DETAILS.uploadSavedImagesButton)
.click() .click()
.get(SHARED_ELEMENTS.fileInput) .get(SHARED_ELEMENTS.fileInput)
.attachFile("images/saleorDemoProductSneakers.png") .attachFile("images/saleorDemoProductSneakers.png")
.get(PRODUCT_DETAILS.productImage) .get(PRODUCT_DETAILS.productImage)
.find("img") .find("img")
.invoke("attr", "src"); .invoke("attr", "src");
}) })
.then(imageUrl => { .then(imageUrl => {
cy.request(imageUrl); cy.request(imageUrl);
}) })
.then(imageResp => { .then(imageResp => {
expect(imageResp.status).to.equal(200); expect(imageResp.status).to.equal(200);
}); });
});
}); });
}); });

View file

@ -10,63 +10,64 @@ 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 * as shippingUtils from "../../../support/api/utils/shippingUtils"; import * as shippingUtils from "../../../support/api/utils/shippingUtils";
import { isProductAvailableForPurchase } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; import { isProductAvailableForPurchase } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import filterTests from "../../../support/filterTests";
import { updateProductIsAvailableForPurchase } from "../../../support/pages/catalog/products/productDetailsPage"; import { updateProductIsAvailableForPurchase } from "../../../support/pages/catalog/products/productDetailsPage";
filterTests({ definedTags: ["all"] }, () => { describe("Products available in listings", () => {
describe("Products available in listings", () => { const startsWith = "CyAvailForPurchase-";
const startsWith = "CyAvailForPurchase-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; let productType;
let productType; let attribute;
let attribute; let category;
let category; let defaultChannel;
let defaultChannel; let warehouse;
let warehouse;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
shippingUtils.deleteShippingStartsWith(startsWith); shippingUtils.deleteShippingStartsWith(startsWith);
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addressesFixture => { .then(addressesFixture => {
shippingUtils.createShipping({ shippingUtils.createShipping({
channelId: defaultChannel.id, channelId: defaultChannel.id,
name, name,
address: addressesFixture.plAddress address: addressesFixture.plAddress
});
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
}); });
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
});
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name }) .createTypeAttributeAndCategoryForProduct({ name })
.then( .then(
({ ({
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(() => {
cy.clearSessionData().loginUserViaRequest(
"auth",
ONE_PERMISSION_USERS.product
); );
}); });
it("should update product to available for purchase", () => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(
"auth",
ONE_PERMISSION_USERS.product
);
});
it(
"should update product to available for purchase",
{ tags: ["@products", "@allEnv"] },
() => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
let product; let product;
@ -91,9 +92,13 @@ filterTests({ definedTags: ["all"] }, () => {
.then(resp => { .then(resp => {
expect(isProductAvailableForPurchase(resp)).to.be.eq(true); expect(isProductAvailableForPurchase(resp)).to.be.eq(true);
}); });
}); }
);
it("should update product to not available for purchase", () => { it(
"should update product to not available for purchase",
{ tags: ["@products", "@allEnv"] },
() => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
let product; let product;
@ -117,6 +122,6 @@ filterTests({ definedTags: ["all"] }, () => {
.then(resp => { .then(resp => {
expect(isProductAvailableForPurchase(resp)).to.be.eq(false); expect(isProductAvailableForPurchase(resp)).to.be.eq(false);
}); });
}); }
}); );
}); });

View file

@ -9,48 +9,49 @@ import { getProductDetails } from "../../../support/api/requests/storeFront/Prod
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 { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; import { isProductVisible } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import filterTests from "../../../support/filterTests";
import { updateProductPublish } from "../../../support/pages/catalog/products/productDetailsPage"; import { updateProductPublish } from "../../../support/pages/catalog/products/productDetailsPage";
filterTests({ definedTags: ["all"] }, () => { describe("Published products", () => {
describe("Published products", () => { const startsWith = "CyPublishedProducts-";
const startsWith = "CyPublishedProducts-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; let productType;
let productType; let attribute;
let attribute; let category;
let category; let defaultChannel;
let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name }) .createTypeAttributeAndCategoryForProduct({ name })
.then( .then(
({ ({
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;
}); });
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.clearSessionData().loginUserViaRequest(
"auth", "auth",
ONE_PERMISSION_USERS.product ONE_PERMISSION_USERS.product
); );
}); });
it("should update product to published", () => { it(
"should update product to published",
{ tags: ["@products", "@allEnv"] },
() => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
@ -73,9 +74,13 @@ filterTests({ definedTags: ["all"] }, () => {
const isVisible = isProductVisible(resp, productName); const isVisible = isProductVisible(resp, productName);
expect(isVisible).to.be.eq(true); expect(isVisible).to.be.eq(true);
}); });
}); }
);
it("should update product to not published", () => { it(
"should update product to not published",
{ tags: ["@products", "@allEnv"] },
() => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
let product; let product;
@ -105,6 +110,6 @@ filterTests({ definedTags: ["all"] }, () => {
const isVisible = isProductVisible(resp, productName); const isVisible = isProductVisible(resp, productName);
expect(isVisible).to.be.eq(true); expect(isVisible).to.be.eq(true);
}); });
}); }
}); );
}); });

View file

@ -8,48 +8,49 @@ import { searchInShop } from "../../../support/api/requests/storeFront/Search";
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 { isProductVisibleInSearchResult } from "../../../support/api/utils/storeFront/storeFrontProductUtils"; import { isProductVisibleInSearchResult } from "../../../support/api/utils/storeFront/storeFrontProductUtils";
import filterTests from "../../../support/filterTests";
import { updateProductVisibleInListings } from "../../../support/pages/catalog/products/productDetailsPage"; import { updateProductVisibleInListings } from "../../../support/pages/catalog/products/productDetailsPage";
filterTests({ definedTags: ["all"] }, () => { describe("Products displayed in listings", () => {
describe("Products displayed in listings", () => { const startsWith = "CyVisibleInListings-";
const startsWith = "CyVisibleInListings-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; let productType;
let productType; let attribute;
let attribute; let category;
let category; let defaultChannel;
let defaultChannel;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
productsUtils.deleteProductsStartsWith(startsWith); productsUtils.deleteProductsStartsWith(startsWith);
productsUtils productsUtils
.createTypeAttributeAndCategoryForProduct({ name }) .createTypeAttributeAndCategoryForProduct({ name })
.then( .then(
({ ({
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;
}); });
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.clearSessionData().loginUserViaRequest(
"auth", "auth",
ONE_PERMISSION_USERS.product ONE_PERMISSION_USERS.product
); );
}); });
it("should update product to visible in listings", () => { it(
"should update product to visible in listings",
{ tags: ["@products", "@allEnv"] },
() => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
@ -75,9 +76,13 @@ filterTests({ definedTags: ["all"] }, () => {
); );
expect(isProductVisible).to.be.eq(true); expect(isProductVisible).to.be.eq(true);
}); });
}); }
);
it("should update product to not visible in listings", () => { it(
"should update product to not visible in listings",
{ tags: ["@products", "@allEnv"] },
() => {
const productName = `${startsWith}${faker.datatype.number()}`; const productName = `${startsWith}${faker.datatype.number()}`;
productsUtils productsUtils
@ -113,6 +118,6 @@ filterTests({ definedTags: ["all"] }, () => {
); );
expect(isProductVisible).to.be.eq(true); expect(isProductVisible).to.be.eq(true);
}); });
}); }
}); );
}); });

View file

@ -17,94 +17,99 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../../support/api/utils/shippingUtils"; } from "../../../support/api/utils/shippingUtils";
import filterTests from "../../../support/filterTests";
import { import {
selectChannel, selectChannel,
selectFilterOption, selectFilterOption,
selectProductsOutOfStock selectProductsOutOfStock
} from "../../../support/pages/catalog/products/productsListPage"; } from "../../../support/pages/catalog/products/productsListPage";
filterTests({ definedTags: ["all"] }, () => { describe("Filtering products", () => {
describe("Filtering products", () => { const startsWith = "CyFilterProducts-";
const startsWith = "CyFilterProducts-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; const stockQuantity = 747;
const stockQuantity = 747; const price = 342;
const price = 342; let attribute;
let attribute; let productType;
let productType; let category;
let category; let warehouse;
let warehouse; let channel;
let channel; let collection;
let collection;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
createTypeAttributeAndCategoryForProduct({ name }).then( createTypeAttributeAndCategoryForProduct({ name }).then(
({ ({
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 => {
channel = channelResp; channel = channelResp;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(addresses => { .then(addresses => {
createShipping({ createShipping({
channelId: channel.id, channelId: channel.id,
name, name,
address: addresses.plAddress address: addresses.plAddress
});
})
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
createProductInChannel({
name,
channelId: channel.id,
warehouseId: warehouse.id,
quantityInWarehouse: stockQuantity,
price,
attributeId: attribute.id,
categoryId: category.id,
productTypeId: productType.id
});
})
.then(({ product: product }) => {
updateProduct(product.id, { collections: [collection.id] });
}); });
}); })
.then(({ warehouse: warehouseResp }) => {
warehouse = warehouseResp;
createProductInChannel({
name,
channelId: channel.id,
warehouseId: warehouse.id,
quantityInWarehouse: stockQuantity,
price,
attributeId: attribute.id,
categoryId: category.id,
productTypeId: productType.id
});
})
.then(({ product: product }) => {
updateProduct(product.id, { collections: [collection.id] });
});
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.products); .visit(urlList.products);
}); });
// const filterProductsBy = ["category", "collection", "productType"]; // const filterProductsBy = ["category", "collection", "productType"];
const filterProductsBy = ["category", "productType"]; const filterProductsBy = ["category", "productType"];
filterProductsBy.forEach(filterBy => { filterProductsBy.forEach(filterBy => {
it(`should filter products by ${filterBy}`, () => { it(
cy.softExpectSkeletonIsVisible().waitForProgressBarToNotExist(); `should filter products by ${filterBy}`,
{ tags: ["@productsList", "@allEnv"] },
() => {
cy.expectSkeletonIsVisible().waitForProgressBarToNotExist();
selectFilterOption(filterBy, name); selectFilterOption(filterBy, name);
cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => { cy.getTextFromElement(PRODUCTS_LIST.productsNames).then(product => {
expect(product).to.includes(name); expect(product).to.includes(name);
}); });
}); }
}); );
});
it("should filter products out of stock", () => { it(
cy.softExpectSkeletonIsVisible(); "should filter products out of stock",
{ tags: ["@productsList", "@allEnv"] },
() => {
cy.expectSkeletonIsVisible();
const productOutOfStock = `${startsWith}${faker.datatype.number()}`; const productOutOfStock = `${startsWith}${faker.datatype.number()}`;
createProductInChannel({ createProductInChannel({
name: productOutOfStock, name: productOutOfStock,
@ -126,6 +131,6 @@ filterTests({ definedTags: ["all"] }, () => {
.then(product => { .then(product => {
expect(product).to.includes(productOutOfStock); expect(product).to.includes(productOutOfStock);
}); });
}); }
}); );
}); });

View file

@ -3,23 +3,23 @@
import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"; import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list";
import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors"; import { BUTTON_SELECTORS } from "../../../elements/shared/button-selectors";
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import filterTests from "../../../support/filterTests";
import { import {
getDisplayedColumnArray, getDisplayedColumnArray,
isNumberOfProductsSameAsInSelectResultsOnPage isNumberOfProductsSameAsInSelectResultsOnPage
} from "../../../support/pages/catalog/products/productsListPage"; } from "../../../support/pages/catalog/products/productsListPage";
filterTests({ definedTags: ["all"] }, () => { describe("Products", () => {
describe("Products", () => { beforeEach(() => {
beforeEach(() => { cy.clearSessionData().loginUserViaRequest();
cy.clearSessionData().loginUserViaRequest(); cy.visit(urlList.products);
cy.visit(urlList.products); });
});
it("should be able go to the next page on product list. TC: SALEOR_2605", () => { it(
cy.softExpectSkeletonIsVisible() "should be able go to the next page on product list. TC: SALEOR_2605",
{ tags: ["@productsList", "@allEnv"] },
() => {
cy.expectSkeletonIsVisible()
.get(PRODUCTS_LIST.emptyProductRow) .get(PRODUCTS_LIST.emptyProductRow)
.should("not.exist") .should("not.exist")
.get(PRODUCTS_LIST.previousPagePagination) .get(PRODUCTS_LIST.previousPagePagination)
@ -48,10 +48,14 @@ filterTests({ definedTags: ["all"] }, () => {
JSON.stringify(productsList) === JSON.stringify(firstPageProducts) JSON.stringify(productsList) === JSON.stringify(firstPageProducts)
).to.be.true; ).to.be.true;
}); });
}); }
);
it("should see correct amount of products per page. TC: SALEOR_2606", () => { it(
cy.softExpectSkeletonIsVisible(); "should see correct amount of products per page. TC: SALEOR_2606",
{ tags: ["@productsList", "@allEnv", "@stable"] },
() => {
cy.expectSkeletonIsVisible();
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")
@ -72,6 +76,6 @@ filterTests({ definedTags: ["all"] }, () => {
"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
); );
}); }
}); );
}); });

View file

@ -5,17 +5,18 @@ import { PRODUCTS_LIST } from "../../../elements/catalog/products/products-list"
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
import { urlList } from "../../../fixtures/urlList"; import { urlList } from "../../../fixtures/urlList";
import { expectProductsSortedBy } from "../../../support/api/utils/products/productsListUtils"; import { expectProductsSortedBy } from "../../../support/api/utils/products/productsListUtils";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["all"] }, () => { describe("Sorting products", () => {
describe("Sorting products", () => { const sortByList = ["name", "type"];
const sortByList = ["name", "type"]; sortByList.forEach(sortBy => {
sortByList.forEach(sortBy => { it(
it(`Sorting by ${sortBy}`, () => { `Sorting by ${sortBy}`,
{ tags: ["@productsList", "@allEnv", "@stable"] },
() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest() .loginUserViaRequest()
.visit(urlList.products); .visit(urlList.products);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
cy.get(SHARED_ELEMENTS.header).should("be.visible"); cy.get(SHARED_ELEMENTS.header).should("be.visible");
if (sortBy !== "name") { if (sortBy !== "name") {
cy.get(PRODUCTS_LIST.tableHeaders[sortBy]) cy.get(PRODUCTS_LIST.tableHeaders[sortBy])
@ -29,7 +30,7 @@ filterTests({ definedTags: ["all"] }, () => {
.waitForProgressBarToNotExist() .waitForProgressBarToNotExist()
.waitForRequestAndCheckIfNoErrors("@ProductList"); .waitForRequestAndCheckIfNoErrors("@ProductList");
expectProductsSortedBy(sortBy, false); expectProductsSortedBy(sortBy, false);
}); }
}); );
}); });
}); });

View file

@ -12,56 +12,54 @@ import {
} 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 filterTests from "../../support/filterTests";
import { import {
createFirstVariant, createFirstVariant,
createVariant, createVariant,
variantsShouldBeVisible variantsShouldBeVisible
} from "../../support/pages/catalog/products/VariantsPage"; } from "../../support/pages/catalog/products/VariantsPage";
import { import { selectChannelInHeader } from "../../support/pages/channelsPage";
enterHomePageChangeChannelAndReturn,
selectChannelInHeader
} from "../../support/pages/channelsPage";
filterTests({ definedTags: ["all", "critical", "refactored"] }, () => { describe("As an admin I should be able to create variant", () => {
describe("As an admin I should be able to create variant", () => { const startsWith = "CyCreateVariants-";
const startsWith = "CyCreateVariants-"; const attributeValues = ["value1", "value2"];
const attributeValues = ["value1", "value2"];
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
let attribute; let attribute;
let productType; let productType;
let category; let category;
let newChannel; let newChannel;
before(() => { before(() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
productUtils productUtils
.createShippingProductTypeAttributeAndCategory(name, attributeValues) .createShippingProductTypeAttributeAndCategory(name, attributeValues)
.then(resp => { .then(resp => {
attribute = resp.attribute; attribute = resp.attribute;
productType = resp.productType; productType = resp.productType;
category = resp.category; category = resp.category;
defaultChannel = resp.defaultChannel; defaultChannel = resp.defaultChannel;
warehouse = resp.warehouse; warehouse = resp.warehouse;
createChannel({ isActive: true, name, currencyCode: "USD" }); createChannel({ isActive: true, name, currencyCode: "USD" });
}) })
.then(resp => (newChannel = resp)); .then(resp => (newChannel = resp));
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest( cy.clearSessionData().loginUserViaRequest(
"auth", "auth",
ONE_PERMISSION_USERS.product ONE_PERMISSION_USERS.product
); );
}); });
it("should be able to create variant visible for the customers in all channels. TC: SALEOR_2901", () => { it(
"should be able to create variant visible for the customers in all channels. TC: SALEOR_2901",
{ tags: ["@variants", "@allEnv", "@critical", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const price = 10; const price = 10;
let createdProduct; let createdProduct;
@ -108,9 +106,13 @@ filterTests({ definedTags: ["all", "critical", "refactored"] }, () => {
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("should be able to create several variants visible for the customers. TC: SALEOR_2902", () => { it(
"should be able to create several variants visible for the customers. TC: SALEOR_2902",
{ tags: ["@variants", "@allEnv", "@critical", "@stable"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const secondVariantSku = `${startsWith}${faker.datatype.number()}`; const secondVariantSku = `${startsWith}${faker.datatype.number()}`;
const variants = [{ price: 7 }, { name: attributeValues[1], price: 16 }]; const variants = [{ price: 7 }, { name: attributeValues[1], price: 16 }];
@ -149,6 +151,6 @@ filterTests({ definedTags: ["all", "critical", "refactored"] }, () => {
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);
}); });
}); }
}); );
}); });

View file

@ -22,88 +22,86 @@ import { createWaitingForCaptureOrder } from "../../../support/api/utils/ordersU
import * as productUtils from "../../../support/api/utils/products/productsUtils"; import * as productUtils from "../../../support/api/utils/products/productsUtils";
import * as shippingUtils from "../../../support/api/utils/shippingUtils"; 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 filterTests from "../../../support/filterTests";
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";
filterTests({ definedTags: ["all", "critical"], version: "3.1.0" }, () => { describe("Creating variants", () => {
describe("Creating variants", () => { const startsWith = "CyCreateVariants-";
const startsWith = "CyCreateVariants-"; const attributeValues = ["value1", "value2"];
const attributeValues = ["value1", "value2"];
let defaultChannel; let defaultChannel;
let warehouse; let warehouse;
let attribute; let attribute;
let productType; let productType;
let simpleProductType; let simpleProductType;
let category; let category;
let shippingMethod; let shippingMethod;
let address; let address;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
shippingUtils.deleteShippingStartsWith(startsWith); shippingUtils.deleteShippingStartsWith(startsWith);
productUtils.deleteProductsStartsWith(startsWith); productUtils.deleteProductsStartsWith(startsWith);
deleteChannelsStartsWith(startsWith); deleteChannelsStartsWith(startsWith);
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const simpleProductTypeName = `${startsWith}${faker.datatype.number()}`; const simpleProductTypeName = `${startsWith}${faker.datatype.number()}`;
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(fixtureAddresses => { .then(fixtureAddresses => {
address = fixtureAddresses.usAddress; address = fixtureAddresses.usAddress;
shippingUtils.createShipping({ shippingUtils.createShipping({
channelId: defaultChannel.id, channelId: defaultChannel.id,
name, name,
address address
});
})
.then(
({
warehouse: warehouseResp,
shippingMethod: shippingMethodResp
}) => {
warehouse = warehouseResp;
shippingMethod = shippingMethodResp;
}
);
productUtils
.createTypeAttributeAndCategoryForProduct({ name, attributeValues })
.then(
({
attribute: attributeResp,
productType: productTypeResp,
category: categoryResp
}) => {
attribute = attributeResp;
productType = productTypeResp;
category = categoryResp;
createTypeProduct({
name: simpleProductTypeName,
attributeId: attribute.id,
hasVariants: false
});
}
)
.then(type => {
simpleProductType = type;
}); });
}); })
.then(
beforeEach(() => { ({ warehouse: warehouseResp, shippingMethod: shippingMethodResp }) => {
cy.clearSessionData().loginUserViaRequest( warehouse = warehouseResp;
"auth", shippingMethod = shippingMethodResp;
ONE_PERMISSION_USERS.product }
); );
}); productUtils
.createTypeAttributeAndCategoryForProduct({ name, attributeValues })
.then(
({
attribute: attributeResp,
productType: productTypeResp,
category: categoryResp
}) => {
attribute = attributeResp;
productType = productTypeResp;
category = categoryResp;
createTypeProduct({
name: simpleProductTypeName,
attributeId: attribute.id,
hasVariants: false
});
}
)
.then(type => {
simpleProductType = type;
});
});
xit("should create variant without sku by variant creator", () => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(
"auth",
ONE_PERMISSION_USERS.product
);
});
xit(
"should create variant without sku by variant creator",
{ tags: ["@products", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const price = 10; const price = 10;
let createdProduct; let createdProduct;
@ -142,9 +140,13 @@ filterTests({ definedTags: ["all", "critical"], version: "3.1.0" }, () => {
.then(({ order }) => { .then(({ order }) => {
expect(order.id).to.be.ok; expect(order.id).to.be.ok;
}); });
}); }
);
xit("should create variant without sku", () => { xit(
"should create variant without sku",
{ tags: ["@products", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const variants = [{ price: 7 }, { name: attributeValues[1], price: 16 }]; const variants = [{ price: 7 }, { name: attributeValues[1], price: 16 }];
let createdProduct; let createdProduct;
@ -187,9 +189,13 @@ filterTests({ definedTags: ["all", "critical"], version: "3.1.0" }, () => {
.then(({ order }) => { .then(({ order }) => {
expect(order.id).to.be.ok; expect(order.id).to.be.ok;
}); });
}); }
);
it("should create simple product without sku", () => { it(
"should create simple product without sku",
{ tags: ["@products", "@allEnv"] },
() => {
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
cy.visit(urlList.products) cy.visit(urlList.products)
.get(PRODUCTS_LIST.createProductBtn) .get(PRODUCTS_LIST.createProductBtn)
@ -238,6 +244,6 @@ filterTests({ definedTags: ["all", "critical"], version: "3.1.0" }, () => {
address address
}); });
}); });
}); }
}); );
}); });

View file

@ -6,13 +6,14 @@ import faker from "faker";
import { createCustomer } from "../../../support/api/requests/Customer"; import { createCustomer } from "../../../support/api/requests/Customer";
import { createReadyToFulfillOrder } from "../../../support/api/utils/ordersUtils"; import { createReadyToFulfillOrder } from "../../../support/api/utils/ordersUtils";
import { createProductWithShipping } from "../../../support/api/utils/products/productsUtils"; import { createProductWithShipping } from "../../../support/api/utils/products/productsUtils";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["all", "critical", "refactored"] }, () => { const name = `ProductsWithoutSkuInOrder${faker.datatype.number()}`;
const name = `ProductsWithoutSkuInOrder${faker.datatype.number()}`;
describe("As an admin I should be able to create order with variant without SKU", () => { describe("As an admin I should be able to create order with variant without SKU", () => {
it("should create order with variant product without sku. SALEOR_2801", () => { it(
"should create order with variant product without sku. SALEOR_2801",
{ tags: ["@products", "@allEnv", "@stable"] },
() => {
let variants; let variants;
let channel; let channel;
let shippingMethodId; let shippingMethodId;
@ -47,6 +48,6 @@ filterTests({ definedTags: ["all", "critical", "refactored"] }, () => {
.then(({ errors }) => { .then(({ errors }) => {
expect(errors, "check if no errors").to.be.empty; expect(errors, "check if no errors").to.be.empty;
}); });
}); }
}); );
}); });

View file

@ -30,96 +30,94 @@ import {
createShipping, createShipping,
deleteShippingStartsWith deleteShippingStartsWith
} from "../../../support/api/utils/shippingUtils"; } from "../../../support/api/utils/shippingUtils";
import filterTests from "../../../support/filterTests";
filterTests({ definedTags: ["all"], version: "3.1.0" }, () => { describe("Updating products without sku", () => {
describe("Updating products without sku", () => { const startsWith = "UpdateProductsSku";
const startsWith = "UpdateProductsSku";
let defaultChannel; let defaultChannel;
let address; let address;
let warehouse; let warehouse;
let shippingMethod; let shippingMethod;
let attribute; let attribute;
let category; let category;
let productTypeWithVariants; let productTypeWithVariants;
let productTypeWithoutVariants; let productTypeWithoutVariants;
let product; let product;
const name = `${startsWith}${faker.datatype.number()}`; const name = `${startsWith}${faker.datatype.number()}`;
const productTypeWithoutVariantsName = `${startsWith}${faker.datatype.number()}`; const productTypeWithoutVariantsName = `${startsWith}${faker.datatype.number()}`;
const email = "example@example.com"; const email = "example@example.com";
const attributeValues = ["value1", "value2"]; const attributeValues = ["value1", "value2"];
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
deleteShippingStartsWith(startsWith); deleteShippingStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
cy.fixture("addresses"); cy.fixture("addresses");
}) })
.then(fixtureAddresses => { .then(fixtureAddresses => {
address = fixtureAddresses.plAddress; address = fixtureAddresses.plAddress;
createShipping({ createShipping({
channelId: defaultChannel.id, channelId: defaultChannel.id,
name, name,
address address
}); });
}) })
.then( .then(
({ ({ warehouse: warehouseResp, shippingMethod: shippingMethodResp }) => {
warehouse: warehouseResp, warehouse = warehouseResp;
shippingMethod: shippingMethodResp shippingMethod = shippingMethodResp;
}) => { createTypeAttributeAndCategoryForProduct({ name, attributeValues });
warehouse = warehouseResp; }
shippingMethod = shippingMethodResp; )
createTypeAttributeAndCategoryForProduct({ name, attributeValues }); .then(
} ({
) attribute: attributeResp,
.then( productType: productTypeResp,
({ category: categoryResp
attribute: attributeResp, }) => {
productType: productTypeResp, attribute = attributeResp;
category: categoryResp productTypeWithVariants = productTypeResp;
}) => { category = categoryResp;
attribute = attributeResp;
productTypeWithVariants = productTypeResp;
category = categoryResp;
productAttributeAssignmentUpdate({
productTypeId: productTypeWithVariants.id,
attributeId: attribute.id
});
createTypeProduct({
name: productTypeWithoutVariantsName,
attributeId: attribute.id,
hasVariants: false
});
}
)
.then(productTypeResp => {
productTypeWithoutVariants = productTypeResp;
productAttributeAssignmentUpdate({ productAttributeAssignmentUpdate({
productTypeId: productTypeWithoutVariants.id, productTypeId: productTypeWithVariants.id,
attributeId: attribute.id attributeId: attribute.id
}); });
createProductInChannelWithoutVariants({ createTypeProduct({
name, name: productTypeWithoutVariantsName,
channelId: defaultChannel.id,
attributeId: attribute.id, attributeId: attribute.id,
productTypeId: productTypeWithVariants.id, hasVariants: false
categoryId: category.id
}); });
}) }
.then(productResp => (product = productResp)); )
}); .then(productTypeResp => {
productTypeWithoutVariants = productTypeResp;
productAttributeAssignmentUpdate({
productTypeId: productTypeWithoutVariants.id,
attributeId: attribute.id
});
createProductInChannelWithoutVariants({
name,
channelId: defaultChannel.id,
attributeId: attribute.id,
productTypeId: productTypeWithVariants.id,
categoryId: category.id
});
})
.then(productResp => (product = productResp));
});
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should add sku to simple product", () => { it(
"should add sku to simple product",
{ tags: ["@products", "@allEnv", "@stable"] },
() => {
const sku = "NewSkuSimpleProd"; const sku = "NewSkuSimpleProd";
const simpleProductName = `${startsWith}${faker.datatype.number()}`; const simpleProductName = `${startsWith}${faker.datatype.number()}`;
let simpleProduct; let simpleProduct;
@ -156,9 +154,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
.then(variantResp => { .then(variantResp => {
expect(variantResp.sku).to.eq(sku); expect(variantResp.sku).to.eq(sku);
}); });
}); }
);
it("should add sku to variant", () => { it(
"should add sku to variant",
{ tags: ["@products", "@allEnv", "@stable"] },
() => {
const sku = "NewSku"; const sku = "NewSku";
let variant; let variant;
createVariant({ createVariant({
@ -187,9 +189,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
.then(variantResp => { .then(variantResp => {
expect(variantResp.sku).to.equal(sku); expect(variantResp.sku).to.equal(sku);
}); });
}); }
);
it("should remove sku from variant", () => { it(
"should remove sku from variant",
{ tags: ["@products", "@allEnv", "@stable"] },
() => {
let variant; let variant;
createVariant({ createVariant({
attributeId: attribute.id, attributeId: attribute.id,
@ -219,9 +225,13 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
expect(variantResp.sku).to.be.null; expect(variantResp.sku).to.be.null;
checkIfCheckoutForVariantCanBeCompleted(variantResp); checkIfCheckoutForVariantCanBeCompleted(variantResp);
}); });
}); }
);
it("should remove sku from simple product", () => { it(
"should remove sku from simple product",
{ tags: ["@products", "@allEnv", "@stable"] },
() => {
const simpleProductName = `${startsWith}${faker.datatype.number()}`; const simpleProductName = `${startsWith}${faker.datatype.number()}`;
let simpleProduct; let simpleProduct;
createProductInChannelWithoutVariants({ createProductInChannelWithoutVariants({
@ -259,18 +269,18 @@ filterTests({ definedTags: ["all"], version: "3.1.0" }, () => {
expect(variantResp.sku).to.be.null; expect(variantResp.sku).to.be.null;
checkIfCheckoutForVariantCanBeCompleted(variantResp); checkIfCheckoutForVariantCanBeCompleted(variantResp);
}); });
});
function checkIfCheckoutForVariantCanBeCompleted(variant) {
createWaitingForCaptureOrder({
address,
channelSlug: defaultChannel.slug,
email,
shippingMethodName: shippingMethod.name,
variantsList: [variant]
}).then(({ order }) => {
expect(order.id).to.be.ok;
});
} }
}); );
function checkIfCheckoutForVariantCanBeCompleted(variant) {
createWaitingForCaptureOrder({
address,
channelSlug: defaultChannel.slug,
email,
shippingMethodName: shippingMethod.name,
variantsList: [variant]
}).then(({ order }) => {
expect(order.id).to.be.ok;
});
}
}); });

View file

@ -18,120 +18,121 @@ import {
createTypeAttributeAndCategoryForProduct, createTypeAttributeAndCategoryForProduct,
deleteProductsStartsWith deleteProductsStartsWith
} from "../../support/api/utils/products/productsUtils"; } from "../../support/api/utils/products/productsUtils";
import filterTests from "../../support/filterTests";
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";
filterTests({ definedTags: ["all"] }, () => { describe("Update products", () => {
describe("Update products", () => { const startsWith = "CyUpdateProducts-";
const startsWith = "CyUpdateProducts-"; const name = `${startsWith}${faker.datatype.number()}`;
const name = `${startsWith}${faker.datatype.number()}`; const description = faker.lorem.sentences(2);
const description = faker.lorem.sentences(2);
let defaultChannel; let defaultChannel;
let collection; let collection;
let product; let product;
let attribute; let attribute;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteProductsStartsWith(startsWith); deleteProductsStartsWith(startsWith);
deleteCollectionsStartsWith(startsWith); deleteCollectionsStartsWith(startsWith);
getDefaultChannel() getDefaultChannel()
.then(channel => { .then(channel => {
defaultChannel = channel; defaultChannel = channel;
createCollection(name); createCollection(name);
}) })
.then(collectionResp => { .then(collectionResp => {
collection = collectionResp; collection = collectionResp;
createTypeAttributeAndCategoryForProduct({ name }); createTypeAttributeAndCategoryForProduct({ name });
}) })
.then(({ attribute: attributeResp, category, productType }) => { .then(({ attribute: attributeResp, category, productType }) => {
attribute = attributeResp; attribute = attributeResp;
createProductInChannel({ createProductInChannel({
attributeId: attribute.id, attributeId: attribute.id,
categoryId: category.id, categoryId: category.id,
productTypeId: productType.id, productTypeId: productType.id,
channelId: defaultChannel.id, channelId: defaultChannel.id,
name, name,
collectionId: collection.id, collectionId: collection.id,
description description
});
})
.then(({ product: productResp }) => {
product = productResp;
}); });
}); })
.then(({ product: productResp }) => {
product = productResp;
});
});
it("Should update product", () => { it("Should update product", { tags: ["@products", "@allEnv"] }, () => {
const updatedName = `${startsWith}${faker.random.number()}`; const updatedName = `${startsWith}${faker.random.number()}`;
let updatedCategory; let updatedCategory;
let updatedCollection; let updatedCollection;
createCategory({ name: updatedName }) createCategory({ name: updatedName })
.then(categoryResp => { .then(categoryResp => {
updatedCategory = categoryResp; updatedCategory = categoryResp;
createCollection(updatedName); createCollection(updatedName);
}) })
.then(collectionResp => { .then(collectionResp => {
updatedCollection = collectionResp; updatedCollection = collectionResp;
const productData = { const productData = {
generalInfo: { generalInfo: {
name: updatedName, name: updatedName,
description: faker.lorem.sentence(), description: faker.lorem.sentence(),
rating: 3 rating: 3
},
seo: {
slug: updatedName,
title: "newTitle",
description: "New description."
},
metadata: {
private: {
metadataForm: metadataForms.private,
name: "newPrivate",
value: "value1"
}, },
seo: { public: {
slug: updatedName, metadataForm: metadataForms.public,
title: "newTitle", name: "newPublic",
description: "New description." value: "value2"
},
metadata: {
private: {
metadataForm: metadataForms.private,
name: "newPrivate",
value: "value1"
},
public: {
metadataForm: metadataForms.public,
name: "newPublic",
value: "value2"
}
},
productOrganization: {
category: updatedCategory.name,
collection: updatedCollection.name
} }
}; },
cy.clearSessionData() productOrganization: {
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product) category: updatedCategory.name,
.visit(productDetailsUrl(product.id)) collection: updatedCollection.name
.get(PRODUCT_DETAILS.collectionRemoveButtons) }
.click(); };
fillUpCommonFieldsForAllProductTypes(productData, false); cy.clearSessionData()
cy.addAliasToGraphRequest("UpdatePrivateMetadata") .loginUserViaRequest("auth", ONE_PERMISSION_USERS.product)
.addAliasToGraphRequest("UpdateMetadata") .visit(productDetailsUrl(product.id))
.addAliasToGraphRequest("ProductUpdate") .get(PRODUCT_DETAILS.collectionRemoveButtons)
.get(BUTTON_SELECTORS.confirm) .click();
.click() fillUpCommonFieldsForAllProductTypes(productData, false);
.confirmationMessageShouldDisappear() cy.addAliasToGraphRequest("UpdatePrivateMetadata")
.waitForRequestAndCheckIfNoErrors("@ProductUpdate") .addAliasToGraphRequest("UpdateMetadata")
.waitForRequestAndCheckIfNoErrors("@UpdateMetadata") .addAliasToGraphRequest("ProductUpdate")
.waitForRequestAndCheckIfNoErrors("@UpdatePrivateMetadata"); .get(BUTTON_SELECTORS.confirm)
productData.productOrganization.productType = name; .click()
productData.attribute = attribute; .confirmationMessageShouldDisappear()
cy.loginUserViaRequest("token") .waitForRequestAndCheckIfNoErrors("@ProductUpdate")
.then(() => { .waitForRequestAndCheckIfNoErrors("@UpdateMetadata")
getProductDetails(product.id, defaultChannel.slug, "auth").its( .waitForRequestAndCheckIfNoErrors("@UpdatePrivateMetadata");
"body.data.product" productData.productOrganization.productType = name;
); productData.attribute = attribute;
}) cy.loginUserViaRequest("token")
.then(resp => { .then(() => {
expectCorrectProductInformation(resp, productData); getProductDetails(product.id, defaultChannel.slug, "auth").its(
}); "body.data.product"
}); );
}); })
.then(resp => {
expectCorrectProductInformation(resp, productData);
});
});
});
it("should delete product", () => { it(
"should delete product",
{ tags: ["@products", "@allEnv", "@stable"] },
() => {
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.product) .loginUserViaRequest("auth", ONE_PERMISSION_USERS.product)
.visit(productDetailsUrl(product.id)) .visit(productDetailsUrl(product.id))
@ -149,6 +150,6 @@ filterTests({ definedTags: ["all"] }, () => {
productResp => productResp =>
expect(productResp.product, "Check if product exist").to.be.null expect(productResp.product, "Check if product exist").to.be.null
); );
}); }
}); );
}); });

View file

@ -19,7 +19,6 @@ import {
getMailActivationLinkForUserAndSubject, getMailActivationLinkForUserAndSubject,
inviteStaffMemberWithFirstPermission inviteStaffMemberWithFirstPermission
} from "../support/api/utils/users"; } from "../support/api/utils/users";
import filterTests from "../support/filterTests";
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 {
@ -28,77 +27,81 @@ import {
updateUserActiveFlag updateUserActiveFlag
} from "../support/pages/userPage"; } from "../support/pages/userPage";
filterTests({ definedTags: ["stagedOnly"] }, () => { describe("Staff members", () => {
describe("Staff members", () => { const startsWith = "StaffMembers";
const startsWith = "StaffMembers"; const password = Cypress.env("USER_PASSWORD");
const password = Cypress.env("USER_PASSWORD"); const lastName = faker.name.lastName();
const lastName = faker.name.lastName(); const email = `${startsWith}${lastName}@example.com`;
const email = `${startsWith}${lastName}@example.com`; let user;
let user;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteStaffMembersStartsWith(startsWith); deleteStaffMembersStartsWith(startsWith);
inviteStaffMemberWithFirstPermission({ email }) inviteStaffMemberWithFirstPermission({ email })
.then(({ user: userResp }) => { .then(({ user: userResp }) => {
user = userResp; user = userResp;
getMailActivationLinkForUser(email); getMailActivationLinkForUser(email);
}) })
.then(urlLink => { .then(urlLink => {
cy.clearSessionData().visit(urlLink);
fillUpSetPassword(password);
cy.clearSessionData();
});
});
beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
});
it("should invite user", () => {
const firstName = faker.name.firstName();
const emailInvite = `${startsWith}${firstName}@example.com`;
cy.visit(urlList.staffMembers)
.softExpectSkeletonIsVisible()
.get(STAFF_MEMBERS_LIST.inviteStaffMemberButton)
.click();
fillUpUserDetails(firstName, lastName, emailInvite);
getMailActivationLinkForUser(emailInvite).then(urlLink => {
cy.clearSessionData().visit(urlLink); cy.clearSessionData().visit(urlLink);
fillUpSetPassword(password); fillUpSetPassword(password);
expectWelcomeMessageIncludes(`${firstName} ${lastName}`); cy.clearSessionData();
}); });
}); });
it("should deactivate user", () => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest();
});
it("should invite user", { tags: ["@staffMembers", "@stagedOnly"] }, () => {
const firstName = faker.name.firstName();
const emailInvite = `${startsWith}${firstName}@example.com`;
cy.visit(urlList.staffMembers)
.expectSkeletonIsVisible()
.get(STAFF_MEMBERS_LIST.inviteStaffMemberButton)
.click();
fillUpUserDetails(firstName, lastName, emailInvite);
getMailActivationLinkForUser(emailInvite).then(urlLink => {
cy.clearSessionData().visit(urlLink);
fillUpSetPassword(password);
expectWelcomeMessageIncludes(`${firstName} ${lastName}`);
});
});
it(
"should deactivate user",
{ tags: ["@staffMembers", "@stagedOnly"] },
() => {
updateStaffMember({ userId: user.id, isActive: true }); updateStaffMember({ userId: user.id, isActive: true });
updateUserActiveFlag(user.id); updateUserActiveFlag(user.id);
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest("auth", { email, password }) .loginUserViaRequest("auth", { email, password })
.its("body.data.tokenCreate") .its("body.data.tokenCreate")
.then(tokenCreate => { .then(tokenCreate => {
chai expect(
.softExpect( 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", () => { it("should activate user", { tags: ["@staffMembers", "@stagedOnly"] }, () => {
updateStaffMember({ userId: user.id, isActive: false }); updateStaffMember({ userId: user.id, isActive: false });
updateUserActiveFlag(user.id); updateUserActiveFlag(user.id);
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest("auth", { email, password }) .loginUserViaRequest("auth", { email, password })
.visit(urlList.homePage); .visit(urlList.homePage);
expectWelcomeMessageIncludes(email); expectWelcomeMessageIncludes(email);
}); });
it("should remove user permissions", () => { it(
"should remove user permissions",
{ tags: ["@staffMembers", "@stagedOnly"] },
() => {
cy.visit(userDetailsUrl(user.id)) cy.visit(userDetailsUrl(user.id))
.get(STAFF_MEMBER_DETAILS.removePermissionButton) .get(STAFF_MEMBER_DETAILS.removePermissionButton)
.click() .click()
@ -117,9 +120,13 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
LEFT_MENU_SELECTORS.home LEFT_MENU_SELECTORS.home
); );
}); });
}); }
);
it("should reset password", () => { it(
"should reset password",
{ tags: ["@staffMembers", "@stagedOnly"] },
() => {
const newPassword = faker.random.alphaNumeric(8); const newPassword = faker.random.alphaNumeric(8);
updatePlugin( updatePlugin(
"mirumee.notifications.admin_email", "mirumee.notifications.admin_email",
@ -149,6 +156,6 @@ filterTests({ definedTags: ["stagedOnly"] }, () => {
.should("be.visible") .should("be.visible")
.loginUserViaRequest({ email, password: newPassword }); .loginUserViaRequest({ email, password: newPassword });
}); });
}); }
}); );
}); });

View file

@ -9,30 +9,31 @@ import {
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 filterTests from "../support/filterTests";
import { updateTranslationToCategory } from "../support/pages/translationsPage"; import { updateTranslationToCategory } from "../support/pages/translationsPage";
filterTests({ definedTags: ["all"], version: "3.0.0" }, () => { xdescribe("As an admin I want to manage translations", () => {
xdescribe("As an admin I want to manage translations", () => { const startsWith = "TestTranslations";
const startsWith = "TestTranslations"; const randomNumber = faker.datatype.number();
const randomNumber = faker.datatype.number(); const name = `${startsWith}${randomNumber}`;
const name = `${startsWith}${randomNumber}`;
let category; let category;
before(() => { before(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
deleteCategoriesStartsWith(startsWith); deleteCategoriesStartsWith(startsWith);
createCategory({ name: startsWith }).then( createCategory({ name: startsWith }).then(
categoryResp => (category = categoryResp) categoryResp => (category = categoryResp)
); );
}); });
beforeEach(() => { beforeEach(() => {
cy.clearSessionData().loginUserViaRequest(); cy.clearSessionData().loginUserViaRequest();
}); });
it("should be able to create new translation. TC:SALEOR_1701", () => { it(
"should be able to create new translation. TC:SALEOR_1701",
{ tags: ["@translations", "@stagedOnly"] },
() => {
const translatedName = `TranslatedName${randomNumber}`; const translatedName = `TranslatedName${randomNumber}`;
const translatedDescription = `TranslatedDescription${randomNumber}`; const translatedDescription = `TranslatedDescription${randomNumber}`;
const translatedSeoTitle = `TranslatedSeoTitle${randomNumber}`; const translatedSeoTitle = `TranslatedSeoTitle${randomNumber}`;
@ -55,9 +56,13 @@ filterTests({ definedTags: ["all"], version: "3.0.0" }, () => {
`TranslatedSeoDescription${randomNumber}` `TranslatedSeoDescription${randomNumber}`
); );
}); });
}); }
);
it("should be able to update translation. TC:SALEOR_1702", () => { it(
"should be able to update translation. TC:SALEOR_1702",
{ tags: ["@translations", "@stagedOnly"] },
() => {
const randomNumber = faker.datatype.number(); const randomNumber = faker.datatype.number();
const startWithUpdate = `Translations_Update_${randomNumber}`; const startWithUpdate = `Translations_Update_${randomNumber}`;
const seoTitleUpdate = `${startWithUpdate}_seoTitle`; const seoTitleUpdate = `${startWithUpdate}_seoTitle`;
@ -89,6 +94,6 @@ filterTests({ definedTags: ["all"], version: "3.0.0" }, () => {
expect(translation.seoTitle).to.eq(seoTitleUpdate); expect(translation.seoTitle).to.eq(seoTitleUpdate);
expect(translation.seoDescription).to.includes(seoDescriptionUpdate); expect(translation.seoDescription).to.includes(seoDescriptionUpdate);
}); });
}); }
}); );
}); });

View file

@ -1,5 +1,3 @@
const { softExpect } = chai;
export function expectCorrectDataInAttribute( export function expectCorrectDataInAttribute(
attribute, attribute,
{ {
@ -10,10 +8,10 @@ export function expectCorrectDataInAttribute(
valueRequired = true valueRequired = true
} }
) { ) {
softExpect(attribute.name).to.eq(attributeName); expect(attribute.name).to.eq(attributeName);
softExpect(attribute.slug).to.eq(attributeName); expect(attribute.slug).to.eq(attributeName);
softExpect(attribute.inputType).to.eq(attributeType); expect(attribute.inputType).to.eq(attributeType);
softExpect(attribute.entityType).to.eq(entityType); expect(attribute.entityType).to.eq(entityType);
softExpect(attribute.unit).to.eq(unit); expect(attribute.unit).to.eq(unit);
softExpect(attribute.valueRequired).to.eq(valueRequired); expect(attribute.valueRequired).to.eq(valueRequired);
} }

View file

@ -1,4 +1,3 @@
const { softExpect } = chai;
export function expectCorrectProductInformation(productResp, productData) { export function expectCorrectProductInformation(productResp, productData) {
expectCorrectGeneralInformation(productResp, productData.generalInfo); expectCorrectGeneralInformation(productResp, productData.generalInfo);
expectCorrectSeoInfo(productResp, productData.seo); expectCorrectSeoInfo(productResp, productData.seo);
@ -10,75 +9,67 @@ export function expectCorrectProductInformation(productResp, productData) {
expectCorrectProductOrgInfo(productResp, productData.productOrganization); expectCorrectProductOrgInfo(productResp, productData.productOrganization);
expectCorrectAttribute(productResp.attributes, productData.attribute); expectCorrectAttribute(productResp.attributes, productData.attribute);
} }
export function expectCorrectProductVariantInformation( export function expectCorrectProductVariantInformation(
variantsResp, variantsResp,
variantName, variantName,
prices prices
) { ) {
softExpect( expect(variantsResp).to.have.length(1);
expect(variantsResp).to.have.length(1), expect(variantsResp[0].sku).to.be.eq(variantName);
softExpect(variantsResp[0].sku).to.be.eq(variantName), expect(variantsResp[0].channelListings[0].costPrice.amount).to.be.eq(
softExpect(variantsResp[0].channelListings[0].costPrice.amount).to.be.eq( prices.costPrice
prices.costPrice );
), expect(variantsResp[0].channelListings[0].price.amount).to.be.eq(
softExpect(variantsResp[0].channelListings[0].price.amount).to.be.eq( prices.sellingPrice
prices.sellingPrice
)
); );
} }
function expectCorrectGeneralInformation(productResp, generalInfo) { function expectCorrectGeneralInformation(productResp, generalInfo) {
softExpect(productResp.name, "Check product name").to.be.eq(generalInfo.name); expect(productResp.name, "Check product name").to.be.eq(generalInfo.name);
softExpect(productResp.description, "Check product description").includes( expect(productResp.description, "Check product description").includes(
generalInfo.description generalInfo.description
); );
softExpect(productResp.rating, "Check product rate").to.be.eq( expect(productResp.rating, "Check product rate").to.be.eq(generalInfo.rating);
generalInfo.rating
);
} }
function expectCorrectSeoInfo(productResp, seo) { function expectCorrectSeoInfo(productResp, seo) {
softExpect(productResp.slug, "Check product slug").to.be.eq(seo.slug); expect(productResp.slug, "Check product slug").to.be.eq(seo.slug);
softExpect(productResp.seoTitle, "Check product seo title").to.be.eq( expect(productResp.seoTitle, "Check product seo title").to.be.eq(seo.title);
seo.title expect(productResp.seoDescription, "Check product seo description").to.be.eq(
seo.description
); );
softExpect(
productResp.seoDescription,
"Check product seo description"
).to.be.eq(seo.description);
} }
function expectCorrectMetadataInfo(metadataResp, expectedMetadata) { function expectCorrectMetadataInfo(metadataResp, expectedMetadata) {
softExpect( 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(
softExpect(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(
softExpect(metadataResp[0].value, "Check product metadata value").to.be.eq( expectedMetadata.value
expectedMetadata.value
)
); );
} }
function expectCorrectProductOrgInfo(productResp, productOrganization) { function expectCorrectProductOrgInfo(productResp, productOrganization) {
softExpect(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
); );
softExpect(productResp.category.name, "Check category name").to.be.eq( expect(productResp.category.name, "Check category name").to.be.eq(
productOrganization.category productOrganization.category
); );
softExpect( 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(
softExpect( productOrganization.collection
productResp.collections[0].name,
"Check collection name"
).to.be.eq(productOrganization.collection)
); );
} }
function expectCorrectAttribute(attributes, attribute) { function expectCorrectAttribute(attributes, attribute) {
softExpect( expect(attributes).to.have.length(1);
expect(attributes).to.have.length(1), expect(attributes[0].attribute.name, "Check attribute name").to.be.eq(
softExpect(attributes[0].attribute.name, "Check attribute name").to.be.eq( attribute.name
attribute.name
)
); );
} }

View file

@ -1,148 +1,62 @@
import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements"; import { SHARED_ELEMENTS } from "../../../elements/shared/sharedElements";
let isSoftAssertion = false; Cypress.Commands.add("assertVisibility", selector => {
let errors = [];
chai.softExpect = function(...args) {
isSoftAssertion = true;
return chai.expect(...args);
};
chai.softAssert = function(...args) {
isSoftAssertion = true;
return chai.assert(...args);
};
const origAssert = chai.Assertion.prototype.assert;
chai.Assertion.prototype.assert = function(...args) {
if (isSoftAssertion) {
try {
origAssert.call(this, ...args);
} catch (error) {
errors.push(error);
}
isSoftAssertion = false;
} else {
origAssert.call(this, ...args);
}
};
// monkey-patch `Cypress.log` so that the last `cy.then()` isn't logged to command log
const origLog = Cypress.log;
Cypress.log = function(data) {
if (data && data.error && /soft assertions/i.test(data.error.message)) {
data.error.message = "\n\n\t" + data.error.message + "\n\n";
throw data.error;
}
return origLog.call(Cypress, ...arguments);
};
// monkey-patch `it` callback so we insert `cy.then()` as a last command
// to each test case where we'll assert if there are any soft assertion errors
function itCallback(func) {
func();
cy.then(() => {
if (errors.length) {
const _ = Cypress._;
let msg = "";
if (Cypress.browser.isHeaded) {
msg = "Failed soft assertions... check log above ↑";
} else {
_.each(errors, error => {
msg += "\n" + error;
});
msg = msg.replace(/^/gm, "\t");
}
throw new Error(msg);
}
});
}
const origIt = window.it;
window.it = (title, func) => {
origIt(title, func && (() => itCallback(func)));
};
window.it.only = (title, func) => {
origIt.only(title, func && (() => itCallback(func)));
};
window.it.skip = (title, func) => {
origIt.skip(title, func);
};
beforeEach(() => {
errors = [];
});
afterEach(() => {
errors = [];
isSoftAssertion = false;
});
Cypress.Commands.add("softAssertMatch", (selector, regexp) => {
cy.get(selector)
.invoke("text")
.then(text =>
chai.softExpect(assert.match(text, regexp, "regexp matches"))
);
});
Cypress.Commands.add("softAssertVisibility", selector => {
cy.get(selector).then( cy.get(selector).then(
element => element => expect(element, "element should be visible").to.be.visible
chai.softExpect(element, "element should be visible").to.be.visible
); );
}); });
Cypress.Commands.add( Cypress.Commands.add(
"expectCorrectBasicAddress", "expectCorrectBasicAddress",
(responseAddress, expectedAddress) => { (responseAddress, expectedAddress) => {
chai expect(responseAddress.city.toUpperCase()).to.eq(
.softExpect(responseAddress.city.toUpperCase()) expectedAddress.city.toUpperCase()
.to.eq(expectedAddress.city.toUpperCase()); );
chai expect(responseAddress).to.have.property(
.softExpect(responseAddress) "countryArea",
.to.have.property("countryArea", expectedAddress.countryArea); expectedAddress.countryArea
chai );
.softExpect(responseAddress) expect(responseAddress).to.have.property("phone", expectedAddress.phone);
.to.have.property("phone", expectedAddress.phone); expect(responseAddress).to.have.property(
chai "postalCode",
.softExpect(responseAddress) expectedAddress.postalCode
.to.have.property("postalCode", expectedAddress.postalCode); );
chai expect(responseAddress).to.have.property(
.softExpect(responseAddress) "streetAddress1",
.to.have.property("streetAddress1", expectedAddress.streetAddress1); expectedAddress.streetAddress1
chai );
.softExpect(responseAddress) expect(responseAddress).to.have.property(
.to.have.property("streetAddress2", expectedAddress.streetAddress2); "streetAddress2",
expectedAddress.streetAddress2
);
} }
); );
Cypress.Commands.add( Cypress.Commands.add(
"expectCorrectFullAddress", "expectCorrectFullAddress",
(responseAddress, expectedAddress) => { (responseAddress, expectedAddress) => {
chai expect(responseAddress).to.have.property(
.softExpect(responseAddress) "firstName",
.to.have.property("firstName", expectedAddress.firstName); expectedAddress.firstName
chai );
.softExpect(responseAddress) expect(responseAddress).to.have.property(
.to.have.property("firstName", expectedAddress.lastName); "firstName",
expectedAddress.lastName
);
cy.expectCorrectBasicAddress(responseAddress, expectedAddress); cy.expectCorrectBasicAddress(responseAddress, expectedAddress);
} }
); );
Cypress.Commands.add("softExpectSkeletonIsVisible", () => { Cypress.Commands.add("expectSkeletonIsVisible", () => {
cy.get(SHARED_ELEMENTS.circularProgress).should("not.exist"); cy.get(SHARED_ELEMENTS.circularProgress).should("not.exist");
cy.get(SHARED_ELEMENTS.progressBar).should("be.visible"); cy.get(SHARED_ELEMENTS.progressBar).should("be.visible");
cy.get("body").then($body => { cy.get("body").then($body => {
if ($body.find(SHARED_ELEMENTS.skeleton).length) { if ($body.find(SHARED_ELEMENTS.skeleton).length) {
cy.softAssertVisibility(SHARED_ELEMENTS.skeleton); cy.assertVisibility(SHARED_ELEMENTS.skeleton);
} else { } else {
chai expect(
.softExpect( $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);
} }
}); });
}); });

20
cypress/support/cypress-grep/index.d.ts vendored Normal file
View file

@ -0,0 +1,20 @@
/// <reference types="cypress" />
declare namespace Cypress {
// specify additional properties in the TestConfig object
// in our case we will add "tags" property
interface TestConfigOverrides {
/**
* List of tags for this test
* @example a single tag
* it('logs in', { tags: '@smoke' }, () => { ... })
* @example multiple tags
* it('works', { tags: ['@smoke', '@slow'] }, () => { ... })
*/
tags?: string | string[];
}
interface Cypress {
grep?: (grep?: string, tags?: string, burn?: string) => void;
}
}

View file

@ -0,0 +1,137 @@
/* eslint-disable @typescript-eslint/no-var-requires */
/* eslint-disable no-console */
const debug = require("debug")("cypress-grep");
const globby = require("globby");
const { getTestNames } = require("find-test-names");
const fs = require("fs");
const path = require("path");
const { version } = 10;
const { resolveConfig, parseGrep, shouldTestRun } = require("./utils");
/**
* Prints the cypress-grep environment values if any.
* @param {Cypress.PluginConfigOptions} config
*/
function cypressGrepPlugin(config) {
if (!config || !config.env) {
return config;
}
const { env } = config;
debug("cypress-grep plugin version %s", version);
debug("Cypress config env object: %o", env);
const grep = env.grep ? String(env.grep) : undefined;
if (grep) {
console.log('cypress-grep: tests with "%s" in their names', grep.trim());
}
const grepTags = env.grepTags || env["grep-tags"];
if (grepTags) {
console.log('cypress-grep: filtering using tag(s) "%s"', grepTags);
const parsedGrep = parseGrep(null, grepTags);
debug("parsed grep tags %o", parsedGrep.tags);
}
const grepBurn = env.grepBurn || env["grep-burn"] || env.burn;
if (grepBurn) {
console.log("cypress-grep: running filtered tests %d times", grepBurn);
}
const grepUntagged = env.grepUntagged || env["grep-untagged"];
if (grepUntagged) {
console.log("cypress-grep: running untagged tests");
}
const omitFiltered = env.grepOmitFiltered || env["grep-omit-filtered"];
if (omitFiltered) {
console.log("cypress-grep: will omit filtered tests");
}
const { resolvedConfig } = resolveConfig(config);
const { specPattern, excludeSpecPattern, integrationFolder } = resolvedConfig;
const grepFilterSpecs = env.grepFilterSpecs === true;
if (grepFilterSpecs) {
debug(resolvedConfig);
const specFiles = globby.sync(specPattern, {
cwd: integrationFolder,
ignore: excludeSpecPattern,
absolute: true
});
debug("found %d spec files", specFiles.length);
debug("%o", specFiles);
let greppedSpecs = [];
if (grep) {
console.log(
'cypress-grep: filtering specs using "%s" in the title',
grep
);
const parsedGrep = parseGrep(grep);
debug("parsed grep %o", parsedGrep);
greppedSpecs = specFiles.filter(specFile => {
const text = fs.readFileSync(specFile, { encoding: "utf8" });
try {
const names = getTestNames(text);
const testAndSuiteNames = names.suiteNames.concat(names.testNames);
debug("spec file %s", specFile);
debug("suite and test names: %o", testAndSuiteNames);
return testAndSuiteNames.some(name => {
const shouldRun = shouldTestRun(parsedGrep, name);
return shouldRun;
});
} catch (err) {
debug(err.message);
debug(err.stack);
console.error("Could not determine test names in file: %s", specFile);
console.error("Will run it to let the grep filter the tests");
return true;
}
});
debug('found grep "%s" in %d specs', grep, greppedSpecs.length);
debug("%o", greppedSpecs);
} else if (grepTags) {
const parsedGrep = parseGrep(null, grepTags);
debug("parsed grep tags %o", parsedGrep);
greppedSpecs = specFiles.filter(specFile => {
const text = fs.readFileSync(specFile, { encoding: "utf8" });
try {
const testInfo = getTestNames(text);
debug("spec file %s", specFile);
debug("test info: %o", testInfo.tests);
return testInfo.tests.some(info => {
const shouldRun = shouldTestRun(parsedGrep, null, info.tags);
return shouldRun;
});
} catch (err) {
console.error("Could not determine test names in file: %s", specFile);
console.error("Will run it to let the grep filter the tests");
return true;
}
});
debug('found grep tags "%s" in %d specs', grepTags, greppedSpecs.length);
debug("%o", greppedSpecs);
}
if (greppedSpecs.length) {
config.specPattern = greppedSpecs;
console.log(config.specPattern);
} else {
// hmm, we filtered out all specs, probably something is wrong
console.warn("grep and/or grepTags has eliminated all specs");
if (grep) {
console.warn("grep: %s", grep);
}
if (grepTags) {
console.warn("grepTags: %s", grepTags);
}
console.warn("Will leave all specs to run to filter at run-time");
}
}
return config;
}
module.exports = cypressGrepPlugin;

View file

@ -0,0 +1,217 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const { parseGrep, shouldTestRun } = require("./utils");
const version = 10;
const debug = require("debug")("cypress-grep");
debug.log = console.info.bind(console);
// preserve the real "it" function
const _it = it;
const _describe = describe;
/**
* Wraps the "it" and "describe" functions that support tags.
* @see https://github.com/cypress-io/cypress-grep
*/
function cypressGrep() {
/** @type {string} Part of the test title go grep */
let grep = Cypress.env("grep");
if (grep) {
grep = String(grep).trim();
}
/** @type {string} Raw tags to grep string */
const grepTags = Cypress.env("grepTags") || Cypress.env("grep-tags");
const burnSpecified =
Cypress.env("grepBurn") || Cypress.env("grep-burn") || Cypress.env("burn");
const grepUntagged =
Cypress.env("grepUntagged") || Cypress.env("grep-untagged");
if (!grep && !grepTags && !burnSpecified && !grepUntagged) {
// nothing to do, the user has no specified the "grep" string
debug("Nothing to grep, version %s", version);
return;
}
/** @type {number} Number of times to repeat each running test */
const grepBurn =
Cypress.env("grepBurn") ||
Cypress.env("grep-burn") ||
Cypress.env("burn") ||
1;
/** @type {boolean} Omit filtered tests completely */
const omitFiltered =
Cypress.env("grepOmitFiltered") || Cypress.env("grep-omit-filtered");
debug("grep %o", { grep, grepTags, grepBurn, omitFiltered, version });
if (!Cypress._.isInteger(grepBurn) || grepBurn < 1) {
throw new Error(`Invalid grep burn value: ${grepBurn}`);
}
const parsedGrep = parseGrep(grep, grepTags);
debug("parsed grep %o", parsedGrep);
// prevent multiple registrations
// https://github.com/cypress-io/cypress-grep/issues/59
if (it.name === "itGrep") {
debug("already registered cypress-grep");
return;
}
it = function itGrep(name, options, callback) {
if (typeof options === "function") {
// the test has format it('...', cb)
callback = options;
options = {};
}
if (!callback) {
// the pending test by itself
return _it(name, options);
}
let configTags = options && options.tags;
if (typeof configTags === "string") {
configTags = [configTags];
}
const nameToGrep = suiteStack
.map(item => item.name)
.concat(name)
.join(" ");
const tagsToGrep = suiteStack
.flatMap(item => item.tags)
.concat(configTags)
.filter(Boolean);
const shouldRun = shouldTestRun(
parsedGrep,
nameToGrep,
tagsToGrep,
grepUntagged
);
if (tagsToGrep && tagsToGrep.length) {
debug(
'should test "%s" with tags %s run? %s',
name,
tagsToGrep.join(","),
shouldRun
);
} else {
debug('should test "%s" run? %s', nameToGrep, shouldRun);
}
if (shouldRun) {
if (grepBurn > 1) {
// repeat the same test to make sure it is solid
return Cypress._.times(grepBurn, k => {
const fullName = `${name}: burning ${k + 1} of ${grepBurn}`;
_it(fullName, options, callback);
});
}
return _it(name, options, callback);
}
if (omitFiltered) {
// omit the filtered tests completely
return;
} else {
// skip tests without grep string in their names
return _it.skip(name, options, callback);
}
};
// list of "describe" suites for the current test
// when we encounter a new suite, we push it to the stack
// when the "describe" function exits, we pop it
// Thus a test can look up the tags from its parent suites
const suiteStack = [];
describe = function describeGrep(name, options, callback) {
if (typeof options === "function") {
// the block has format describe('...', cb)
callback = options;
options = {};
}
const stackItem = { name };
suiteStack.push(stackItem);
if (!callback) {
// the pending suite by itself
const result = _describe(name, options);
suiteStack.pop();
return result;
}
let configTags = options && options.tags;
if (typeof configTags === "string") {
configTags = [configTags];
}
if (!configTags || !configTags.length) {
// if the describe suite does not have explicit tags
// move on, since the tests inside can have their own tags
_describe(name, options, callback);
suiteStack.pop();
return;
}
// when looking at the suite of the tests, I found
// that using the name is quickly becoming very confusing
// and thus we need to use the explicit tags
stackItem.tags = configTags;
_describe(name, options, callback);
suiteStack.pop();
return;
};
// overwrite "context" which is an alias to "describe"
context = describe;
// overwrite "specify" which is an alias to "it"
specify = it;
// keep the ".skip", ".only" methods the same as before
it.skip = _it.skip;
it.only = _it.only;
// preserve "it.each" method if found
// https://github.com/cypress-io/cypress-grep/issues/72
if (typeof _it.each === "function") {
it.each = _it.each;
}
describe.skip = _describe.skip;
describe.only = _describe.only;
if (typeof _describe.each === "function") {
describe.each = _describe.each;
}
}
function restartTests() {
setTimeout(() => {
window.top.document.querySelector(".reporter .restart").click();
}, 0);
}
if (!Cypress.grep) {
Cypress.grep = function grep(grep, tags, burn) {
Cypress.env("grep", grep);
Cypress.env("grepTags", tags);
Cypress.env("grepBurn", burn);
// remove any aliased values
Cypress.env("grep-tags", null);
Cypress.env("grep-burn", null);
Cypress.env("burn", null);
debug('set new grep to "%o" restarting tests', { grep, tags, burn });
restartTests();
};
}
module.exports = cypressGrep;

View file

@ -0,0 +1,195 @@
// @ts-check
// Universal code - should run in Node or in the browser
/**
* Parses test title grep string.
* The string can have "-" in front of it to invert the match.
* @param {string} s Input substring of the test title
*/
function parseTitleGrep(s) {
if (!s || typeof s !== "string") {
return null;
}
s = s.trim();
if (s.startsWith("-")) {
return {
title: s.substring(1),
invert: true
};
}
return {
title: s,
invert: false
};
}
function parseFullTitleGrep(s) {
if (!s || typeof s !== "string") {
return [];
}
// separate each title
return s.split(";").map(parseTitleGrep);
}
/**
* Parses tags to grep for.
* @param {string} s Tags string like "@tag1+@tag2"
*/
function parseTagsGrep(s) {
if (!s) {
return [];
}
const explicitNotTags = [];
// top level split - using space or comma, each part is OR
const ORS = s
.split(/[ ,]/)
// remove any empty tags
.filter(Boolean)
.map(part => {
// now every part is an AND
if (part.startsWith("--")) {
explicitNotTags.push({
tag: part.slice(2),
invert: true
});
return;
}
const parsed = part.split("+").map(tag => {
if (tag.startsWith("-")) {
return {
tag: tag.slice(1),
invert: true
};
} else {
return {
tag,
invert: false
};
}
});
return parsed;
});
// filter out undefined from explicit not tags
const ORS_filtered = ORS.filter(x => x !== undefined);
if (explicitNotTags.length > 0) {
ORS_filtered.forEach((OR, index) => {
ORS_filtered[index] = OR.concat(explicitNotTags);
});
}
return ORS_filtered;
}
function shouldTestRunTags(parsedGrepTags, tags = []) {
if (!parsedGrepTags.length) {
// there are no parsed tags to search for, the test should run
return true;
}
// now the test has tags and the parsed tags are present
// top levels are OR
const onePartMatched = parsedGrepTags.some(orPart => {
const everyAndPartMatched = orPart.every(p => {
if (p.invert) {
return !tags.includes(p.tag);
}
return tags.includes(p.tag);
});
// console.log('every part matched %o?', orPart, everyAndPartMatched)
return everyAndPartMatched;
});
// console.log('onePartMatched', onePartMatched)
return onePartMatched;
}
function shouldTestRunTitle(parsedGrep, testName) {
if (!testName) {
// if there is no title, let it run
return true;
}
if (!parsedGrep) {
return true;
}
if (!Array.isArray(parsedGrep)) {
console.error("Invalid parsed title grep");
console.error(parsedGrep);
throw new Error("Expected title grep to be an array");
}
if (!parsedGrep.length) {
return true;
}
const inverted = parsedGrep.filter(g => g.invert);
const straight = parsedGrep.filter(g => !g.invert);
return (
inverted.every(titleGrep => !testName.includes(titleGrep.title)) &&
(!straight.length ||
straight.some(titleGrep => testName.includes(titleGrep.title)))
);
}
// note: tags take precedence over the test name
function shouldTestRun(parsedGrep, testName, tags = [], grepUntagged = false) {
if (grepUntagged) {
return !tags.length;
}
if (Array.isArray(testName)) {
// the caller passed tags only, no test name
tags = testName;
testName = undefined;
}
return (
shouldTestRunTitle(parsedGrep.title, testName) &&
shouldTestRunTags(parsedGrep.tags, tags)
);
}
function parseGrep(titlePart, tags) {
return {
title: parseFullTitleGrep(titlePart),
tags: parseTagsGrep(tags)
};
}
function resolveConfig(config) {
const specPattern = config.specPattern || "";
let excludeSpecPattern = config.excludeSpecPattern || "";
if (typeof excludeSpecPattern === "string") {
excludeSpecPattern = [excludeSpecPattern];
}
const integrationFolder = config.env.grepIntegrationFolder || process.cwd();
return {
resolvedConfig: {
specPattern,
excludeSpecPattern,
integrationFolder
}
};
}
module.exports = {
parseGrep,
parseTitleGrep,
parseFullTitleGrep,
parseTagsGrep,
resolveConfig,
shouldTestRun,
shouldTestRunTags,
shouldTestRunTitle
};

View file

@ -16,10 +16,14 @@ import "cypress-file-upload";
import "cypress-mochawesome-reporter/register"; import "cypress-mochawesome-reporter/register";
import { commandTimings } from "cypress-timings"; import { commandTimings } from "cypress-timings";
import cypressGrep from "../support/cypress-grep/support";
commandTimings(); commandTimings();
import { urlList } from "../fixtures/urlList"; import { urlList } from "../fixtures/urlList";
cypressGrep();
Cypress.Commands.add("clearSessionData", () => { Cypress.Commands.add("clearSessionData", () => {
cy.clearCookies(); cy.clearCookies();
cy.clearLocalStorage(); cy.clearLocalStorage();

View file

@ -13,7 +13,6 @@ declare namespace Cypress {
startsWith: string, startsWith: string,
name? = string name? = string
): Chainable<any>; ): Chainable<any>;
softExpectSkeletonIsVisible(): Chainable<any>;
expectCorrectFullAddress( expectCorrectFullAddress(
responseAddress: string, responseAddress: string,
expectedAddress: string expectedAddress: string
@ -22,8 +21,6 @@ declare namespace Cypress {
responseAddress: string, responseAddress: string,
expectedAddress: string expectedAddress: string
): Chainable<any>; ): Chainable<any>;
softAssertVisibility(selector: string): Chainable<any>;
softAssertMatch(selector: string, regexp: string): Chainable<any>;
getTextFromElement(element: {}): Chainable<any>; getTextFromElement(element: {}): Chainable<any>;
clearAndType(subject: {}, text: string): Chainable<any>; clearAndType(subject: {}, text: string): Chainable<any>;
loginUser(): Chainable<any>; loginUser(): Chainable<any>;

View file

@ -111,6 +111,6 @@ function submitFilters() {
export function enterProductListPage() { export function enterProductListPage() {
cy.visit(urlList.products) cy.visit(urlList.products)
.softExpectSkeletonIsVisible() .expectSkeletonIsVisible()
.waitForProgressBarToNotExist(); .waitForProgressBarToNotExist();
} }

View file

@ -100,7 +100,7 @@ export function createSaleWithNewProduct({
*/ */
cy.visit(urlList.sales); cy.visit(urlList.sales);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
const product = productResp; const product = productResp;
createSale({ createSale({
saleName: name, saleName: name,
@ -138,7 +138,7 @@ export function createSaleWithNewVariant({
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.discount) .loginUserViaRequest("auth", ONE_PERMISSION_USERS.discount)
*/ */
cy.visit(urlList.sales); cy.visit(urlList.sales);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
const variant = variantsListResp[0]; const variant = variantsListResp[0];
createSale({ createSale({
saleName: name, saleName: name,

View file

@ -100,7 +100,7 @@ export function loginAndCreateCheckoutForVoucherWithDiscount({
cy.clearSessionData() cy.clearSessionData()
.loginUserViaRequest("auth", ONE_PERMISSION_USERS.discount) .loginUserViaRequest("auth", ONE_PERMISSION_USERS.discount)
.visit(urlList.vouchers); .visit(urlList.vouchers);
cy.softExpectSkeletonIsVisible(); cy.expectSkeletonIsVisible();
createVoucher({ createVoucher({
voucherCode, voucherCode,
voucherValue, voucherValue,

291
package-lock.json generated
View file

@ -7927,7 +7927,6 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.0.tgz",
"integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==", "integrity": "sha512-ZpClVKqXN3RGBmKibdfWzqCY4lnjEuoNzU5T0oEFpfd/z5qJHVarukridD4juLO2FXMiwUQxr9WqQtaYa8XRYw==",
"dev": true,
"requires": { "requires": {
"string-width": "^3.0.0" "string-width": "^3.0.0"
}, },
@ -7935,20 +7934,17 @@
"emoji-regex": { "emoji-regex": {
"version": "7.0.3", "version": "7.0.3",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-7.0.3.tgz",
"integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA==", "integrity": "sha512-CwBLREIQ7LvYFB0WyRvwhq5N5qPhc6PMjD6bYggFlI5YyDgl+0vxq5VHbMOFqLg7hfWzmu8T5Z1QofhmTIhItA=="
"dev": true
}, },
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
"integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
"dev": true
}, },
"string-width": { "string-width": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
"integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==", "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
"dev": true,
"requires": { "requires": {
"emoji-regex": "^7.0.1", "emoji-regex": "^7.0.1",
"is-fullwidth-code-point": "^2.0.0", "is-fullwidth-code-point": "^2.0.0",
@ -8317,8 +8313,7 @@
"array-union": { "array-union": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz",
"integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw=="
"dev": true
}, },
"array-uniq": { "array-uniq": {
"version": "1.0.3", "version": "1.0.3",
@ -10721,8 +10716,7 @@
"ci-info": { "ci-info": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
"integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ=="
"dev": true
}, },
"cipher-base": { "cipher-base": {
"version": "1.0.4", "version": "1.0.4",
@ -10782,8 +10776,7 @@
"cli-boxes": { "cli-boxes": {
"version": "2.2.1", "version": "2.2.1",
"resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz", "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-2.2.1.tgz",
"integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw==", "integrity": "sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw=="
"dev": true
}, },
"cli-cursor": { "cli-cursor": {
"version": "2.1.0", "version": "2.1.0",
@ -11006,7 +10999,6 @@
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz", "resolved": "https://registry.npmjs.org/clone-response/-/clone-response-1.0.2.tgz",
"integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=", "integrity": "sha1-0dyXOSAxTfZ/vrlCI7TuNQI56Ws=",
"dev": true,
"requires": { "requires": {
"mimic-response": "^1.0.0" "mimic-response": "^1.0.0"
} }
@ -11246,7 +11238,6 @@
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz",
"integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==",
"dev": true,
"requires": { "requires": {
"dot-prop": "^5.2.0", "dot-prop": "^5.2.0",
"graceful-fs": "^4.1.2", "graceful-fs": "^4.1.2",
@ -11260,7 +11251,6 @@
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
"integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==",
"dev": true,
"requires": { "requires": {
"semver": "^6.0.0" "semver": "^6.0.0"
} }
@ -11268,14 +11258,12 @@
"semver": { "semver": {
"version": "6.3.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
"dev": true
}, },
"write-file-atomic": { "write-file-atomic": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz",
"integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==",
"dev": true,
"requires": { "requires": {
"imurmurhash": "^0.1.4", "imurmurhash": "^0.1.4",
"is-typedarray": "^1.0.0", "is-typedarray": "^1.0.0",
@ -11738,8 +11726,7 @@
"crypto-random-string": { "crypto-random-string": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz",
"integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA=="
"dev": true
}, },
"css-jss": { "css-jss": {
"version": "10.6.0", "version": "10.6.0",
@ -12677,8 +12664,7 @@
"deep-extend": { "deep-extend": {
"version": "0.6.0", "version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
"integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA=="
"dev": true
}, },
"deep-is": { "deep-is": {
"version": "0.1.4", "version": "0.1.4",
@ -13025,7 +13011,6 @@
"version": "3.0.1", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz",
"integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==",
"dev": true,
"requires": { "requires": {
"path-type": "^4.0.0" "path-type": "^4.0.0"
} }
@ -13220,7 +13205,6 @@
"version": "5.3.0", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz",
"integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==",
"dev": true,
"requires": { "requires": {
"is-obj": "^2.0.0" "is-obj": "^2.0.0"
}, },
@ -13228,8 +13212,7 @@
"is-obj": { "is-obj": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz",
"integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
"dev": true
} }
} }
}, },
@ -13286,8 +13269,7 @@
"duplexer3": { "duplexer3": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz", "resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
"integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI=", "integrity": "sha1-7gHdHKwO08vH/b6jfcCo8c4ALOI="
"dev": true
}, },
"duplexify": { "duplexify": {
"version": "3.7.1", "version": "3.7.1",
@ -13413,7 +13395,6 @@
"version": "1.4.4", "version": "1.4.4",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz",
"integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==", "integrity": "sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==",
"dev": true,
"requires": { "requires": {
"once": "^1.4.0" "once": "^1.4.0"
} }
@ -13941,8 +13922,7 @@
"escape-goat": { "escape-goat": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz", "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-2.1.1.tgz",
"integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q==", "integrity": "sha512-8/uIhbG12Csjy2JEW7D9pHbreaVaS/OpN3ycnyvElTdwM5n6GY6W6e2IPemfvGZeUMqZ9A/3GqIZMgKnBhAw/Q=="
"dev": true
}, },
"escape-html": { "escape-html": {
"version": "1.0.3", "version": "1.0.3",
@ -15741,6 +15721,87 @@
"integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==",
"dev": true "dev": true
}, },
"find-test-names": {
"version": "1.17.1",
"resolved": "https://registry.npmjs.org/find-test-names/-/find-test-names-1.17.1.tgz",
"integrity": "sha512-vfEqh/WHoe23kCsmTPwv2V6KDsjbt5zkOhOfNi69ZDw65l/vdST1MU81x7mHnbeMgBoQOPouFpnyazzgXTRBng==",
"requires": {
"@babel/parser": "^7.16.5",
"acorn-walk": "^8.2.0",
"debug": "^4.3.3",
"globby": "^11.0.4",
"simple-bin-help": "^1.7.6"
},
"dependencies": {
"@babel/parser": {
"version": "7.18.5",
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.18.5.tgz",
"integrity": "sha512-YZWVaglMiplo7v8f1oMQ5ZPQr0vn7HPeZXxXWsxXJRjGVrzUFn9OxFQl1sb5wzfootjA/yChhW84BV+383FSOw=="
},
"acorn-walk": {
"version": "8.2.0",
"resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz",
"integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA=="
},
"debug": {
"version": "4.3.4",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz",
"integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==",
"requires": {
"ms": "2.1.2"
}
},
"fast-glob": {
"version": "3.2.11",
"resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.11.tgz",
"integrity": "sha512-xrO3+1bxSo3ZVHAnqzyuewYT6aMFHRAd4Kcs92MAonjwQZLsK9d0SF1IyQ3k5PoirxTW0Oe/RqFgMQ6TcNE5Ew==",
"requires": {
"@nodelib/fs.stat": "^2.0.2",
"@nodelib/fs.walk": "^1.2.3",
"glob-parent": "^5.1.2",
"merge2": "^1.3.0",
"micromatch": "^4.0.4"
}
},
"globby": {
"version": "11.1.0",
"resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz",
"integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==",
"requires": {
"array-union": "^2.1.0",
"dir-glob": "^3.0.1",
"fast-glob": "^3.2.9",
"ignore": "^5.2.0",
"merge2": "^1.4.1",
"slash": "^3.0.0"
}
},
"ignore": {
"version": "5.2.0",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
"integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ=="
},
"merge2": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
"integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg=="
},
"micromatch": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz",
"integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==",
"requires": {
"braces": "^3.0.2",
"picomatch": "^2.3.1"
}
},
"picomatch": {
"version": "2.3.1",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz",
"integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA=="
}
}
},
"find-up": { "find-up": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
@ -16910,8 +16971,7 @@
"has-yarn": { "has-yarn": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz", "resolved": "https://registry.npmjs.org/has-yarn/-/has-yarn-2.1.0.tgz",
"integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw==", "integrity": "sha512-UqBRqi4ju7T+TqGNdqAO0PaSVGsDGJUBQvk9eUWNGRY1CFGDzYhLWoM7JQEemnlvVcv/YEmc2wNW8BC24EnUsw=="
"dev": true
}, },
"hash-base": { "hash-base": {
"version": "3.1.0", "version": "3.1.0",
@ -17308,8 +17368,7 @@
"http-cache-semantics": { "http-cache-semantics": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz", "resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
"integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ==", "integrity": "sha512-carPklcUh7ROWRK7Cv27RPtdhYhUsela/ue5/jKzjegVvXDqM2ILE9Q2BGn9JZJh1g87cp56su/FgQSzcWS8cQ=="
"dev": true
}, },
"http-deceiver": { "http-deceiver": {
"version": "1.2.7", "version": "1.2.7",
@ -17766,8 +17825,7 @@
"import-lazy": { "import-lazy": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz", "resolved": "https://registry.npmjs.org/import-lazy/-/import-lazy-2.1.0.tgz",
"integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM=", "integrity": "sha1-BWmOPUXIjo1+nZLLBYTnfwlvPkM="
"dev": true
}, },
"import-local": { "import-local": {
"version": "2.0.0", "version": "2.0.0",
@ -17782,8 +17840,7 @@
"imurmurhash": { "imurmurhash": {
"version": "0.1.4", "version": "0.1.4",
"resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
"integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o="
"dev": true
}, },
"indefinite-observable": { "indefinite-observable": {
"version": "2.0.1", "version": "2.0.1",
@ -17828,8 +17885,7 @@
"ini": { "ini": {
"version": "1.3.8", "version": "1.3.8",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
"integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew=="
"dev": true
}, },
"inquirer": { "inquirer": {
"version": "7.3.3", "version": "7.3.3",
@ -18110,7 +18166,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz", "resolved": "https://registry.npmjs.org/is-ci/-/is-ci-2.0.0.tgz",
"integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==", "integrity": "sha512-YfJT7rkpQB0updsdHLGWrvhBJfcfzNNawYDNIyQXJz0IViGf75O8EBPKSdvw2rF+LGCsX4FZ8tcr3b19LcZq4w==",
"dev": true,
"requires": { "requires": {
"ci-info": "^2.0.0" "ci-info": "^2.0.0"
} }
@ -18307,8 +18362,7 @@
"is-npm": { "is-npm": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz", "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-5.0.0.tgz",
"integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA==", "integrity": "sha512-WW/rQLOazUq+ST/bCAVBp/2oMERWLsR7OrKyt052dNDk4DHcDE0/7QSXITlmi+VBcV13DfIbysG3tZJm5RfdBA=="
"dev": true
}, },
"is-number": { "is-number": {
"version": "7.0.0", "version": "7.0.0",
@ -18365,8 +18419,7 @@
"is-path-inside": { "is-path-inside": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz", "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-3.0.3.tgz",
"integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==", "integrity": "sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ=="
"dev": true
}, },
"is-plain-obj": { "is-plain-obj": {
"version": "1.1.0", "version": "1.1.0",
@ -18499,8 +18552,7 @@
"is-typedarray": { "is-typedarray": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo="
"dev": true
}, },
"is-unc-path": { "is-unc-path": {
"version": "1.0.0", "version": "1.0.0",
@ -18573,8 +18625,7 @@
"is-yarn-global": { "is-yarn-global": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz", "resolved": "https://registry.npmjs.org/is-yarn-global/-/is-yarn-global-0.3.0.tgz",
"integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw==", "integrity": "sha512-VjSeb/lHmkoyd8ryPVIKvOCn4D1koMqY+vqyjjUfc3xyKtP4dYOxM44sZrnqQSzSds3xyOrUTLTC9LVCVgLngw=="
"dev": true
}, },
"isarray": { "isarray": {
"version": "0.0.1", "version": "0.0.1",
@ -20763,7 +20814,6 @@
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz", "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-5.1.0.tgz",
"integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==", "integrity": "sha512-weT+r0kTkRQdCdYCNtkMwWXQTMEswKrFBkm4ckQOMVhhqhIMI1UT2hMj+1iigIhgSZm5gTmrRXBNoGUgaTY1xA==",
"dev": true,
"requires": { "requires": {
"package-json": "^6.3.0" "package-json": "^6.3.0"
} }
@ -21999,8 +22049,7 @@
"mimic-response": { "mimic-response": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz", "resolved": "https://registry.npmjs.org/mimic-response/-/mimic-response-1.0.1.tgz",
"integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ==", "integrity": "sha512-j5EctnkH7amfV/q5Hgmoal1g2QHFJRraOtmx0JpIqkxhBhI/lJSl1nMpQ45hVarwNETOoWEimndZ4QK0RHxuxQ=="
"dev": true
}, },
"min-document": { "min-document": {
"version": "2.19.0", "version": "2.19.0",
@ -22091,8 +22140,7 @@
"minimist": { "minimist": {
"version": "1.2.5", "version": "1.2.5",
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz",
"integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw=="
"dev": true
}, },
"minipass": { "minipass": {
"version": "3.1.3", "version": "3.1.3",
@ -22786,8 +22834,7 @@
"ms": { "ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
"dev": true
}, },
"multicast-dns": { "multicast-dns": {
"version": "6.2.3", "version": "6.2.3",
@ -23625,7 +23672,6 @@
"version": "6.5.0", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz", "resolved": "https://registry.npmjs.org/package-json/-/package-json-6.5.0.tgz",
"integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==", "integrity": "sha512-k3bdm2n25tkyxcjSKzB5x8kfVxlMdgsbPr0GkZcwHsLpba6cBjqCt1KlcChKEvxHIcTB1FVMuwoijZ26xex5MQ==",
"dev": true,
"requires": { "requires": {
"got": "^9.6.0", "got": "^9.6.0",
"registry-auth-token": "^4.0.0", "registry-auth-token": "^4.0.0",
@ -23636,14 +23682,12 @@
"@sindresorhus/is": { "@sindresorhus/is": {
"version": "0.14.0", "version": "0.14.0",
"resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-0.14.0.tgz",
"integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==", "integrity": "sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ=="
"dev": true
}, },
"@szmarczak/http-timer": { "@szmarczak/http-timer": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz", "resolved": "https://registry.npmjs.org/@szmarczak/http-timer/-/http-timer-1.1.2.tgz",
"integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==", "integrity": "sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==",
"dev": true,
"requires": { "requires": {
"defer-to-connect": "^1.0.1" "defer-to-connect": "^1.0.1"
} }
@ -23652,7 +23696,6 @@
"version": "6.1.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz",
"integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==", "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==",
"dev": true,
"requires": { "requires": {
"clone-response": "^1.0.2", "clone-response": "^1.0.2",
"get-stream": "^5.1.0", "get-stream": "^5.1.0",
@ -23667,7 +23710,6 @@
"version": "5.2.0", "version": "5.2.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.2.0.tgz",
"integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==", "integrity": "sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==",
"dev": true,
"requires": { "requires": {
"pump": "^3.0.0" "pump": "^3.0.0"
} }
@ -23675,8 +23717,7 @@
"lowercase-keys": { "lowercase-keys": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
"integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA==", "integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="
"dev": true
} }
} }
}, },
@ -23684,7 +23725,6 @@
"version": "3.3.0", "version": "3.3.0",
"resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz", "resolved": "https://registry.npmjs.org/decompress-response/-/decompress-response-3.3.0.tgz",
"integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=", "integrity": "sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=",
"dev": true,
"requires": { "requires": {
"mimic-response": "^1.0.0" "mimic-response": "^1.0.0"
} }
@ -23692,14 +23732,12 @@
"defer-to-connect": { "defer-to-connect": {
"version": "1.1.3", "version": "1.1.3",
"resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz", "resolved": "https://registry.npmjs.org/defer-to-connect/-/defer-to-connect-1.1.3.tgz",
"integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ==", "integrity": "sha512-0ISdNousHvZT2EiFlZeZAHBUvSxmKswVCEf8hW7KWgG4a8MVEu/3Vb6uWYozkjylyCxe0JBIiRB1jV45S70WVQ=="
"dev": true
}, },
"get-stream": { "get-stream": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
"integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==", "integrity": "sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==",
"dev": true,
"requires": { "requires": {
"pump": "^3.0.0" "pump": "^3.0.0"
} }
@ -23708,7 +23746,6 @@
"version": "9.6.0", "version": "9.6.0",
"resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz", "resolved": "https://registry.npmjs.org/got/-/got-9.6.0.tgz",
"integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==", "integrity": "sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==",
"dev": true,
"requires": { "requires": {
"@sindresorhus/is": "^0.14.0", "@sindresorhus/is": "^0.14.0",
"@szmarczak/http-timer": "^1.1.2", "@szmarczak/http-timer": "^1.1.2",
@ -23726,14 +23763,12 @@
"json-buffer": { "json-buffer": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz", "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.0.tgz",
"integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg=", "integrity": "sha1-Wx85evx11ne96Lz8Dkfh+aPZqJg="
"dev": true
}, },
"keyv": { "keyv": {
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz", "resolved": "https://registry.npmjs.org/keyv/-/keyv-3.1.0.tgz",
"integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==", "integrity": "sha512-9ykJ/46SN/9KPM/sichzQ7OvXyGDYKGTaDlKMGCAlg2UK8KRy4jb0d8sFc+0Tt0YYnThq8X2RZgCg74RPxgcVA==",
"dev": true,
"requires": { "requires": {
"json-buffer": "3.0.0" "json-buffer": "3.0.0"
} }
@ -23741,26 +23776,22 @@
"lowercase-keys": { "lowercase-keys": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz", "resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-1.0.1.tgz",
"integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA==", "integrity": "sha512-G2Lj61tXDnVFFOi8VZds+SoQjtQC3dgokKdDG2mTm1tx4m50NUHBOZSBwQQHyy0V12A0JTG4icfZQH+xPyh8VA=="
"dev": true
}, },
"normalize-url": { "normalize-url": {
"version": "4.5.0", "version": "4.5.0",
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.5.0.tgz",
"integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ==", "integrity": "sha512-2s47yzUxdexf1OhyRi4Em83iQk0aPvwTddtFz4hnSSw9dCEsLEGf6SwIO8ss/19S9iBb5sJaOuTvTGDeZI00BQ=="
"dev": true
}, },
"p-cancelable": { "p-cancelable": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz", "resolved": "https://registry.npmjs.org/p-cancelable/-/p-cancelable-1.1.0.tgz",
"integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw==", "integrity": "sha512-s73XxOZ4zpt1edZYZzvhqFa6uvQc1vwUa0K0BdtIZgQMAJj9IbebH+JkgKZc9h+B05PKHLOTl4ajG1BmNrVZlw=="
"dev": true
}, },
"responselike": { "responselike": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz", "resolved": "https://registry.npmjs.org/responselike/-/responselike-1.0.2.tgz",
"integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=", "integrity": "sha1-kYcg7ztjHFZCvgaPFa3lpG9Loec=",
"dev": true,
"requires": { "requires": {
"lowercase-keys": "^1.0.0" "lowercase-keys": "^1.0.0"
} }
@ -23768,8 +23799,7 @@
"semver": { "semver": {
"version": "6.3.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
"dev": true
} }
} }
}, },
@ -24098,8 +24128,7 @@
"path-type": { "path-type": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz",
"integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw=="
"dev": true
}, },
"pause-stream": { "pause-stream": {
"version": "0.0.11", "version": "0.0.11",
@ -24750,7 +24779,6 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz",
"integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==", "integrity": "sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==",
"dev": true,
"requires": { "requires": {
"end-of-stream": "^1.1.0", "end-of-stream": "^1.1.0",
"once": "^1.3.1" "once": "^1.3.1"
@ -24789,7 +24817,6 @@
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz", "resolved": "https://registry.npmjs.org/pupa/-/pupa-2.1.1.tgz",
"integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==", "integrity": "sha512-l1jNAspIBSFqbT+y+5FosojNpVpF94nlI+wDUpqP9enwOTfHx9f0gh5nB96vl+6yTpsJsypeNrwfzPrKuHB41A==",
"dev": true,
"requires": { "requires": {
"escape-goat": "^2.0.0" "escape-goat": "^2.0.0"
} }
@ -24949,7 +24976,6 @@
"version": "1.2.8", "version": "1.2.8",
"resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
"integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
"dev": true,
"requires": { "requires": {
"deep-extend": "^0.6.0", "deep-extend": "^0.6.0",
"ini": "~1.3.0", "ini": "~1.3.0",
@ -24960,8 +24986,7 @@
"strip-json-comments": { "strip-json-comments": {
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
"integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo="
"dev": true
} }
} }
}, },
@ -26404,7 +26429,6 @@
"version": "4.2.1", "version": "4.2.1",
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz", "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-4.2.1.tgz",
"integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==", "integrity": "sha512-6gkSb4U6aWJB4SF2ZvLb76yCBjcvufXBqvvEx1HbmKPkutswjW1xNVRY0+daljIYRbogN7O0etYSlbiaEQyMyw==",
"dev": true,
"requires": { "requires": {
"rc": "^1.2.8" "rc": "^1.2.8"
} }
@ -26413,7 +26437,6 @@
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz", "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-5.1.0.tgz",
"integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==", "integrity": "sha512-8acYXXTI0AkQv6RAOjE3vOaIXZkT9wo4LOFbBKYQEEnnMNBpKqdUrI6S4NT0KPIo/WVvJ5tE/X5LF/TQUf0ekw==",
"dev": true,
"requires": { "requires": {
"rc": "^1.2.8" "rc": "^1.2.8"
} }
@ -27805,7 +27828,6 @@
"version": "7.3.5", "version": "7.3.5",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz",
"integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==",
"dev": true,
"requires": { "requires": {
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
}, },
@ -27814,7 +27836,6 @@
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz",
"integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==",
"dev": true,
"requires": { "requires": {
"yallist": "^4.0.0" "yallist": "^4.0.0"
} }
@ -27822,8 +27843,7 @@
"yallist": { "yallist": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
"integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
"dev": true
} }
} }
}, },
@ -27836,7 +27856,6 @@
"version": "3.1.1", "version": "3.1.1",
"resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz", "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-3.1.1.tgz",
"integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==", "integrity": "sha512-GX0Ix/CJcHyB8c4ykpHGIAvLyOwOobtM/8d+TQkAd81/bEjgPHrfba41Vpesr7jX/t8Uh+R3EX9eAS5be+jQYg==",
"dev": true,
"requires": { "requires": {
"semver": "^6.3.0" "semver": "^6.3.0"
}, },
@ -27844,8 +27863,7 @@
"semver": { "semver": {
"version": "6.3.0", "version": "6.3.0",
"resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
"integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
"dev": true
} }
} }
}, },
@ -28218,8 +28236,7 @@
"signal-exit": { "signal-exit": {
"version": "3.0.3", "version": "3.0.3",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
"integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA==", "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
"dev": true
}, },
"signedsource": { "signedsource": {
"version": "1.0.0", "version": "1.0.0",
@ -28227,6 +28244,26 @@
"integrity": "sha1-HdrOSYF5j5O9gzlzgD2A1S6TrWo=", "integrity": "sha1-HdrOSYF5j5O9gzlzgD2A1S6TrWo=",
"dev": true "dev": true
}, },
"simple-bin-help": {
"version": "1.7.7",
"resolved": "https://registry.npmjs.org/simple-bin-help/-/simple-bin-help-1.7.7.tgz",
"integrity": "sha512-e36uqSXbTL0yNUc7RgjMFAEMDgV5jbPd18LrCeswZJ7aUtEq0qPf4rroQyW3Tfl1E7rcsW1amZoV3OCGOne1Tg==",
"requires": {
"debug": "3.2.7",
"update-notifier": "5.1.0",
"word-wrap": "1.2.3"
},
"dependencies": {
"debug": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
"requires": {
"ms": "^2.1.1"
}
}
}
},
"simplebar": { "simplebar": {
"version": "4.2.3", "version": "4.2.3",
"resolved": "https://registry.npmjs.org/simplebar/-/simplebar-4.2.3.tgz", "resolved": "https://registry.npmjs.org/simplebar/-/simplebar-4.2.3.tgz",
@ -28279,8 +28316,7 @@
"slash": { "slash": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz",
"integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q=="
"dev": true
}, },
"slice-ansi": { "slice-ansi": {
"version": "0.0.4", "version": "0.0.4",
@ -30031,8 +30067,7 @@
"to-readable-stream": { "to-readable-stream": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz", "resolved": "https://registry.npmjs.org/to-readable-stream/-/to-readable-stream-1.0.0.tgz",
"integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q==", "integrity": "sha512-Iq25XBt6zD5npPhlLVXGFN3/gyR2/qODcKNNyTMd4vbm39HUaOiAM4PMq0eMVC/Tkxz+Zjdsc55g9yyz+Yq00Q=="
"dev": true
}, },
"to-regex": { "to-regex": {
"version": "3.0.2", "version": "3.0.2",
@ -30409,7 +30444,6 @@
"version": "3.1.5", "version": "3.1.5",
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
"integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==",
"dev": true,
"requires": { "requires": {
"is-typedarray": "^1.0.0" "is-typedarray": "^1.0.0"
} }
@ -30572,7 +30606,6 @@
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz",
"integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==",
"dev": true,
"requires": { "requires": {
"crypto-random-string": "^2.0.0" "crypto-random-string": "^2.0.0"
} }
@ -30723,7 +30756,6 @@
"version": "5.1.0", "version": "5.1.0",
"resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz", "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-5.1.0.tgz",
"integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==", "integrity": "sha512-ItnICHbeMh9GqUy31hFPrD1kcuZ3rpxDZbf4KUDavXwS0bW5m7SLbDQpGX3UYr072cbrF5hFUs3r5tUsPwjfHw==",
"dev": true,
"requires": { "requires": {
"boxen": "^5.0.0", "boxen": "^5.0.0",
"chalk": "^4.1.0", "chalk": "^4.1.0",
@ -30745,7 +30777,6 @@
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/boxen/-/boxen-5.0.1.tgz", "resolved": "https://registry.npmjs.org/boxen/-/boxen-5.0.1.tgz",
"integrity": "sha512-49VBlw+PrWEF51aCmy7QIteYPIFZxSpvqBdP/2itCPPlJ49kj9zg/XPRFrdkne2W+CfwXUls8exMvu1RysZpKA==", "integrity": "sha512-49VBlw+PrWEF51aCmy7QIteYPIFZxSpvqBdP/2itCPPlJ49kj9zg/XPRFrdkne2W+CfwXUls8exMvu1RysZpKA==",
"dev": true,
"requires": { "requires": {
"ansi-align": "^3.0.0", "ansi-align": "^3.0.0",
"camelcase": "^6.2.0", "camelcase": "^6.2.0",
@ -30760,14 +30791,12 @@
"camelcase": { "camelcase": {
"version": "6.2.0", "version": "6.2.0",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.0.tgz",
"integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg==", "integrity": "sha512-c7wVvbw3f37nuobQNtgsgG9POC9qMbNuMQmTCqZv23b6MIz0fcYpBiOlv9gEN/hdLdnZTDQhg6e9Dq5M1vKvfg=="
"dev": true
}, },
"chalk": { "chalk": {
"version": "4.1.0", "version": "4.1.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
"integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==", "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
"dev": true,
"requires": { "requires": {
"ansi-styles": "^4.1.0", "ansi-styles": "^4.1.0",
"supports-color": "^7.1.0" "supports-color": "^7.1.0"
@ -30777,7 +30806,6 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz", "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-3.0.0.tgz",
"integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==", "integrity": "sha512-v8ho2DS5RiCjftj1nD9NmnfaOzTdud7RRnVd9kFNOjqZbISlx5DQ+OrTkywgd0dIt7oFCvKetZSHoHcP3sDdiA==",
"dev": true,
"requires": { "requires": {
"ini": "2.0.0" "ini": "2.0.0"
} }
@ -30785,20 +30813,17 @@
"has-flag": { "has-flag": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
"dev": true
}, },
"ini": { "ini": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ini/-/ini-2.0.0.tgz",
"integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA==", "integrity": "sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA=="
"dev": true
}, },
"is-installed-globally": { "is-installed-globally": {
"version": "0.4.0", "version": "0.4.0",
"resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz", "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-0.4.0.tgz",
"integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==", "integrity": "sha512-iwGqO3J21aaSkC7jWnHP/difazwS7SFeIqxv6wEtLU8Y5KlzFTjyqcSIT0d8s4+dDhKytsk9PJZ2BkS5eZwQRQ==",
"dev": true,
"requires": { "requires": {
"global-dirs": "^3.0.0", "global-dirs": "^3.0.0",
"is-path-inside": "^3.0.2" "is-path-inside": "^3.0.2"
@ -30808,7 +30833,6 @@
"version": "7.2.0", "version": "7.2.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
"dev": true,
"requires": { "requires": {
"has-flag": "^4.0.0" "has-flag": "^4.0.0"
} }
@ -30816,8 +30840,7 @@
"type-fest": { "type-fest": {
"version": "0.20.2", "version": "0.20.2",
"resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz",
"integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ=="
"dev": true
} }
} }
}, },
@ -30937,7 +30960,6 @@
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz", "resolved": "https://registry.npmjs.org/url-parse-lax/-/url-parse-lax-3.0.0.tgz",
"integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=", "integrity": "sha1-FrXK/Afb42dsGxmZF3gj1lA6yww=",
"dev": true,
"requires": { "requires": {
"prepend-http": "^2.0.0" "prepend-http": "^2.0.0"
}, },
@ -30945,8 +30967,7 @@
"prepend-http": { "prepend-http": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=", "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
"dev": true
} }
} }
}, },
@ -32152,7 +32173,6 @@
"version": "3.1.0", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz", "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-3.1.0.tgz",
"integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==", "integrity": "sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg==",
"dev": true,
"requires": { "requires": {
"string-width": "^4.0.0" "string-width": "^4.0.0"
} }
@ -32238,8 +32258,7 @@
"word-wrap": { "word-wrap": {
"version": "1.2.3", "version": "1.2.3",
"resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz",
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ=="
"dev": true
}, },
"workbox-background-sync": { "workbox-background-sync": {
"version": "6.1.5", "version": "6.1.5",
@ -32526,7 +32545,6 @@
"version": "7.0.0", "version": "7.0.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
"integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
"dev": true,
"requires": { "requires": {
"ansi-styles": "^4.0.0", "ansi-styles": "^4.0.0",
"string-width": "^4.1.0", "string-width": "^4.1.0",
@ -32536,14 +32554,12 @@
"ansi-regex": { "ansi-regex": {
"version": "5.0.0", "version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==", "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
"dev": true
}, },
"ansi-styles": { "ansi-styles": {
"version": "4.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": { "requires": {
"color-convert": "^2.0.1" "color-convert": "^2.0.1"
} }
@ -32552,7 +32568,6 @@
"version": "2.0.1", "version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": { "requires": {
"color-name": "~1.1.4" "color-name": "~1.1.4"
} }
@ -32560,26 +32575,22 @@
"color-name": { "color-name": {
"version": "1.1.4", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
"dev": true
}, },
"emoji-regex": { "emoji-regex": {
"version": "8.0.0", "version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
"dev": true
}, },
"is-fullwidth-code-point": { "is-fullwidth-code-point": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
"dev": true
}, },
"string-width": { "string-width": {
"version": "4.2.2", "version": "4.2.2",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.2.tgz",
"integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==", "integrity": "sha512-XBJbT3N4JhVumXE0eoLU9DCjcaF92KLNqTmFCnG1pf8duUxFGwtP6AD6nkjw9a3IdiRtL3E2w3JDiE/xi3vOeA==",
"dev": true,
"requires": { "requires": {
"emoji-regex": "^8.0.0", "emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0", "is-fullwidth-code-point": "^3.0.0",
@ -32590,7 +32601,6 @@
"version": "6.0.0", "version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==", "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"dev": true,
"requires": { "requires": {
"ansi-regex": "^5.0.0" "ansi-regex": "^5.0.0"
} }
@ -32630,8 +32640,7 @@
"xdg-basedir": { "xdg-basedir": {
"version": "4.0.0", "version": "4.0.0",
"resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz",
"integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q=="
"dev": true
}, },
"xml": { "xml": {
"version": "1.0.1", "version": "1.0.1",

View file

@ -47,6 +47,7 @@
"editorjs-inline-tool": "^0.4.0", "editorjs-inline-tool": "^0.4.0",
"faker": "^5.1.0", "faker": "^5.1.0",
"fast-array-diff": "^0.2.0", "fast-array-diff": "^0.2.0",
"find-test-names": "^1.17.1",
"fuzzaldrin": "^2.1.0", "fuzzaldrin": "^2.1.0",
"graphql": "^15.4.0", "graphql": "^15.4.0",
"hotkeys-js": "^3.8.1", "hotkeys-js": "^3.8.1",
@ -266,19 +267,13 @@
"start": "npm run build-types && webpack-dev-server -d", "start": "npm run build-types && webpack-dev-server -d",
"storybook": "start-storybook -p 3000 -c src/storybook/", "storybook": "start-storybook -p 3000 -c src/storybook/",
"cy:run": "cypress run", "cy:run": "cypress run",
"cy:run:report": "cypress run --env tags=all --reporter cypress-mochawesome-reporter --reporter-options reportDir='cypress/reports',overwrite=true,charts=true",
"cy:combine:reports": "npx mochawesome-merge 'cypress/results/*.json' > mochawesome.json",
"cy:run:merge": "npx marge mochawesome.json",
"cy:run:dashboard": "cypress run --record", "cy:run:dashboard": "cypress run --record",
"cy:open": "cypress open", "cy:open": "cypress open",
"cy:run:refactored:locally": "cypress run --env tags=refactored --spec cypress/e2e/navigation.js,cypress/e2e/products/createProduct.js,cypress/e2e/products/productsVariants.js --reporter cypress-mochawesome-reporter --reporter-options reportDir='cypress/reports',overwrite=true,charts=true", "cy:run:critical": "cypress run --record --env grepTags=@critical",
"cy:run:critical": "cypress run --record --env tags=critical --spec cypress/e2e/navigation.js,cypress/e2e/products/createProduct.js,cypress/e2e/products/productsVariants.js --tag Critical, PR Deploy", "cy:run:allEnv": "cypress run --record --env grepTags=@allEnv",
"cy:run:allEnv": "cypress run --record --env tags=all", "cy:run:critical:parallel": "cypress run --record --env grepTags=@critical --parallel --tag Critical",
"cy:run:critical:parallel": "cypress run --record --env tags=critical --spec cypress/e2e/navigation.js,cypress/e2e/products/createProduct.js,cypress/e2e/products/productsVariants.js --parallel --tag Critical", "cy:run:allEnv:parallel": "cypress run --record --env grepTags=@allEnv --parallel",
"cy:run:allEnv:parallel": "cypress run --record --env tags=all --parallel", "cy:run:stable:parallel": "cypress run --record --env grepTags=@critical --parallel --tag Stable",
"test:e2e:run": "start-server-and-test start http://localhost:9000 cy:run",
"test:e2e:run:record": "start-server-and-test start http://localhost:9000 cy:run:record",
"test:e2e:dev": "start-server-and-test start http://localhost:9000 cy:open",
"test": "TZ=UTC jest src/", "test": "TZ=UTC jest src/",
"lint": "npx eslint \"src/**/*.@(tsx|ts|jsx|js)\" --fix ; npx prettier --check \"src/**/*.@(tsx|ts|jsx|js)\" --write", "lint": "npx eslint \"src/**/*.@(tsx|ts|jsx|js)\" --fix ; npx prettier --check \"src/**/*.@(tsx|ts|jsx|js)\" --write",
"postbuild": "rimraf ./build/**/*.js.map", "postbuild": "rimraf ./build/**/*.js.map",

View file

@ -17,5 +17,5 @@
}, },
"resolveJsonModule": true "resolveJsonModule": true
}, },
"exclude": ["node_modules"] "exclude": ["node_modules", "cypress"]
} }