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

     1  import {
     2    attribute,
     3    create,
     4    collection,
     5    clickable,
     6    hasClass,
     7    isPresent,
     8    property,
     9    text,
    10    visitable,
    11  } from 'ember-cli-page-object';
    12  
    13  import allocations from 'nomad-ui/tests/pages/components/allocations';
    14  import taskGroups from 'nomad-ui/tests/pages/components/task-groups';
    15  import twoStepButton from 'nomad-ui/tests/pages/components/two-step-button';
    16  import recommendationAccordion from 'nomad-ui/tests/pages/components/recommendation-accordion';
    17  import jobClientStatusBar from 'nomad-ui/tests/pages/components/job-client-status-bar';
    18  
    19  export default create({
    20    visit: visitable('/jobs/:id'),
    21  
    22    jobName: text('[data-test-job-name]'),
    23  
    24    tabs: collection('[data-test-tab]', {
    25      id: attribute('data-test-tab'),
    26      visit: clickable('a'),
    27    }),
    28  
    29    tabFor(id) {
    30      return this.tabs.toArray().findBy('id', id);
    31    },
    32  
    33    recommendations: collection(
    34      '[data-test-recommendation-accordion]',
    35      recommendationAccordion
    36    ),
    37  
    38    stop: twoStepButton('[data-test-stop]'),
    39    start: twoStepButton('[data-test-start]'),
    40    purge: twoStepButton('[data-test-purge]'),
    41  
    42    packTag: isPresent('[data-test-pack-tag]'),
    43    metaTable: isPresent('[data-test-meta]'),
    44  
    45    execButton: {
    46      scope: '[data-test-exec-button]',
    47      isDisabled: property('disabled'),
    48      hasTooltip: hasClass('tooltip'),
    49      tooltipText: attribute('aria-label'),
    50    },
    51  
    52    incrementButton: {
    53      scope: '[data-test-scale-controls-increment]',
    54      isDisabled: property('disabled'),
    55    },
    56  
    57    dispatchButton: {
    58      scope: '[data-test-dispatch-button]',
    59      isDisabled: property('disabled'),
    60    },
    61  
    62    stats: collection('[data-test-job-stat]', {
    63      id: attribute('data-test-job-stat'),
    64      text: text(),
    65    }),
    66  
    67    statFor(id) {
    68      return this.stats.toArray().findBy('id', id);
    69    },
    70  
    71    packStats: collection('[data-test-pack-stat]', {
    72      id: attribute('data-test-pack-stat'),
    73      text: text(),
    74    }),
    75  
    76    packStatFor(id) {
    77      return this.packStats.toArray().findBy('id', id);
    78    },
    79  
    80    jobClientStatusSummary: {
    81      scope: '[data-test-job-client-summary]',
    82      statusBar: jobClientStatusBar('[data-test-job-client-status-bar]'),
    83      toggle: {
    84        scope: '[data-test-accordion-head] [data-test-accordion-toggle]',
    85        click: clickable(),
    86        isDisabled: attribute('disabled'),
    87        tooltip: attribute('aria-label'),
    88      },
    89    },
    90    childrenSummary: jobClientStatusBar(
    91      '[data-test-job-summary] [data-test-children-status-bar]'
    92    ),
    93    allocationsSummary: jobClientStatusBar(
    94      '[data-test-job-summary] [data-test-allocation-status-bar]'
    95    ),
    96    ...taskGroups(),
    97    ...allocations(),
    98  
    99    viewAllAllocations: text('[data-test-view-all-allocations]'),
   100  
   101    jobsHeader: {
   102      scope: '[data-test-jobs-header]',
   103      hasSubmitTime: isPresent('[data-test-jobs-submit-time-header]'),
   104      hasNamespace: isPresent('[data-test-jobs-namespace-header]'),
   105    },
   106  
   107    jobs: collection('[data-test-job-row]', {
   108      id: attribute('data-test-job-row'),
   109      name: text('[data-test-job-name]'),
   110      namespace: text('[data-test-job-namespace]'),
   111      link: attribute('href', '[data-test-job-name] a'),
   112      submitTime: text('[data-test-job-submit-time]'),
   113      status: text('[data-test-job-status]'),
   114      type: text('[data-test-job-type]'),
   115      priority: text('[data-test-job-priority]'),
   116      taskGroups: text('[data-test-job-task-groups]'),
   117  
   118      clickRow: clickable(),
   119      clickName: clickable('[data-test-job-name] a'),
   120    }),
   121  
   122    error: {
   123      isPresent: isPresent('[data-test-error]'),
   124      title: text('[data-test-error-title]'),
   125      message: text('[data-test-error-message]'),
   126      seekHelp: clickable('[data-test-error-message] a'),
   127    },
   128  
   129    recentAllocationsEmptyState: {
   130      headline: text('[data-test-empty-recent-allocations-headline]'),
   131    },
   132  });