Skip to content

Commit

Permalink
Merge pull request #54 from concord-consortium/187689523-filter-mater…
Browse files Browse the repository at this point in the history
…ials-collections

Filter Materials Collections Automation
  • Loading branch information
saravanan-udayakumar authored Jun 13, 2024
2 parents a8bc63a + cbab080 commit b1e9a82
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 0 deletions.
57 changes: 57 additions & 0 deletions cypress/e2e/functional/admin_materials_collections_filter.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import * as c from '../../support/constants.js'
import * as materialsHelper from '../../support/helpers/materialsCollectionsHelper'

context("Verify the user is able to Filter Materials Collections automatically when using the project dropdown", () => {

before(function() {
cy.visit(c.LEARN_PORTAL_BASE_URL); // Visit LEARN Portal home page
cy.login(c.ADMIN_USERNAME, c.ADMIN_PASSWORD); // Login as admin user
cy.visit(c.LEARN_PORTAL_BASE_URL + "/materials_collections");
});

after(function() {
cy.logout();
});

it("Verify materials collections filter", () => {

cy.log("verify material collection page displayed");
materialsHelper.verifyMaterialsCollectionPage();

cy.log("verify initial filter result");
materialsHelper.verifyFilterResult("all 6");

cy.log("verify filter materials collections for project 1");
materialsHelper.selectProject("Test Project Images");
materialsHelper.verifyFilterResult("1");
materialsHelper.verifyMaterialsName("Test Project Images");

cy.wait(1000);

cy.log("verify filter materials collections for project 2");
materialsHelper.selectProject("Test Project");
materialsHelper.verifyFilterResult("all 5");
materialsHelper.verifyMaterialsName("Test Project");

cy.wait(1000);

cy.log("verify filter for no materials collections");
materialsHelper.selectProject("Test Project For Researcher");
materialsHelper.verifyFilterResult("No materials collections found");

cy.wait(1000);

cy.log("verify default materials collections");
materialsHelper.selectProject("Select project...");
materialsHelper.verifyFilterResult("all 6");

cy.log("verify search material collection");
materialsHelper.enterMaterialsName("Test Project Images");
materialsHelper.clickSearchButton();
materialsHelper.verifyFilterResult("1");

materialsHelper.enterMaterialsName("Test Project");
materialsHelper.clickSearchButton();
materialsHelper.verifyFilterResult("all 3");
});
});
23 changes: 23 additions & 0 deletions cypress/support/helpers/materialsCollectionsHelper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export function verifyMaterialsCollectionPage(){
cy.get('#content .action_menu_header .action_menu_header_right a').contains("create Materials Collection");
}

export function verifyFilterResult(count){
cy.get('.action_menu_header .action_menu_header_left p').contains(count);
}

export function selectProject(project){
cy.get('#project_id').select(project);
}

export function verifyMaterialsName(name){
cy.get('.list-item-wrapper .action_menu_header_left a').contains(name);
}

export function enterMaterialsName(name){
cy.get('.action_menu_header_left #search').clear().type(name);
}

export function clickSearchButton(){
cy.get('.action_menu_header_left input').eq(1).click({ force: true });
}

0 comments on commit b1e9a82

Please sign in to comment.