Skip to content

Commit

Permalink
Merge pull request #127 from Breeding-Insight/feature/BI-1788
Browse files Browse the repository at this point in the history
Feature/bi 1788
  • Loading branch information
cvacalares authored Nov 25, 2023
2 parents 6c4289e + e52c521 commit d26d322
Show file tree
Hide file tree
Showing 18 changed files with 634 additions and 164 deletions.
4 changes: 2 additions & 2 deletions src/features/BreedingMethods.feature
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Feature: Breeding Methods
When user selects "Generative (+)" in 'Genetic Diversity' dropdown in Breeding Method form
And user clicks 'Save' button in Breeding Method form
And user pause for "2" seconds
When user clicks Show All button
When user selects Show All button
When user close the Notification
Then user can see "<name>" in Name column in Breeding Method page
Then user logs out
Expand All @@ -120,4 +120,4 @@ Feature: Breeding Methods

Examples:
| Program Name | name | abbreviation | description |
| P* | M* | Z* | Testing |
| P* | M* | Z* | Testing |
8 changes: 4 additions & 4 deletions src/features/GermplasmImportTable.feature
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ Feature: Germplasm Import Table
When user is on the program-management page
#Create a new program
When user selects 'New Program' button in Programs page
When user sets "P*" in Program Name field in Programs page
When user sets "A*" in Program Name field in Programs page
When user selects "Potato" in Species dropdown in Programs page
When user sets "A*" in Program Key field in Programs page
When user selects 'Save' button in Programs page
When user pause for "10" seconds
When user navigates to Program Selection page
When user selects "P*" on program-selection page
When user selects "A*" on program-selection page
When user selects "Program Administration" in navigation
When user selects "Users" tab
When user clicks 'New User' button
Expand All @@ -25,7 +25,7 @@ Feature: Germplasm Import Table
When user logs out
Given user logs in as "Cucumber Breeder"
When user selects "*" on program-selection page
And user selects "Import Data" in navigation
And user selects "Import Data" in top-level navigation
And user uploads Germplasm "Germplasm77_2022-07-12.xlsx" file
And user selects 'Import' button
When user sets "GermplasmSort" in List Name field of import page
Expand All @@ -36,7 +36,7 @@ Feature: Germplasm Import Table
@BI-1501
Scenario Outline: All of the information associated with a Germplasm Details page
Given user logs in as "Cucumber Breeder"
When user selects "P*" on program-selection page
When user selects "A*" on program-selection page
And user selects "Germplasm" in navigation
Then user can see All Germplasm records exist on Germplasm page
When user can see All Germplasm records have Show Details link on Germplasm page
Expand Down
43 changes: 43 additions & 0 deletions src/features/GermplasmList.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Feature: Germplasm List View

Background: Setup
Given a new program is created

@BI-1788
Scenario: Germplasm List View
Given user logs in as "Cucumber Breeder"
When user selects "*" on program-selection page
When user imports "Germplasm77_2022-07-12.xlsx" file "15" times in Germplasm
When user selects "Germplasm" in navigation
And user selects "Lists" tab on Gerplasm page
And user pause for "5" seconds
When user selects "10" in Results per page combobox
Then user can see row "10" rows in a table
And user can see Next page button
When user selects Next page button
Then user can see row "5" rows in a table
When user selects Previous page button
Then user can see row "10" rows in a table
When user selects Show All button
Then user can see row "15" rows in a table
Then user can see Germplasm Lists table on Germplasm page
When user gets row "1" from column "Name" on Germplasm lists page
When user gets row "1" from column "Description" on Germplasm lists page
When user selects "Details" of row "1" of Germplasm Lists page
Then user can see "Cucumber Breeder" as "User" of Germplasm Lists Details page
Then user can see "*" as "Description" of Germplasm Lists Details page
Then user can see "Cucumber Breeder" as "User" of Germplasm Lists Details page
Then user can see "10" as "Total Entries" of Germplasm Lists Details page
Then user can see "@TODAY" as "Import Date" of Germplasm Lists Details page

@debug
@BI-1787
Scenario: Genotype data store and fetch
Given user logs in as "Cucumber Breeder"
When user selects "*" on program-selection page
When user selects "Import Data" in top-level navigation

Then user can see "Genotypic Data" tab in Import Data page



2 changes: 1 addition & 1 deletion src/features/LoginByRoleAdminTests.feature
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Feature: Logging with Sys Administration
| Name |
| Species |
| # Users |
When user clicks Show All button
When user selects Show All button
Then user can see each row has an Edit link
And user can see each row has a Deactivate link
And user can see Previous page button
Expand Down
1 change: 0 additions & 1 deletion src/features/LoginByRoleMemberTests.feature
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
@debug
Feature: Logging with Member

@BI-822
Expand Down
4 changes: 2 additions & 2 deletions src/features/OntologyTermCreateGeneralBehavior.feature
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Feature: Ontology Term Create - General Behavior
And user selects "Observation" in 'Method Class' dropdown on ontology list page
And user selects "Date" in 'Scale Class' dropdown on ontology list page
When user selects 'Cancel' button on ontology list page
When user clicks Show All button
When user selects Show All button
Then user can not see "<ont_term_name>" in 'Name' column on ontology list page

Examples:
Expand All @@ -101,7 +101,7 @@ Feature: Ontology Term Create - General Behavior
And user selects "Date" in 'Scale Class' dropdown on ontology list page
And user selects 'Save' button on ontology list page
When user pause for "10" seconds
When user clicks Show All button
When user selects Show All button
Then user can see "<ont_term_name>" in 'Name' column on ontology list page
Then user can see "<trait_entity> <trait_attribute>" in 'Trait' column on ontology list page
Then user can see "<method_description> Observation" in 'Method' column on ontology list page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ Feature: Ontology Term Create - Method & Scale Class Behavior
And user sets "<ordinal_value>" in Value second field on ontology list page
And user sets "<second scale category>" in Nominal second field on ontology list page
And user selects 'Save' button on ontology list page
When user clicks Show All button
When user selects Show All button
When user selects 'Show details' button of "<ont_term_name>" on ontology list page
Then user can see "<ordinal_value>" in Value first field of Show Details on ontology list page
And user can see "<first scale category>" in Ordinal first field of Show Details on ontology list page
Expand All @@ -263,7 +263,7 @@ Feature: Ontology Term Create - Method & Scale Class Behavior
And user sets "<first scale category>" in Nominal first field on ontology list page
And user sets "<second scale category>" in Nominal second field on ontology list page
And user selects 'Save' button on ontology list page
When user clicks Show All button
When user selects Show All button
When user selects 'Show details' button of "<ont_term_name>" on ontology list page
Then user can see "<first scale category>" in Nominal first field of Show Details on ontology list page
And user can see "<second scale category>" in Nominal second field of Show Details on ontology list page
Expand Down
2 changes: 1 addition & 1 deletion src/features/ProgramManagement.feature
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ Feature: Program Management (15)
When user selects 'Edit' of "<Name>" in Programs page
When user selects "<New Species>" in Species dropdown in Programs page
When user selects 'Save' button in Programs page
When user clicks Show All button
When user selects Show All button
Then user can see "<Name>" in Name column in Program page
Then user can see "<New Species>" in Species column in Program page

Expand Down
Binary file added src/files/GermplasmImport/Germ-syno-Big.xls
Binary file not shown.
27 changes: 27 additions & 0 deletions src/page_objects/germplasmPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,32 @@ module.exports = {
},
},
},
germplasmListsDetails: {
selector: "//div[@class='germplasm']",
locateStrategy: "xpath",
elements: {
descriptionText: {
selector: ".//b[normalize-space(.)='Description:']/../following::div",
locateStrategy: "xpath",
timeout: 10000,
},
userText: {
selector: ".//b[normalize-space(.)='User:']/../following::div",
locateStrategy: "xpath",
timeout: 10000,
},
importDateText: {
selector: ".//b[normalize-space(.)='Import Date:']/../following::div",
locateStrategy: "xpath",
timeout: 10000,
},
totalEntriesText: {
selector:
".//b[normalize-space(.)='Total Entries:']/../following::div",
locateStrategy: "xpath",
timeout: 10000,
},
},
},
},
};
4 changes: 4 additions & 0 deletions src/page_objects/importPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,9 @@ module.exports = {
elements: {
listNameField: { selector: "#List-Name" },
listDescriptionField: { selector: "#List-Description" },
genotypicDataTab: {
selector: "//li//a[normalize-space()='Genotypic Data']",
locateStrategy: "xpath",
},
},
};
1 change: 0 additions & 1 deletion src/page_objects/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,6 @@ module.exports = {
},
navigateToProgramSelection: async function () {
//get the current url
debugger;
let url;
await client.url(({ value }) => {
url = new URL(value).origin;
Expand Down
124 changes: 123 additions & 1 deletion src/step_definitions/germplasmSteps.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { Then, When, AfterAll } = require("@cucumber/cucumber");
const { getToday } = require("./helpers");
const helpers = require("./helpers");
const germplasmPage = client.page.germplasmPage();
const germplasmList = [];

Then(
/^user can see All Germplasm records exist on Germplasm page$/,
Expand Down Expand Up @@ -35,6 +36,16 @@ When(
}
);

When(
/^user selects "([^"]*)" of row "([^"]*)" of Germplasm Lists page$/,
async function (link, rowIndex) {
await germplasmPage.section.listsTable.click({
selector: `.//tr[${rowIndex}]//a[normalize-space()='${link}']`,
locateStrategy: "xpath",
});
}
);

Then(
/^user can see details on Germplasm details page$/,
async function (table) {
Expand Down Expand Up @@ -134,6 +145,44 @@ Then(
}
);

Then(
/^user can see details on Germplasm Lists details page$/,
async function (table) {
for (column of table.raw()[0]) {
for (i = 0; i < table.hashes().length; i++) {
switch (column) {
case "Description":
await germplasmPage.section.germplasmListsDetails.assert.containsText(
"@descriptionText",
table.hashes()[i][column]
);
break;
case "User":
await germplasmPage.section.germplasmListsDetails.assert.containsText(
"@userText",
table.hashes()[i][column]
);
break;
case "Import Date":
await germplasmPage.section.germplasmListsDetails.assert.containsText(
"@importDateText",
table.hashes()[i][column].replace("@TODAY", helpers.getToday())
);
break;
case "Total Entries":
await germplasmPage.section.germplasmListsDetails.assert.containsText(
"@totalEntriesText",
table.hashes()[i][column]
);
break;
default:
throw new Error(`Unexpected ${label} name.`);
}
}
}
}
);

Then(/^user can see Female Parent GID value is a link$/, async function () {
let countOfTD;
await germplasmPage.findElements(
Expand Down Expand Up @@ -213,7 +262,7 @@ When(/^user selects "([^"]*)" tab on Gerplasm page$/, async function (args1) {
case "All Germplasm":
await germplasmPage.click("@allGermplasmTab");
break;
case "Germplasm Lists":
case "Lists":
await germplasmPage.click("@germplasmListsTab");
default:
break;
Expand Down Expand Up @@ -336,3 +385,76 @@ Then(
Then(/^user can see "([^"]*)" on Germplasm page$/, async function (args1) {
await germplasmPage.assert.containsText("#germplasmTable p", args1);
});

When(
/^user gets row "([^"]*)" from column "([^"]*)" on Germplasm lists page$/,
async function (args1, args2) {
let val;

await germplasmPage.section.germplasmListsDetails.getText(
{
selector: `//tr[${args1}]/td[@data-label='${args2}']`,
locateStrategy: "xpath",
},
({ value }) => {
val = String(value).trim();
}
);
germplasmList[args2] = val;
}
);

Then(
/^user can see "([^"]*)" as "([^"]*)" of Germplasm Lists Details page$/,
async function (args1, args2) {
let val;
let selector;

await germplasmPage.pause(5000);

switch (args2) {
case "Description":
if (args1.includes("*")) {
args1 = germplasmList["Description"];
}
await germplasmPage.section.germplasmListsDetails.getText(
"@descriptionText",
({ value }) => {
val = String(value).trim();
}
);
await client.assert.equal(val, args1);
break;
case "User":
await germplasmPage.section.germplasmListsDetails.getText(
"@userText",
({ value }) => {
val = String(value).trim();
}
);
await client.assert.equal(val, args1);
break;
case "Import Date":
if (args1.includes("@TODAY")) args1 = helpers.getToday();
await germplasmPage.section.germplasmListsDetails.getText(
"@importDateText",
({ value }) => {
val = String(value).trim();
}
);
await client.assert.equal(val, args1);
break;
case "Total Entries":
await germplasmPage.section.germplasmListsDetails.getText(
"@totalEntriesText",
({ value }) => {
val = String(value).trim();
}
);
await client.assert.equal(val, args1);
break;
default:
throw new Error(`Unexpected ${args2} name.`);
}
}
);
Loading

0 comments on commit d26d322

Please sign in to comment.