Skip to content

Commit

Permalink
move support files to their own folder
Browse files Browse the repository at this point in the history
  • Loading branch information
chopkinsmade committed Oct 6, 2023
1 parent 2264658 commit 8faae28
Show file tree
Hide file tree
Showing 19 changed files with 2,294 additions and 2 deletions.
21 changes: 21 additions & 0 deletions test/functional/cypress/support/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { fill } from './form-fillers'
const adviserResult = require('../../../sandbox/fixtures/autocomplete-adviser-list.json')

/**
* @deprecated Use the version in /test/support folder
*
* Enter `input` into a typeahead `element` and select the first result.
*
* Defaults to Typeahead for adviser but can changed to any type by setting
Expand Down Expand Up @@ -38,20 +40,23 @@ export const selectFirstMockedTypeaheadOption = ({
})

/**
* @deprecated Use the version in /test/support folder
* Clicks the checkbox option with the given value
*/
export const clickCheckboxGroupOption = ({ element, value }) => {
cy.get(element).find(`input[value="${value}"]`).parent().click()
}

/**
* @deprecated Use the version in /test/support folder
* Clicks the radiogroup option with the label
*/
export const clickRadioGroupOption = ({ element, label }) => {
cy.get(element).contains('span', label).parent().click()
}

/**
* @deprecated Use the version in /test/support folder
* Enter `input` into a typeahead `element` and select the first result
*/
export const selectFirstTypeaheadOption = ({ element, input }) => {
Expand All @@ -61,27 +66,31 @@ export const selectFirstTypeaheadOption = ({ element, input }) => {
}

/**
* @deprecated Use the version in /test/support folder
* Removes a specific chip based on the data-value
*/
export const removeChip = (dataValue) => {
cy.get('[data-test=filter-chips]').find(`[data-value="${dataValue}"]`).click()
}

/**
* @deprecated Use the version in /test/support folder
* Adds a date to the any given date input field
*/
export const inputDateValue = ({ element, value }) => {
cy.get(element).type(value)
}

/**
* @deprecated Use the version in /test/support folder
* Adds a date to the any given date input field that also has a hint
*/
export const inputDateValueWithHint = ({ element, value }) => {
cy.get(element).find('fieldset > input').type(value)
}

/**
* @deprecated Use the version in /test/support folder
* Adds a date object of {day, month, year} to the relevent input fields
*/
export const clearAndInputDateValueObject = ({ element, value }) => {
Expand All @@ -99,6 +108,7 @@ export const clearAndInputDateValueObject = ({ element, value }) => {
}

/**
* @deprecated Use the version in /test/support folder
* Clears and Types a value in an input field
*/
export const clearAndTypeInput = ({ element, value }) => {
Expand All @@ -111,6 +121,7 @@ export const clearAndTypeInput = ({ element, value }) => {
}

/**
* @deprecated Use the version in /test/support folder
* Clears and Types a value in an textarea field
*/
export const clearAndTypeTextArea = ({ element, value }) => {
Expand All @@ -123,13 +134,15 @@ export const clearAndTypeTextArea = ({ element, value }) => {
}

/**
* @deprecated Use the version in /test/support folder
* Remove the first item in a multi-select Typeahead
*/
export const removeFirstTypeaheadItem = () => {
cy.get('[data-test="typeahead-chip"]').eq(0).click()
}

/**
* @deprecated Use the version in /test/support folder
* Click on a button
* @param {*} buttonText The text of the button you want to click
*/
Expand All @@ -138,13 +151,15 @@ export const clickButton = (buttonText) => {
}

/**
* @deprecated Use the version in /test/support folder
* Click on a Cancel anchor
*/
export const clickCancelLink = () => {
cy.get('[data-test="cancel-button"]').click()
}

/**
* @deprecated Use the version in /test/support folder
* Generic search request for a CollectionList
* @param {*} endpoint The search endpoint
* @param {*} fakeList The fake list of items to display
Expand All @@ -162,6 +177,9 @@ export const collectionListRequest = (endpoint, fakeList, link) => {
cy.wait('@apiRequest')
}

/**
* @deprecated Use the version in /test/support folder
*/
export const omisCollectionListRequest = (
endpoint,
fakeList,
Expand All @@ -182,6 +200,9 @@ export const omisCollectionListRequest = (
cy.wait('@apiRequest')
}

/**
* @deprecated Use the version in /test/support folder
*/
export const addNewContact = (contact) => {
fill('[data-test=group-field-first_name]', contact.first_name)
fill('[data-test=group-field-last_name]', contact.last_name)
Expand Down
Loading

0 comments on commit 8faae28

Please sign in to comment.