From c1e3019b4f1232840744d8f1465ce6cd629d0244 Mon Sep 17 00:00:00 2001 From: Walter Date: Sun, 14 Apr 2024 14:25:35 +0300 Subject: [PATCH 1/2] unignore e2e files from prettier --- .prettierignore | 1 - .../ios/App/App.xcodeproj/project.pbxproj | 3 +- apps/mobile-mzima-client/package-lock.json | 74 ++++++++++++++----- apps/mobile-mzima-client/package.json | 5 +- package-lock.json | 43 +++++++---- 5 files changed, 87 insertions(+), 39 deletions(-) diff --git a/.prettierignore b/.prettierignore index 64b5bfc1ee..405e0cf95b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,6 +1,5 @@ node_modules documentation -e2e package-lock.json diff --git a/apps/mobile-mzima-client/ios/App/App.xcodeproj/project.pbxproj b/apps/mobile-mzima-client/ios/App/App.xcodeproj/project.pbxproj index b4fb52b272..9fe24d9ef6 100644 --- a/apps/mobile-mzima-client/ios/App/App.xcodeproj/project.pbxproj +++ b/apps/mobile-mzima-client/ios/App/App.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 54; + objectVersion = 63; objects = { /* Begin PBXBuildFile section */ @@ -142,6 +142,7 @@ Base, ); mainGroup = 504EC2FB1FED79650016851F; + minimizedProjectReferenceProxies = 1; productRefGroup = 504EC3051FED79650016851F /* Products */; projectDirPath = ""; projectRoot = ""; diff --git a/apps/mobile-mzima-client/package-lock.json b/apps/mobile-mzima-client/package-lock.json index 66f72a57cf..3977633cf2 100644 --- a/apps/mobile-mzima-client/package-lock.json +++ b/apps/mobile-mzima-client/package-lock.json @@ -10,26 +10,27 @@ "license": "MIT", "dependencies": { "@capacitor-community/intercom": "^5.0.0", - "@capacitor/android": "^5.0.0", - "@capacitor/app": "^5.0.0", - "@capacitor/camera": "^5.0.0", + "@capacitor/android": "^5.6.0", + "@capacitor/app": "^5.0.6", + "@capacitor/camera": "^5.0.8", "@capacitor/core": "^5.0.0", - "@capacitor/device": "^5.0.0", - "@capacitor/dialog": "^5.0.0", - "@capacitor/filesystem": "^5.0.0", - "@capacitor/geolocation": "^5.0.0", + "@capacitor/device": "^5.0.6", + "@capacitor/dialog": "^5.0.6", + "@capacitor/filesystem": "^5.2.0", + "@capacitor/geolocation": "^5.0.6", "@capacitor/haptics": "^5.0.0", "@capacitor/ios": "^5.0.0", "@capacitor/keyboard": "^5.0.0", - "@capacitor/network": "^5.0.0", - "@capacitor/share": "^5.0.0", + "@capacitor/network": "^5.0.6", + "@capacitor/share": "^5.0.6", "@capacitor/splash-screen": "^5.0.0", - "@capacitor/status-bar": "^5.0.0", - "capacitor-native-settings": "^5.0.1" + "@capacitor/status-bar": "^5.0.6", + "capacitor-native-settings": "^5.0.1", + "formidable": "^3.5.1" }, "devDependencies": { "@capacitor/assets": "^3.0.4", - "@capacitor/cli": "^5.0.0" + "@capacitor/cli": "^5.6.0" } }, "node_modules/@babel/code-frame": { @@ -734,6 +735,11 @@ "node": ">=0.10.0" } }, + "node_modules/asap": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", + "integrity": "sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==" + }, "node_modules/astral-regex": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", @@ -1565,6 +1571,15 @@ "node": ">=8" } }, + "node_modules/dezalgo": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/dezalgo/-/dezalgo-1.0.4.tgz", + "integrity": "sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==", + "dependencies": { + "asap": "^2.0.0", + "wrappy": "1" + } + }, "node_modules/diff": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/diff/-/diff-5.1.0.tgz", @@ -1808,11 +1823,14 @@ } }, "node_modules/formidable": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", - "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==", - "deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau", - "dev": true, + "version": "3.5.1", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-3.5.1.tgz", + "integrity": "sha512-WJWKelbRHN41m5dumb0/k8TeAx7Id/y3a+Z7QfhxP/htI9Js5zYaEDtG8uMgG0vM0lOlqnmjE99/kfpOYi/0Og==", + "dependencies": { + "dezalgo": "^1.0.4", + "hexoid": "^1.0.0", + "once": "^1.4.0" + }, "funding": { "url": "https://ko-fi.com/tunnckoCore/commissions" } @@ -2216,6 +2234,14 @@ "he": "bin/he" } }, + "node_modules/hexoid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hexoid/-/hexoid-1.0.0.tgz", + "integrity": "sha512-QFLV0taWQOZtvIRIAdBChesmogZrtuXvVWsFHZTk2SU+anspqZ2vMnoLg7IE1+Uk16N19APic1BuF8bC8c2m5g==", + "engines": { + "node": ">=8" + } + }, "node_modules/hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -2845,6 +2871,16 @@ "xpath": "0.0.27" } }, + "node_modules/mergexml/node_modules/formidable": { + "version": "1.2.6", + "resolved": "https://registry.npmjs.org/formidable/-/formidable-1.2.6.tgz", + "integrity": "sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ==", + "deprecated": "Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau", + "dev": true, + "funding": { + "url": "https://ko-fi.com/tunnckoCore/commissions" + } + }, "node_modules/mergexml/node_modules/xpath": { "version": "0.0.27", "resolved": "https://registry.npmjs.org/xpath/-/xpath-0.0.27.tgz", @@ -3207,7 +3243,6 @@ "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, "dependencies": { "wrappy": "1" } @@ -4914,8 +4949,7 @@ "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" }, "node_modules/xcode": { "version": "3.0.1", diff --git a/apps/mobile-mzima-client/package.json b/apps/mobile-mzima-client/package.json index 73a5d32bb9..b4790c0e30 100644 --- a/apps/mobile-mzima-client/package.json +++ b/apps/mobile-mzima-client/package.json @@ -21,10 +21,11 @@ "@capacitor/share": "^5.0.6", "@capacitor/splash-screen": "^5.0.0", "@capacitor/status-bar": "^5.0.6", - "capacitor-native-settings": "^5.0.1" + "capacitor-native-settings": "^5.0.1", + "formidable": "^3.5.1" }, "devDependencies": { "@capacitor/assets": "^3.0.4", "@capacitor/cli": "^5.6.0" } -} \ No newline at end of file +} diff --git a/package-lock.json b/package-lock.json index b44770663b..ea5b7c7d67 100644 --- a/package-lock.json +++ b/package-lock.json @@ -34,7 +34,6 @@ "@supy-io/ngx-intercom": "^14.2.12", "@swimlane/ngx-charts": "^20.1.2", "angular-google-tag-manager": "^1.6.1", - "capacitor-native-settings": "^5.0.1", "dayjs": "^1.11.7", "ion2-calendar": "^3.5.0", "ionicons": "^7.1.0", @@ -92,6 +91,7 @@ "@types/quill": "^1.3.10", "@typescript-eslint/eslint-plugin": "5.59.2", "@typescript-eslint/parser": "5.59.2", + "cross-env": "^7.0.3", "eslint": "~8.18.0", "eslint-config-airbnb-typescript": "^17.0.0", "eslint-config-prettier": "^8.7.0", @@ -9128,14 +9128,6 @@ } ] }, - "node_modules/capacitor-native-settings": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/capacitor-native-settings/-/capacitor-native-settings-5.0.1.tgz", - "integrity": "sha512-HH7GCyaVLwWP4FEVqvOQM+cHWveQUjsA2128wfZ5yr9eOQrECVWzO5UXH9ZlikpWi1C7exnovcyEr3TlYO6l8w==", - "peerDependencies": { - "@capacitor/core": "^5.0.0" - } - }, "node_modules/caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -9767,6 +9759,24 @@ "integrity": "sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw==", "dev": true }, + "node_modules/cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.1" + }, + "bin": { + "cross-env": "src/bin/cross-env.js", + "cross-env-shell": "src/bin/cross-env-shell.js" + }, + "engines": { + "node": ">=10.14", + "npm": ">=6", + "yarn": ">=1" + } + }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -30402,12 +30412,6 @@ "integrity": "sha512-Bud7abqjvEjipUkpLs4D7gR0l8hBYBHoa+tGtKJHvT2AYzLp1z7EmVkUT4ERpVUfca8S2HGIVs883D8pUH1ZzQ==", "dev": true }, - "capacitor-native-settings": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/capacitor-native-settings/-/capacitor-native-settings-5.0.1.tgz", - "integrity": "sha512-HH7GCyaVLwWP4FEVqvOQM+cHWveQUjsA2128wfZ5yr9eOQrECVWzO5UXH9ZlikpWi1C7exnovcyEr3TlYO6l8w==", - "requires": {} - }, "caseless": { "version": "0.12.0", "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", @@ -30882,6 +30886,15 @@ } } }, + "cross-env": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz", + "integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.1" + } + }, "cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", From f8b9b57cff019cea9116697ebd77b692a9ec02ef Mon Sep 17 00:00:00 2001 From: Walter Date: Sun, 14 Apr 2024 16:05:33 +0300 Subject: [PATCH 2/2] add collection tests for search collections and visibility --- .../e2e/7-collections/collections.cy.js | 30 ++++++++++++++----- .../cypress/functions/CollectionFunctions.js | 23 ++++++++++++-- .../cypress/locators/CollectionLocators.js | 3 +- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/e2e-testing/cypress/e2e/7-collections/collections.cy.js b/e2e-testing/cypress/e2e/7-collections/collections.cy.js index 16a1b94400..e6d81204de 100644 --- a/e2e-testing/cypress/e2e/7-collections/collections.cy.js +++ b/e2e-testing/cypress/e2e/7-collections/collections.cy.js @@ -1,20 +1,36 @@ -import LoginFunctions from "../../functions/LoginFunctions"; -import CollectionFunctions from "../../functions/CollectionFunctions"; +import LoginFunctions from '../../functions/LoginFunctions'; +import CollectionFunctions from '../../functions/CollectionFunctions'; -describe("Automated Tests for Collections", () => { +const collectionFunctions = new CollectionFunctions(); +describe('Automated Tests for Collections', () => { const loginFunctions = new LoginFunctions(); - const collectionFunctions = new CollectionFunctions(); beforeEach(() => { loginFunctions.login_as_admin(); cy.visit(Cypress.env('baseUrl')); }); - it("Creates Collection", () => { + it('Creates Collection', () => { collectionFunctions.create_collection(); }); - it.skip("Add post to collection", ()=>{ + it.skip('Add post to collection', () => { collectionFunctions.add_post_to_collection(); - }) + }); +}); + +describe('Verify collection for logged out user', () => { + it.skip('verifies collection visible for logged out user', () => { + cy.visit(Cypress.env('baseUrl')); + //close onboarding modals + cy.get('[data-qa="btn-close"]').click(); + + collectionFunctions.open_all_collections_modal(); + collectionFunctions.search_collection(); + + //verify collection and open collection + collectionFunctions.open_everyone_collection(); + + collectionFunctions.verify_everyone_collection_opened(); + }); }); diff --git a/e2e-testing/cypress/functions/CollectionFunctions.js b/e2e-testing/cypress/functions/CollectionFunctions.js index f982e4e68e..df0fcb9235 100644 --- a/e2e-testing/cypress/functions/CollectionFunctions.js +++ b/e2e-testing/cypress/functions/CollectionFunctions.js @@ -22,10 +22,29 @@ class CollectionFunctions { cy.get(CollectionLocators.saveCollectionBtn).click(); } - open_collections() { + open_all_collections_modal() { cy.get(CollectionLocators.collectionBtn).click(); } + open_everyone_collection() { + cy.contains('Public Collections').should('be.visible').click(); + } + + verify_everyone_collection_opened() { + cy.url().should('include', '/feed/collection'); + cy.get('[data-qa="search-form-main-filters-total"]').should('have.value', 'Results: 1'); + } + + search_collection() { + cy.get(CollectionLocators.searchCollectionField).click().type('collection{enter}'); + //verify result count + //use twice the number of actual elements since this selector appears twice for each element + cy.get(CollectionLocators.selectCollection).should('have.length', 14); + //clear search and verify results + cy.get(CollectionLocators.searchCollectionField).clear().type('{enter}'); + cy.get(CollectionLocators.selectCollection).should('have.length', 24); + } + select_collections() { cy.get(CollectionLocators.selectCollection).eq(0).click(); } @@ -52,7 +71,7 @@ class CollectionFunctions { } verify_post_added_to_collection() { - this.open_collections(); + this.open_all_collections_modal(); this.select_collections(); cy.contains('Post Title').should('exist'); } diff --git a/e2e-testing/cypress/locators/CollectionLocators.js b/e2e-testing/cypress/locators/CollectionLocators.js index e9c4c31458..6ab0c8b9c2 100644 --- a/e2e-testing/cypress/locators/CollectionLocators.js +++ b/e2e-testing/cypress/locators/CollectionLocators.js @@ -20,7 +20,8 @@ const CollectionLocators = { addPostButton: '[data-qa="submit-post-button"]', saveCollectionButton: '[data-qa="save-collection-btn"]', collectionItem: '[data-qa="collection-item"]', - visibilityOption: '[data-qa="option"]' + visibilityOption: '[data-qa="option"]', + searchCollectionField: '[data-qa="query"]' }; export default CollectionLocators;