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

IBP-6098: implement study comparison in graphical queries automation #72

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,31 @@ export default class GraphicalQueryPage {
getIframeBody().xpath(`//span[contains(@class,'select2-results')]//ul[@class='select2-results__options']/li[text()='${studyName}']`).should('be.visible').click();
}

addStudyName (studyName: string) {
getIframeBody().xpath(`//div[@id='trials']//input`).should('be.visible').type(studyName, { force: true, delay: 0 });
getIframeBody().xpath(`//span[contains(@class,'select2-results')]//ul[@class='select2-results__options']/li[text()='${studyName}']`).should('be.visible').click();
}

selectObservationLevel () {
getIframeBody().find('[data-test="observationLevelSelect"]').should('exist').select('PLOT');
}

selectStudyComparisonQueryType () {
getIframeBody().find('[data-test="queryTypeSelect"]').should('exist').select('Study Comparison');
}

selectVariableToCompare(variableName: string) {
getIframeBody().find('#scomp-select-var').should('exist').select(variableName);
}

clickCompareVariable() {
getIframeBody().find('#scomp-compare').click();
}

verifyDisplayedGraph() {
getIframeBody().find('#graph_div').children().should('have.length', 1);
}

clickLoadQuery () {
getIframeBody().find('#load-brapi').should('exist').click();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ Feature: Study Comparison
I should be able to perform study comparison in BMS

Background:
Given there are multiple studies that have observations for the same traits
Given I am on the Manage Studies page of specified program
And I opened a study with RCBD design
And I add Aflatox_M_ppb trait to the study with observations
And I am on the Manage Studies page of specified program
And added another study that have observations for the same traits
And I am on the Graphical Queries page of specified program

@TestCaseKey=IBP-T1647
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { When, And, Then, Given } from 'cypress-cucumber-preprocessor/steps';
import { randomString } from '../../../../support/commands';
import GraphicalQueryPage from '../../../pageobjects/graphical-query/graphical-query-page';
import ManageStudiesPage from '../../../pageobjects/studies/manage-studies-page';
import CreateStudyPage from '../../../pageobjects/studies/create-study-page';
import ManageObservationsPage from '../../../pageobjects/studies/manage-observations-page';

const graphicalQueryPage = new GraphicalQueryPage();
const manageStudiesPage = new ManageStudiesPage();
const createStudyPage = new CreateStudyPage();
const manageObservationsPage = new ManageObservationsPage();

const newStudyName = 'Study-' + Math.random().toString(20).replace(/[^a-z]+/g, '');
const traitName = "Aflatox_M_ppb";

And('added another study that have observations for the same traits', () => {
manageStudiesPage.startNewStudy();
createStudyPage.saveNewStudyWithRCBDDesign(newStudyName,
'Study with Randomized Complete Block Design',
'Trial', 'This is an autogenerated study from Cypress e2e testing.');
createStudyPage.addTrait(traitName);
manageObservationsPage.addTraitObservations(traitName);
});

When('I selected multiple study names with existing observations', () => {
graphicalQueryPage.selectStudyName(Cypress.env('rcbdStudy'));
graphicalQueryPage.addStudyName(newStudyName);
});

And('I selected PLOT as observation level', () => {
graphicalQueryPage.selectObservationLevel();
});

And('I loaded the query by study comparison', () => {
graphicalQueryPage.selectStudyComparisonQueryType();
graphicalQueryPage.clickLoadQuery();
});

And('I selected variable to compare', () => {
graphicalQueryPage.selectVariableToCompare('Aflatox_M_ppb');
});

And('I proceed with the comparison', () => {
graphicalQueryPage.clickCompareVariable();
});

Then('I should be able to see graphs that shows the details of comparison of the selected studies', () => {
graphicalQueryPage.verifyDisplayedGraph();
});