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

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import {
     7    attribute,
     8    clickable,
     9    create,
    10    collection,
    11    isPresent,
    12    text,
    13    visitable,
    14  } from 'ember-cli-page-object';
    15  
    16  import allocations from 'nomad-ui/tests/pages/components/allocations';
    17  import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button';
    18  import LifecycleChart from 'nomad-ui/tests/pages/components/lifecycle-chart';
    19  
    20  export default create({
    21    visit: visitable('/allocations/:id'),
    22  
    23    title: text('[data-test-title]'),
    24  
    25    stop: twoStepButton('[data-test-stop]'),
    26    restart: twoStepButton('[data-test-restart]'),
    27    restartAll: twoStepButton('[data-test-restart-all]'),
    28  
    29    execButton: {
    30      scope: '[data-test-exec-button]',
    31    },
    32  
    33    details: {
    34      scope: '[data-test-allocation-details]',
    35  
    36      job: text('[data-test-job-link]'),
    37      visitJob: clickable('[data-test-job-link]'),
    38  
    39      client: text('[data-test-client-link]'),
    40      visitClient: clickable('[data-test-client-link]'),
    41    },
    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    resourceEmptyMessage: text('[data-test-resource-error-headline]'),
    49  
    50    lifecycleChart: LifecycleChart,
    51  
    52    tasks: collection('[data-test-task-row]', {
    53      name: text('[data-test-name]'),
    54      state: text('[data-test-state]'),
    55      message: text('[data-test-message]'),
    56      time: text('[data-test-time]'),
    57      volumes: text('[data-test-volumes]'),
    58  
    59      hasCpuMetrics: isPresent('[data-test-cpu] .inline-chart progress'),
    60      hasMemoryMetrics: isPresent('[data-test-mem] .inline-chart progress'),
    61      hasUnhealthyDriver: isPresent('[data-test-icon="unhealthy-driver"]'),
    62      hasProxyTag: isPresent('[data-test-proxy-tag]'),
    63  
    64      clickLink: clickable('[data-test-name] a'),
    65      clickRow: clickable('[data-test-name]'),
    66    }),
    67  
    68    firstUnhealthyTask() {
    69      return this.tasks.toArray().findBy('hasUnhealthyDriver');
    70    },
    71  
    72    hasRescheduleEvents: isPresent('[data-test-reschedule-events]'),
    73  
    74    isEmpty: isPresent('[data-test-empty-tasks-list]'),
    75  
    76    wasPreempted: isPresent('[data-test-was-preempted]'),
    77    preempter: {
    78      scope: '[data-test-was-preempted]',
    79  
    80      status: text('[data-test-allocation-status]'),
    81      name: text('[data-test-allocation-name]'),
    82      priority: text('[data-test-job-priority]'),
    83      reservedCPU: text('[data-test-allocation-cpu]'),
    84      reservedMemory: text('[data-test-allocation-memory]'),
    85  
    86      visit: clickable('[data-test-allocation-id]'),
    87      visitJob: clickable('[data-test-job-link]'),
    88      visitClient: clickable('[data-test-client-link]'),
    89    },
    90  
    91    preempted: isPresent('[data-test-preemptions]'),
    92    ...allocations(
    93      '[data-test-preemptions] [data-test-allocation]',
    94      'preemptions'
    95    ),
    96  
    97    ports: collection('[data-test-allocation-port]', {
    98      name: text('[data-test-allocation-port-name]'),
    99      address: text('[data-test-allocation-port-address]'),
   100      to: text('[data-test-allocation-port-to]'),
   101    }),
   102  
   103    services: collection('[data-test-service]', {
   104      name: text('[data-test-service-name]'),
   105      port: text('[data-test-service-port]'),
   106      tags: text('[data-test-service-tags]'),
   107      onUpdate: text('[data-test-service-onupdate]'),
   108      connect: text('[data-test-service-connect]'),
   109      upstreams: text('[data-test-service-upstreams]'),
   110    }),
   111  
   112    error: {
   113      isShown: isPresent('[data-test-error]'),
   114      title: text('[data-test-error-title]'),
   115      message: text('[data-test-error-message]'),
   116      seekHelp: clickable('[data-test-error-message] a'),
   117    },
   118  
   119    inlineError: {
   120      isShown: isPresent('[data-test-inline-error]'),
   121      title: text('[data-test-inline-error-title]'),
   122      message: text('[data-test-inline-error-body]'),
   123      dismiss: clickable('[data-test-inline-error-close]'),
   124    },
   125  });