How to use @instructure/ui-test-utils - 10 common examples

To help you get started, we’ve selected a few @instructure/ui-test-utils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github instructure / instructure-ui / packages / ui-pagination / src / Pagination / PaginationArrowButton / locator.js View on Github external
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
import { locator, find } from '@instructure/ui-test-utils'

// eslint-disable-next-line no-restricted-imports
import TooltipLocator from '@instructure/ui-overlays/lib/Tooltip/locator'

import { PaginationArrowButton } from './index'

export default locator(PaginationArrowButton.selector, {
  findTooltipContent: (...args) => TooltipLocator.findContent(...args),
  click: async (element, ...args) => {
    return (await find(element, 'a,button,[role="button"]')).click(...args)
  }
})
github instructure / instructure-ui / packages / ui-elements / src / Pill / locator.js View on Github external
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */

import { locator, parseQueryArguments } from '@instructure/ui-test-utils'
// eslint-disable-next-line no-restricted-imports
import TooltipLocator from '@instructure/ui-overlays/lib/Tooltip/locator'

import { Pill } from './index'

export default locator(Pill.selector, {
  findTooltipContent: async (...args) => {
    const { element, selector, options } = parseQueryArguments(...args)
    const tooltip = await TooltipLocator.find(element, options)
    return tooltip ? tooltip.findContent(selector, options) : null
  }
})
github instructure / instructure-ui / packages / ui-overlays / src / Popover / locator.js View on Github external
import { locator } from '@instructure/ui-test-utils'

 // eslint-disable-next-line no-restricted-imports
 import PositionLocator from '@instructure/ui-layout/lib/Position/locator'
 import { Popover, PopoverTrigger, PopoverContent } from './index'

 export const PopoverTriggerLocator = locator(PopoverTrigger.selector)
 export const PopoverContentLocator = locator(PopoverContent.selector)

 export const customMethods = {
   findContent: (...args) => PositionLocator.findContent(...args),
   findPositionTarget: (...args) => PositionLocator.findTarget(...args),
   findTrigger: (...args) => PopoverTriggerLocator.find(...args)
 }

export default locator(Popover.selector, customMethods)
github instructure / instructure-ui / packages / ui-menu / src / Menu / locator.js View on Github external
findPopoverTrigger: (...args) => {
    return PopoverLocator.findTrigger(...args)
  },
  findPopoverContent: (...args) => {
    const { element, selector, options } = parseQueryArguments(...args)
    return PopoverLocator.findContent(element, selector, {
      ...options,
      customMethods: {
        ...options.customMethods,
        ...customMethods
      }
    })
  }
}

export default locator(Menu.selector, customMethods)
export { default as MenuItemLocator } from './MenuItem/locator'
export { default as MenuItemGroupLocator } from './MenuItemGroup/locator'
github instructure / instructure-ui / packages / ui-elements / src / components / Rating / locator.js View on Github external
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
import { locator } from '@instructure/ui-test-utils'

import Rating from './index'
import styles from './RatingIcon/styles.css'

const FilledIconLocator = locator(`.${styles.filled}`)

export default locator(Rating.selector, {
  findAllFilledIcons: (...args) => {
    return FilledIconLocator.findAll(...args)
  }
})
github instructure / instructure-ui / packages / ui-elements / src / components / Spinner / locator.js View on Github external
* The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
import { locator } from '@instructure/ui-test-utils'

import Spinner from './index'

export default locator(Spinner.selector)
github instructure / instructure-ui / packages / ui-breadcrumb / src / Breadcrumb / BreadcrumbLink / locator.js View on Github external
* The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
import { locator } from '@instructure/ui-test-utils'

import { BreadcrumbLink } from './index'

export default locator(BreadcrumbLink.selector)
github instructure / instructure-ui / packages / ui-select / src / Select / locator.js View on Github external
  findInput: (...args) => locator('input').find(...args),
  findOptionsList: async (element, ...args) => {
github instructure / instructure-ui / packages / ui-svg-images / src / components / InlineSVG / locator.js View on Github external
* The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
import { locator  } from '@instructure/ui-test-utils'

import InlineSVG from './index'

export default locator(InlineSVG.selector)
github instructure / instructure-ui / packages / ui-tabs / src / components / Tabs / locator.js View on Github external
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
 */
import { locator } from '@instructure/ui-test-utils'

import Tabs from './index'

import TabLocator from './Tab/locator'
import PanelLocator from './Panel/locator'

const SelectedTabLocator = locator('[role="tab"][aria-selected="true"]')

export default locator(Tabs.selector, {
  findTab: (...args) => {
    return TabLocator.find(...args)
  },
  findAllTabs: (...args) => {
    return TabLocator.findAll(...args)
  },
  findSelectedTab: (...args) => {
    return SelectedTabLocator.find( ...args)
  },
  findTabPanel: (...args) => {
    return PanelLocator.find(...args)
  },
  findAllTabPanels: (...args) => {
    return PanelLocator.findAll(...args)
  }
})

@instructure/ui-test-utils

A UI testing library made by Instructure Inc.

MIT
Latest version published 4 days ago

Package Health Score

84 / 100
Full package analysis

Popular @instructure/ui-test-utils functions

Similar packages