github.com/hernad/nomad@v1.6.112/ui/tests/pages/clients/detail.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import {
     7    attribute,
     8    create,
     9    collection,
    10    clickable,
    11    fillable,
    12    text,
    13    isPresent,
    14    value,
    15    visitable,
    16  } from 'ember-cli-page-object';
    17  
    18  import allocations from 'nomad-ui/tests/pages/components/allocations';
    19  import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button';
    20  import notification from 'nomad-ui/tests/pages/components/notification';
    21  import toggle from 'nomad-ui/tests/pages/components/toggle';
    22  import { multiFacet } from 'nomad-ui/tests/pages/components/facet';
    23  
    24  export default create({
    25    visit: visitable('/clients/:id'),
    26  
    27    title: text('[data-test-title]'),
    28    clientId: text('[data-test-node-id]'),
    29  
    30    statusLight: collection('[data-test-node-status]', {
    31      id: attribute('data-test-node-status'),
    32      text: text(),
    33    }),
    34  
    35    statusDefinition: text('[data-test-status-definition]'),
    36    statusDecorationClass: attribute(
    37      'class',
    38      '[data-test-status-definition] .status-text'
    39    ),
    40    addressDefinition: text('[data-test-address-definition]'),
    41    datacenterDefinition: text('[data-test-datacenter-definition]'),
    42  
    43    resourceCharts: collection('[data-test-primary-metric]', {
    44      name: text('[data-test-primary-metric-title]'),
    45      chartClass: attribute('class', '[data-test-percentage-chart] progress'),
    46    }),
    47  
    48    ...allocations(),
    49  
    50    emptyAllocations: {
    51      scope: '[data-test-empty-allocations-list]',
    52      headline: text('[data-test-empty-allocations-list-headline]'),
    53      body: text('[data-test-empty-allocations-list-body]'),
    54    },
    55  
    56    allocationFilter: {
    57      preemptions: clickable('[data-test-filter-preemptions]'),
    58      all: clickable('[data-test-filter-all]'),
    59      preemptionsCount: text('[data-test-filter-preemptions]'),
    60      allCount: text('[data-test-filter-all]'),
    61    },
    62  
    63    facets: {
    64      namespace: multiFacet('[data-test-allocation-namespace-facet]'),
    65      job: multiFacet('[data-test-allocation-job-facet]'),
    66      status: multiFacet('[data-test-allocation-status-facet]'),
    67    },
    68  
    69    attributesTable: isPresent('[data-test-attributes]'),
    70    metaTable: isPresent('[data-test-meta]'),
    71    emptyMetaMessage: isPresent('[data-test-empty-meta-message]'),
    72  
    73    metaAttributes: collection(
    74      '[data-test-meta] [data-test-attributes-section]',
    75      {
    76        key: text('[data-test-key]'),
    77        value: text('[data-test-value]'),
    78      }
    79    ),
    80  
    81    error: {
    82      isShown: isPresent('[data-test-error]'),
    83      title: text('[data-test-error-title]'),
    84      message: text('[data-test-error-message]'),
    85      seekHelp: clickable('[data-test-error-message] a'),
    86    },
    87  
    88    hasEvents: isPresent('[data-test-client-events]'),
    89    events: collection('[data-test-client-event]', {
    90      time: text('[data-test-client-event-time]'),
    91      subsystem: text('[data-test-client-event-subsystem]'),
    92      message: text('[data-test-client-event-message]'),
    93    }),
    94  
    95    hasHostVolumes: isPresent('[data-test-client-host-volumes]'),
    96    hostVolumes: collection('[data-test-client-host-volume]', {
    97      name: text('[data-test-name]'),
    98      path: text('[data-test-path]'),
    99      permissions: text('[data-test-permissions]'),
   100    }),
   101  
   102    driverHeads: collection(
   103      '[data-test-driver-status] [data-test-accordion-head]',
   104      {
   105        name: text('[data-test-name]'),
   106        detected: text('[data-test-detected]'),
   107        lastUpdated: text('[data-test-last-updated]'),
   108        healthIsShown: isPresent('[data-test-health]'),
   109        health: text('[data-test-health]'),
   110        healthClass: attribute('class', '[data-test-health] .color-swatch'),
   111  
   112        toggle: clickable('[data-test-accordion-toggle]'),
   113      }
   114    ),
   115  
   116    driverBodies: collection(
   117      '[data-test-driver-status] [data-test-accordion-body]',
   118      {
   119        description: text('[data-test-health-description]'),
   120        descriptionIsShown: isPresent('[data-test-health-description]'),
   121        attributesAreShown: isPresent('[data-test-driver-attributes]'),
   122      }
   123    ),
   124  
   125    drainDetails: {
   126      scope: '[data-test-drain-details]',
   127      durationIsPresent: isPresent('[data-test-duration]'),
   128      duration: text('[data-test-duration]'),
   129      durationTooltip: attribute('aria-label', '[data-test-duration]'),
   130      durationIsShown: isPresent('[data-test-duration]'),
   131      deadline: text('[data-test-deadline]'),
   132      deadlineTooltip: attribute('aria-label', '[data-test-deadline]'),
   133      deadlineIsShown: isPresent('[data-test-deadline]'),
   134      forceDrainText: text('[data-test-force-drain-text]'),
   135      drainSystemJobsText: text('[data-test-drain-system-jobs-text]'),
   136  
   137      completeCount: text('[data-test-complete-count]'),
   138      migratingCount: text('[data-test-migrating-count]'),
   139      remainingCount: text('[data-test-remaining-count]'),
   140      status: text('[data-test-status]'),
   141      force: twoStepButton('[data-test-force]'),
   142    },
   143  
   144    drainPopover: {
   145      label: text('[data-test-drain-popover] [data-test-popover-trigger]'),
   146      isOpen: isPresent('[data-test-drain-popover-form]'),
   147      toggle: clickable('[data-test-drain-popover] [data-test-popover-trigger]'),
   148      isDisabled: attribute('aria-disabled', '[data-test-popover-trigger]'),
   149  
   150      deadlineToggle: toggle('[data-test-drain-deadline-toggle]'),
   151      deadlineOptions: {
   152        open: clickable(
   153          '[data-test-drain-deadline-option-select-parent] .ember-power-select-trigger'
   154        ),
   155        options: collection('.ember-power-select-option', {
   156          label: text(),
   157          choose: clickable(),
   158        }),
   159      },
   160  
   161      setCustomDeadline: fillable('[data-test-drain-custom-deadline]'),
   162      customDeadline: value('[data-test-drain-custom-deadline]'),
   163      forceDrainToggle: toggle('[data-test-force-drain-toggle]'),
   164      systemJobsToggle: toggle('[data-test-system-jobs-toggle]'),
   165  
   166      submit: clickable('[data-test-drain-submit]'),
   167      cancel: clickable('[data-test-drain-cancel]'),
   168  
   169      setDeadline(label) {
   170        this.deadlineOptions.open();
   171        this.deadlineOptions.options.toArray().findBy('label', label).choose();
   172      },
   173    },
   174  
   175    stopDrain: twoStepButton('[data-test-drain-stop]'),
   176    stopDrainIsPresent: isPresent('[data-test-drain-stop]'),
   177  
   178    eligibilityToggle: toggle('[data-test-eligibility-toggle]'),
   179  
   180    eligibilityError: notification('[data-test-eligibility-error]'),
   181    stopDrainError: notification('[data-test-stop-drain-error]'),
   182    drainError: notification('[data-test-drain-error]'),
   183    drainStoppedNotification: notification(
   184      '[data-test-drain-stopped-notification]'
   185    ),
   186    drainUpdatedNotification: notification(
   187      '[data-test-drain-updated-notification]'
   188    ),
   189    drainCompleteNotification: notification(
   190      '[data-test-drain-complete-notification]'
   191    ),
   192  });