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

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