github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/tests/pages/clients/detail.js (about)

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