github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/ui/tests/pages/clients/detail.js (about)

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