github.com/GoogleCloudPlatform/testgrid@v0.0.174/web/test/testgrid-group-summary.test.ts (about)

     1  import {
     2    html,
     3    fixture,
     4    defineCE,
     5    unsafeStatic,
     6    expect,
     7    waitUntil,
     8  } from '@open-wc/testing';
     9  
    10  import { TestgridGroupSummary } from '../src/testgrid-group-summary.js';
    11  
    12  describe('Testgrid Group Summary page', () => {
    13    let element: TestgridGroupSummary;
    14    beforeEach(async () => {
    15      // Need to wrap an element to apply its properties (ex. @customElement)
    16      // See https://open-wc.org/docs/testing/helpers/#test-a-custom-class-with-properties
    17      const tagName = defineCE(class extends TestgridGroupSummary {});
    18      const tag = unsafeStatic(tagName);
    19      element = await fixture(html`<${tag} .groupName=${'fake-dashboard-group-1'}></${tag}>`);
    20    });
    21  
    22    // TODO - add accessibility tests
    23    it('renders the table with dashboard summaries', async () => {
    24  
    25      // waiting dashboard summary entries are fully rendered
    26      await waitUntil(
    27        () => element.shadowRoot!.querySelector('i.material-icons'),
    28        'Group summary did not render dashboard summaries',
    29        {
    30          timeout: 4000,
    31        },
    32      );
    33  
    34      expect(element.dashboardSummaries.length).to.be.equal(3);
    35      // verify the summary health description
    36      expect(element.dashboardSummaries[0].tabDescription).to.have.string('2 / 4 PASSING');
    37      expect(element.dashboardSummaries[0].tabDescription).to.have.string('(2 PASSING, 1 FLAKY, 1 FAILING)');
    38      expect(element.dashboardSummaries[1].tabDescription).to.have.string('1 / 3 PASSING');
    39      expect(element.dashboardSummaries[1].tabDescription).to.have.string('(1 PASSING, 1 ACCEPTABLE, 1 FLAKY)');
    40      expect(element.dashboardSummaries[2].tabDescription).to.have.string('2 / 2 PASSING');
    41      expect(element.dashboardSummaries[2].tabDescription).to.have.string('(2 PASSING)');
    42    });
    43  });