github.com/Ilhicas/nomad@v1.0.4-0.20210304152020-e86851182bc3/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  
    23    execButton: {
    24      scope: '[data-test-exec-button]',
    25    },
    26  
    27    details: {
    28      scope: '[data-test-allocation-details]',
    29  
    30      job: text('[data-test-job-link]'),
    31      visitJob: clickable('[data-test-job-link]'),
    32  
    33      client: text('[data-test-client-link]'),
    34      visitClient: clickable('[data-test-client-link]'),
    35    },
    36  
    37    resourceCharts: collection('[data-test-primary-metric]', {
    38      name: text('[data-test-primary-metric-title]'),
    39      chartClass: attribute('class', '[data-test-percentage-chart] progress'),
    40    }),
    41  
    42    resourceEmptyMessage: text('[data-test-resource-error-headline]'),
    43  
    44    lifecycleChart: LifecycleChart,
    45  
    46    tasks: collection('[data-test-task-row]', {
    47      name: text('[data-test-name]'),
    48      state: text('[data-test-state]'),
    49      message: text('[data-test-message]'),
    50      time: text('[data-test-time]'),
    51      volumes: text('[data-test-volumes]'),
    52  
    53      hasUnhealthyDriver: isPresent('[data-test-icon="unhealthy-driver"]'),
    54      hasProxyTag: isPresent('[data-test-proxy-tag]'),
    55  
    56      clickLink: clickable('[data-test-name] a'),
    57      clickRow: clickable('[data-test-name]'),
    58    }),
    59  
    60    firstUnhealthyTask() {
    61      return this.tasks.toArray().findBy('hasUnhealthyDriver');
    62    },
    63  
    64    hasRescheduleEvents: isPresent('[data-test-reschedule-events]'),
    65  
    66    isEmpty: isPresent('[data-test-empty-tasks-list]'),
    67  
    68    wasPreempted: isPresent('[data-test-was-preempted]'),
    69    preempter: {
    70      scope: '[data-test-was-preempted]',
    71  
    72      status: text('[data-test-allocation-status]'),
    73      name: text('[data-test-allocation-name]'),
    74      priority: text('[data-test-job-priority]'),
    75      reservedCPU: text('[data-test-allocation-cpu]'),
    76      reservedMemory: text('[data-test-allocation-memory]'),
    77  
    78      visit: clickable('[data-test-allocation-id]'),
    79      visitJob: clickable('[data-test-job-link]'),
    80      visitClient: clickable('[data-test-client-link]'),
    81    },
    82  
    83    preempted: isPresent('[data-test-preemptions]'),
    84    ...allocations('[data-test-preemptions] [data-test-allocation]', 'preemptions'),
    85  
    86    ports: collection('[data-test-allocation-port]', {
    87      name: text('[data-test-allocation-port-name]'),
    88      address: text('[data-test-allocation-port-address]'),
    89      to: text('[data-test-allocation-port-to]'),
    90    }),
    91  
    92    services: collection('[data-test-service]', {
    93      name: text('[data-test-service-name]'),
    94      port: text('[data-test-service-port]'),
    95      tags: text('[data-test-service-tags]'),
    96      connect: text('[data-test-service-connect]'),
    97      upstreams: text('[data-test-service-upstreams]'),
    98    }),
    99  
   100    error: {
   101      isShown: isPresent('[data-test-error]'),
   102      title: text('[data-test-error-title]'),
   103      message: text('[data-test-error-message]'),
   104      seekHelp: clickable('[data-test-error-message] a'),
   105    },
   106  
   107    inlineError: {
   108      isShown: isPresent('[data-test-inline-error]'),
   109      title: text('[data-test-inline-error-title]'),
   110      message: text('[data-test-inline-error-body]'),
   111      dismiss: clickable('[data-test-inline-error-close]'),
   112    },
   113  });