Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

1011 e2e collections visibility based on roles #1012

Draft
wants to merge 2 commits into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
node_modules
documentation
e2e

package-lock.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 54;
objectVersion = 63;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -142,6 +142,7 @@
Base,
);
mainGroup = 504EC2FB1FED79650016851F;
minimizedProjectReferenceProxies = 1;
productRefGroup = 504EC3051FED79650016851F /* Products */;
projectDirPath = "";
projectRoot = "";
Expand Down
74 changes: 54 additions & 20 deletions apps/mobile-mzima-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions apps/mobile-mzima-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
30 changes: 23 additions & 7 deletions e2e-testing/cypress/e2e/7-collections/collections.cy.js
Original file line number Diff line number Diff line change
@@ -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();
});
});
23 changes: 21 additions & 2 deletions e2e-testing/cypress/functions/CollectionFunctions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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');
}
Expand Down
3 changes: 2 additions & 1 deletion e2e-testing/cypress/locators/CollectionLocators.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
43 changes: 28 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading