Skip to content

Commit

Permalink
(#624) Update Node, Webpack, and other security updates
Browse files Browse the repository at this point in the history
nvm install 20.5.0
nvm use 20.5.0
npm audit fix --force
npm install webpack@latest --save-dev
npm run lint:fix
  • Loading branch information
belaolsonNIH committed Feb 28, 2024
1 parent d8fa1cf commit d20a51f
Show file tree
Hide file tree
Showing 167 changed files with 14,622 additions and 41,878 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/gallium
lts/iron
13 changes: 5 additions & 8 deletions cypress/e2e/AdvancedSearchPage/AdvancedSearchForm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,11 @@ And('Search tip icon is displayed and text {string} appears', (tiptext) => {
cy.get('.cts-search-tip__body').should('contain', tiptext);
});

And(
'sticky block is displayed with {string} and {string} buttons',
(findbtn, clearbtn) => {
cy.get('.sticky-block').should('be.visible');
cy.get('.faux-btn-submit').contains(findbtn).should('be.visible');
cy.get('.clear-form').contains(clearbtn).should('be.visible');
}
);
And('sticky block is displayed with {string} and {string} buttons', (findbtn, clearbtn) => {
cy.get('.sticky-block').should('be.visible');
cy.get('.faux-btn-submit').contains(findbtn).should('be.visible');
cy.get('.clear-form').contains(clearbtn).should('be.visible');
});

When('user scrolls to the {string} section', (section) => {
cy.get(`input[aria-label="${section}"]`).scrollIntoView();
Expand Down
11 changes: 3 additions & 8 deletions cypress/e2e/AdvancedSearchPage/AgeSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,9 @@
import { Then, When, And } from 'cypress-cucumber-preprocessor/steps';
import { fieldMap } from '../../../utils/ctsFields.js';

Then(
'help icon is displayed in {string} section with href {string}',
(fieldLabel, helpHref) => {
cy.get(`#fieldset--${fieldMap[fieldLabel]}`)
.find('a.text-icon-help')
.should('have.attr', 'href', helpHref);
}
);
Then('help icon is displayed in {string} section with href {string}', (fieldLabel, helpHref) => {
cy.get(`#fieldset--${fieldMap[fieldLabel]}`).find('a.text-icon-help').should('have.attr', 'href', helpHref);
});

Then('alert {string} is displayed', (alertText) => {
cy.get('.cts-input__error-message').should('have.text', alertText);
Expand Down
81 changes: 27 additions & 54 deletions cypress/e2e/AdvancedSearchPage/CancerTypeCondition/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@
import { And, Then, When } from 'cypress-cucumber-preprocessor/steps';
import { fieldMap } from '../../../utils/ctsFields';

And(
'info text {string} is displayed in the {string} section body',
(infoText, fieldSet) => {
cy.get(`fieldset.${fieldSet}`).find('p').should('contain.text', infoText);
}
);
And('info text {string} is displayed in the {string} section body', (infoText, fieldSet) => {
cy.get(`fieldset.${fieldSet}`).find('p').should('contain.text', infoText);
});

And('autocomplete dropdown is displayed', () => {
cy.get('.cts-autocomplete .menu-anchor :visible').should('exist');
Expand All @@ -17,61 +14,37 @@ And('user selects {string} from dropdown', (keyword) => {
cy.get('.cts-autocomplete__menu-item').contains(keyword).click();
});

And(
'{string} input field has helper text {string}',
(fieldLabel, helperText) => {
cy.get(`input#${fieldMap[fieldLabel]}`)
.parent()
.siblings('span')
.should('have.text', helperText);
}
);
And('{string} input field has helper text {string}', (fieldLabel, helperText) => {
cy.get(`input#${fieldMap[fieldLabel]}`).parent().siblings('span').should('have.text', helperText);
});

And('trial info displayes {string}', (infoText) => {
cy.get('.all-trials').should('have.text', infoText);
});
And(
'the url query has the following corresponding code with duplicated keys',
(dataTable) => {
cy.location('href').then((url) => {
const params = new URL(url).searchParams;
//verify num of url params matches expected
expect(Array.from(params.entries()).length).to.eq(dataTable.raw().length);
//verify that url query params have expected values
expect(Array.from(params.entries())).to.deep.equal(dataTable.raw());
});
}
);
And('the url query has the following corresponding code with duplicated keys', (dataTable) => {
cy.location('href').then((url) => {
const params = new URL(url).searchParams;
//verify num of url params matches expected
expect(Array.from(params.entries()).length).to.eq(dataTable.raw().length);
//verify that url query params have expected values
expect(Array.from(params.entries())).to.deep.equal(dataTable.raw());
});
});

Then(
'{string} field has the following types selected',
(fieldLabel, dataTable) => {
cy.get(`input#${fieldMap[fieldLabel]}`)
.parent('.cts-chip-list')
.as('fieldInFocus');
//expected number of selected items is displayed
cy.get('@fieldInFocus')
.find('span[class*="label"]')
.should('have.length', dataTable.rows().length);
for (const { selected } of dataTable.hashes()) {
//verify that the ony expected items are selected
cy.get('@fieldInFocus')
.find('span[class*="label"]')
.contains(selected)
.should('be.visible');
}
Then('{string} field has the following types selected', (fieldLabel, dataTable) => {
cy.get(`input#${fieldMap[fieldLabel]}`).parent('.cts-chip-list').as('fieldInFocus');
//expected number of selected items is displayed
cy.get('@fieldInFocus').find('span[class*="label"]').should('have.length', dataTable.rows().length);
for (const { selected } of dataTable.hashes()) {
//verify that the ony expected items are selected
cy.get('@fieldInFocus').find('span[class*="label"]').contains(selected).should('be.visible');
}
);
});

When(
'user removes {string} from the {string} field',
(selectedType, fieldLabel) => {
cy.get(`input#${fieldMap[fieldLabel]}`)
.parent('.cts-chip-list')
.as('fieldInFocus');
cy.get('@fieldInFocus').find(`button[value="${selectedType}"]`).click();
}
);
When('user removes {string} from the {string} field', (selectedType, fieldLabel) => {
cy.get(`input#${fieldMap[fieldLabel]}`).parent('.cts-chip-list').as('fieldInFocus');
cy.get('@fieldInFocus').find(`button[value="${selectedType}"]`).click();
});

When('user clicks on Modify Search Criteria button', () => {
cy.get('button.btnAsLink').contains('Modify Search Criteria').click();
Expand Down
84 changes: 25 additions & 59 deletions cypress/e2e/AdvancedSearchPage/DrugTreatmentSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,22 @@
import { Then, When, And } from 'cypress-cucumber-preprocessor/steps';
import { fieldMap } from '../../../utils/ctsFields.js';

And(
'help icon is displayed in {string} section with href {string}',
(fieldLabel, helpHref) => {
cy.get('#fieldset--drug-trtmt')
.find('a.text-icon-help')
.should('be.visible', fieldLabel)
.and('have.attr', 'href', helpHref);
}
);
And('help icon is displayed in {string} section with href {string}', (fieldLabel, helpHref) => {
cy.get('#fieldset--drug-trtmt').find('a.text-icon-help').should('be.visible', fieldLabel).and('have.attr', 'href', helpHref);
});

And('info text {string} is displayed in the section body', (infoText) => {
cy.get('#fieldset--drug-trtmt').find('p').should('have.text', infoText);
});

Then(
'autocomplete dropdown is displayed with {string} text',
(autosuggestItem) => {
cy.get('div.cts-autocomplete__menu-item:visible').should(
'have.text',
autosuggestItem
);
}
);
Then('autocomplete dropdown is displayed with {string} text', (autosuggestItem) => {
cy.get('div.cts-autocomplete__menu-item:visible').should('have.text', autosuggestItem);
});

And('user selects {string} from dropdown', (autosuggestTerm) => {
cy.contains(
'#fieldset--drug-trtmt .cts-autocomplete__menu-item',
autosuggestTerm,
{
timeout: 7000,
}
).click({ force: true, timeout: 7000 });
cy.contains('#fieldset--drug-trtmt .cts-autocomplete__menu-item', autosuggestTerm, {
timeout: 7000,
}).click({ force: true, timeout: 7000 });
});

And('trial info displays {string}', (infoText) => {
Expand All @@ -57,45 +41,27 @@ When('user clicks on Modify Search Criteria button', () => {

Then('{string} input field has a value {string}', (fieldLabel, value) => {
if (fieldLabel.toLowerCase().includes('drug')) {
cy.get(`input#${fieldMap[fieldLabel]}`)
.parent()
.find('span')
.first()
.should('have.text', value);
cy.get(`input#${fieldMap[fieldLabel]}`).parent().find('span').first().should('have.text', value);
} else {
cy.get(`input#${fieldMap[fieldLabel]}`)
.parent()
.find('span')
.first()
.should('have.text', value);
cy.get(`input#${fieldMap[fieldLabel]}`).parent().find('span').first().should('have.text', value);
}
});

When(
'user removes {string} from the {string} field',
(selectedType, fieldLabel) => {
cy.get(`input#${fieldMap[fieldLabel]}`)
.parent('.cts-chip-list')
.as('fieldInFocus');
cy.get('@fieldInFocus').find(`button[value="${selectedType}"]`).click();
}
);
When('user removes {string} from the {string} field', (selectedType, fieldLabel) => {
cy.get(`input#${fieldMap[fieldLabel]}`).parent('.cts-chip-list').as('fieldInFocus');
cy.get('@fieldInFocus').find(`button[value="${selectedType}"]`).click();
});

And(
'the url query has the following corresponding code with duplicated keys',
(dataTable) => {
cy.location('href').then((url) => {
const params = new URL(url).searchParams;
//verify num of url params matches expected
expect(Array.from(params.entries()).length).to.eq(dataTable.raw().length);
//verify that url query params have expected values
expect(Array.from(params.entries())).to.deep.equal(dataTable.raw());
});
}
);
And('the url query has the following corresponding code with duplicated keys', (dataTable) => {
cy.location('href').then((url) => {
const params = new URL(url).searchParams;
//verify num of url params matches expected
expect(Array.from(params.entries()).length).to.eq(dataTable.raw().length);
//verify that url query params have expected values
expect(Array.from(params.entries())).to.deep.equal(dataTable.raw());
});
});

Then('autocomplete dropdown is displayed', () => {
cy.get('#fieldset--drug-trtmt .cts-autocomplete__menu-item').should(
'be.visible'
);
cy.get('#fieldset--drug-trtmt .cts-autocomplete__menu-item').should('be.visible');
});
11 changes: 3 additions & 8 deletions cypress/e2e/AdvancedSearchPage/KeywordsSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ const keywordsFields = {
KeywordsPhrases: 'keywordPhrases',
};

Then(
'help icon is displayed in {string} section with href {string}',
(fieldLabel, helpHref) => {
cy.get(`#fieldset--${keywordsFields[fieldLabel]}`)
.find('a.text-icon-help')
.should('have.attr', 'href', helpHref);
}
);
Then('help icon is displayed in {string} section with href {string}', (fieldLabel, helpHref) => {
cy.get(`#fieldset--${keywordsFields[fieldLabel]}`).find('a.text-icon-help').should('have.attr', 'href', helpHref);
});

And('trial info displays {string}', (infoText) => {
cy.get('.all-trials').should('have.text', infoText);
Expand Down
41 changes: 10 additions & 31 deletions cypress/e2e/AdvancedSearchPage/LeadOrganizationSection/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,24 @@ import { And, Then, When } from 'cypress-cucumber-preprocessor/steps';

And('user selects {string} from dropdown', (autosuggestTerm) => {
cy.get('div.cts-autocomplete__menu.--leadOrg').should('be.visible');
cy.get('div.cts-autocomplete__menu.--leadOrg div.highlighted:visible')
.should('have.text', autosuggestTerm)
.click();
cy.get('div.cts-autocomplete__menu.--leadOrg div.highlighted:visible').should('have.text', autosuggestTerm).click();
});

Then('autocomplete dropdown is displayed', () => {
cy.get('div.cts-autocomplete__menu-item:visible').should('be.visible');
});

Then(
'autocomplete dropdown is displayed with {string} text',
(autosuggestItem) => {
cy.get('div.cts-autocomplete__menu-item:visible').should(
'have.text',
autosuggestItem
);
}
);
Then('autocomplete dropdown is displayed with {string} text', (autosuggestItem) => {
cy.get('div.cts-autocomplete__menu-item:visible').should('have.text', autosuggestItem);
});

And(
'help icon is displayed in {string} section with href {string}',
(fieldLabel, href) => {
cy.get(`a[href="${href}"]`)
.parent()
.find('span')
.should('have.text', fieldLabel);
}
);
And('help icon is displayed in {string} section with href {string}', (fieldLabel, href) => {
cy.get(`a[href="${href}"]`).parent().find('span').should('have.text', fieldLabel);
});

Then(
'{string} input field has a placeholder {string}',
(fieldLabel, placeholderText) => {
cy.get(`input[aria-label="${fieldLabel}"]`).should(
'have.attr',
'placeholder',
placeholderText
);
}
);
Then('{string} input field has a placeholder {string}', (fieldLabel, placeholderText) => {
cy.get(`input[aria-label="${fieldLabel}"]`).should('have.attr', 'placeholder', placeholderText);
});

When('user clicks on {string} field', (fieldLabel) => {
cy.get(`input[aria-label="${fieldLabel}"]`).click();
Expand Down
Loading

0 comments on commit d20a51f

Please sign in to comment.