From 9450be744a7b27bcd15ba93b1459767e655769a7 Mon Sep 17 00:00:00 2001 From: wbuezas Date: Wed, 16 Oct 2024 14:08:10 -0300 Subject: [PATCH] Creation of first tests, commands, and flow --- cypress.config.js | 6 ++ package.json | 6 +- src/composables/useNotify.js | 5 +- src/layouts/MainLayout.vue | 8 +- src/pages/Ecomerce/CatalogCard.vue | 15 ++- src/pages/Ecomerce/CatalogView.vue | 14 ++- .../cypress/integration/UserFlows.spec.js | 66 ++----------- .../integration/catalog/CatalogView.spec.js | 16 ++++ .../catalog/CatalogViewCommands.js | 22 +++++ .../checkout/CheckoutStepper.spec.js | 23 +++++ .../checkout/CheckoutStepperCommands.js | 95 +++++++++++++++++++ .../integration/login/LoginViewCommands.js | 69 ++++++++++++++ src/test/cypress/support/commands.js | 71 +++----------- 13 files changed, 293 insertions(+), 123 deletions(-) create mode 100644 src/test/cypress/integration/catalog/CatalogView.spec.js create mode 100644 src/test/cypress/integration/catalog/CatalogViewCommands.js create mode 100644 src/test/cypress/integration/checkout/CheckoutStepper.spec.js create mode 100644 src/test/cypress/integration/checkout/CheckoutStepperCommands.js create mode 100644 src/test/cypress/integration/login/LoginViewCommands.js diff --git a/cypress.config.js b/cypress.config.js index a6a3def7..7ec39405 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -6,6 +6,12 @@ module.exports = defineConfig({ supportFile: 'src/test/cypress/support/index.js', fixturesFolder: 'src/test/cypress/fixtures', specPattern: 'src/test/cypress/integration/**/*.spec.js', + viewportHeight: 660, + viewportWidth: 1240, + experimentalMemoryManagement: true, + numTestsKeptInMemory: 0, + video: false, + screenshotOnRunFailure: false, setupNodeEvents(on, config) { // implement node event listeners here } diff --git a/package.json b/package.json index c386547c..eb2dd589 100644 --- a/package.json +++ b/package.json @@ -69,8 +69,10 @@ "scripts": { "front": "webpack serve --open", "back": "cd ../vn-database && myvc start && cd ../salix && gulp backOnly", - "cy:open": "cypress open", - "test:e2e": "cypress run", + "cy:open": "cd ../salix && gulp docker && cd ../hedera-web && cypress open", + "test:e2e": "cd ../salix && gulp docker && cd ../hedera-web && cypress run", + "cy:open-mindshore": "cd ../salix && gulp docker && cd ../hedera-web-mindshore && cypress open", + "test:e2e-mindshore": "cd ../salix && gulp docker && cd ../hedera-web-mindshore && cypress run", "build": "rm -rf build/ ; webpack", "clean": "rm -rf build/", "lint": "eslint --ext .js,.vue ./" diff --git a/src/composables/useNotify.js b/src/composables/useNotify.js index aa8d68f3..8c0175fa 100644 --- a/src/composables/useNotify.js +++ b/src/composables/useNotify.js @@ -12,7 +12,10 @@ export default function useNotify() { Notify.create({ message: i18n.global.t(message), type, - icon: icon || defaultIcons[type] + icon: icon || defaultIcons[type], + attrs: { + 'data-testid': `${type}Notify` + } }); }; diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index d3262f91..4cc19c21 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -88,7 +88,13 @@ const logoutSupplantedUser = async () => {
{{ mainUser?.nickname }} - +
diff --git a/src/pages/Ecomerce/CatalogCard.vue b/src/pages/Ecomerce/CatalogCard.vue index a53ce109..d8680c1d 100644 --- a/src/pages/Ecomerce/CatalogCard.vue +++ b/src/pages/Ecomerce/CatalogCard.vue @@ -15,7 +15,12 @@ const { t } = useI18n();