|
| 1 | +describe('cloud debug test filtering', () => { |
| 2 | + beforeEach(() => { |
| 3 | + cy.scaffoldProject('cloud-debug-filter') |
| 4 | + cy.openProject('cloud-debug-filter') |
| 5 | + cy.startAppServer('e2e') |
| 6 | + }) |
| 7 | + |
| 8 | + it('works with nested suites', () => { |
| 9 | + cy.visitApp(`specs/runner?file=cypress/e2e/test.cy.js`) |
| 10 | + |
| 11 | + cy.waitForSpecToFinish() |
| 12 | + |
| 13 | + cy.withCtx((ctx) => { |
| 14 | + ctx.coreData.cloud.testsForRunResults = ['t2'] |
| 15 | + }) |
| 16 | + |
| 17 | + cy.visitApp(`specs/runner?file=cypress/e2e/test.cy.js&runId=123`) |
| 18 | + cy.waitForSpecToFinish({ passCount: 0, failCount: 1 }) |
| 19 | + |
| 20 | + cy.get('.runnable-title').contains('t2') |
| 21 | + |
| 22 | + cy.get('.debug-dismiss').contains('1 / 4 tests').click() |
| 23 | + cy.waitForSpecToFinish({ passCount: 2, failCount: 2 }) |
| 24 | + |
| 25 | + cy.withCtx((ctx) => { |
| 26 | + ctx.coreData.cloud.testsForRunResults = ['s1 t4'] |
| 27 | + }) |
| 28 | + |
| 29 | + cy.visitApp(`specs/runner?file=cypress/e2e/test.cy.js&runId=123`) |
| 30 | + cy.waitForSpecToFinish({ passCount: 0, failCount: 1 }) |
| 31 | + |
| 32 | + cy.get('.runnable-title').contains('t4') |
| 33 | + }) |
| 34 | + |
| 35 | + it('wraps filter UI with large number of tests', () => { |
| 36 | + cy.visitApp(`specs/runner?file=cypress/e2e/lots-of-tests.cy.js`) |
| 37 | + |
| 38 | + cy.get('[data-cy="reporter-panel"]').as('reporterPanel') |
| 39 | + |
| 40 | + cy.waitForSpecToFinish() |
| 41 | + |
| 42 | + cy.withCtx((ctx) => { |
| 43 | + ctx.coreData.cloud.testsForRunResults = ['test1'] |
| 44 | + }) |
| 45 | + |
| 46 | + cy.visitApp(`specs/runner?file=cypress/e2e/lots-of-tests.cy.js&runId=123`) |
| 47 | + cy.waitForSpecToFinish({ passCount: 50 }) |
| 48 | + |
| 49 | + cy.get('@reporterPanel').then((el) => el.width(500)) |
| 50 | + cy.get('@reporterPanel').percySnapshot('wide') |
| 51 | + |
| 52 | + cy.get('@reporterPanel').then((el) => el.width(350)) |
| 53 | + cy.get('@reporterPanel').percySnapshot('medium') |
| 54 | + |
| 55 | + cy.get('@reporterPanel').then((el) => el.width(250)) |
| 56 | + cy.get('@reporterPanel').percySnapshot('narrow') |
| 57 | + |
| 58 | + cy.get('@reporterPanel').then((el) => el.width(150)) |
| 59 | + cy.get('@reporterPanel').percySnapshot('skinny') |
| 60 | + }) |
| 61 | + |
| 62 | + it('works with skips and onlys', () => { |
| 63 | + cy.visitApp(`specs/runner?file=cypress/e2e/skip-and-only.cy.js`) |
| 64 | + |
| 65 | + cy.waitForSpecToFinish({ passCount: 0, failCount: 1 }) |
| 66 | + |
| 67 | + // .only is respected |
| 68 | + cy.withCtx((ctx) => { |
| 69 | + ctx.coreData.cloud.testsForRunResults = ['t1', 't3'] |
| 70 | + }) |
| 71 | + |
| 72 | + cy.visitApp(`specs/runner?file=cypress/e2e/skip-and-only.cy.js&runId=123`) |
| 73 | + cy.waitForSpecToFinish({ passCount: 0, failCount: 1 }) |
| 74 | + |
| 75 | + cy.get('.runnable-title').contains('t1') |
| 76 | + |
| 77 | + cy.get('.debug-dismiss').click().waitForSpecToFinish() |
| 78 | + |
| 79 | + // .only is ignored as it is not in set of filtered tests |
| 80 | + cy.withCtx((ctx) => { |
| 81 | + ctx.coreData.cloud.testsForRunResults = ['t3'] |
| 82 | + }) |
| 83 | + |
| 84 | + cy.visitApp(`specs/runner?file=cypress/e2e/skip-and-only.cy.js&runId=123`) |
| 85 | + cy.waitForSpecToFinish({ passCount: 0, failCount: 1 }) |
| 86 | + |
| 87 | + cy.get('.runnable-title').contains('t3') |
| 88 | + |
| 89 | + cy.get('.debug-dismiss').click().waitForSpecToFinish() |
| 90 | + |
| 91 | + // .skip is respected |
| 92 | + cy.withCtx((ctx) => { |
| 93 | + ctx.coreData.cloud.testsForRunResults = ['t2', 't3'] |
| 94 | + }) |
| 95 | + |
| 96 | + cy.visitApp(`specs/runner?file=cypress/e2e/skip-and-only.cy.js&runId=123`) |
| 97 | + cy.waitForSpecToFinish({ passCount: 0, failCount: 1, pendingCount: 1 }) |
| 98 | + cy.get('.runnable-title').first().contains('t2') |
| 99 | + cy.get('.runnable-title').last().contains('t3') |
| 100 | + |
| 101 | + cy.get('.debug-dismiss').contains('2 / 4 tests').click().waitForSpecToFinish() |
| 102 | + |
| 103 | + // suite.only is respected |
| 104 | + cy.withCtx((ctx) => { |
| 105 | + ctx.coreData.cloud.testsForRunResults = ['t3', 's1 t4'] |
| 106 | + }) |
| 107 | + |
| 108 | + cy.visitApp(`specs/runner?file=cypress/e2e/skip-and-only.cy.js&runId=123`) |
| 109 | + cy.waitForSpecToFinish({ passCount: 0, failCount: 1 }) |
| 110 | + cy.get('.runnable-title').contains('t4') |
| 111 | + }) |
| 112 | + |
| 113 | + it('works with browser filter', () => { |
| 114 | + cy.withCtx((ctx) => { |
| 115 | + ctx.coreData.cloud.testsForRunResults = ['t1', 's1 t2'] |
| 116 | + }) |
| 117 | + |
| 118 | + cy.visitApp(`specs/runner?file=cypress/e2e/browsers.cy.js&runId=123`) |
| 119 | + |
| 120 | + cy.get('.runnable-title').eq(0).contains('t1 (skipped due to browser)') |
| 121 | + cy.get('.runnable-title').eq(1).contains('s1 (skipped due to browser)') |
| 122 | + cy.get('.runnable-title').eq(2).contains('t2') |
| 123 | + }) |
| 124 | + |
| 125 | + it('filter is maintained across cross-domain reinitialization', () => { |
| 126 | + cy.visitApp(`specs/runner?file=cypress/e2e/domain-change.cy.js`) |
| 127 | + |
| 128 | + cy.get('[data-cy="reporter-panel"]').as('reporterPanel') |
| 129 | + |
| 130 | + cy.waitForSpecToFinish() |
| 131 | + |
| 132 | + cy.withCtx((ctx) => { |
| 133 | + ctx.coreData.cloud.testsForRunResults = ['t2', 't3'] |
| 134 | + }) |
| 135 | + |
| 136 | + cy.visitApp(`specs/runner?file=cypress/e2e/domain-change.cy.js&runId=123`) |
| 137 | + cy.waitForSpecToFinish({ failCount: 2 }) |
| 138 | + }) |
| 139 | +}) |
0 commit comments