Skip to content

Commit d4fa37e

Browse files
tbiethmanemilyrohrboughryanthemanuelbrian-mann
authored
test: Migrate more runner UI specs to app (#20118)
* Adding remaining reporter error tests. * Removing existing integration spec file * Removing existing runner fixtures for error specs * Fixing ts lint * Testing with less tests kept in memory * Testing some cypress-in-cypress settings to improve run-mode performance. * Reverting changes to doc_url specs * PR Updates. Inverting default value for 'open in IDE' validation in an attempt to reduce test time. * Cleaning up ported code * Update system-tests/projects/runner-e2e-specs/cypress/fixtures/index.html Co-authored-by: Emily Rohrbough <[email protected]> * Trying build workaround * Bumping up parallelized builds for app integration tests * Removing suspicious tests to validate CI build * Removing more suspicious tests to test CI * Trying to not scaffold every navigation * Bumping resources for run-app-integration job. Updating reporter.errors specs to appropriately reduce AUT refreshes. * Couple API tweaks * test: Migrating runner hooks specs to app * Removing unused helper from runner package; cleaning up a few things * Updating yarn.lock * fix: Migrating runner sessions ui tests to app * test: Migrating runner's runner.ui tests to app * test: Migrating runner retries ui tests to app * Cleaning up a few things for consistency * Fixing ts errors * Removing tests for runner header that have existing coverage in app * Working around detached elements in CI * Still working around detached elements in CI * Updating sessions.ui test to click more carefully. Adding bit more coverage around runner header and snapshot pinning. * Update packages/app/cypress/e2e/runner/retries.ui.cy.ts Co-authored-by: Ryan Manuel <[email protected]> * Migrating issue specs. Updating TODOs. Hopefully addressing some flake. * Stopping icon spin animation for percy snapshots * WIP * customPercyCommand.ts * WIP: working on custom percy snapshots for hiding elements other than the reporter [skip ci] * WIP: Adding naive mutation observer for reseting DOM mutations after snapshots [skip ci] Got tired of tripping over types, I can add them when we're feature complete * Implementing scoped snapshots throughout app/runner tests, let's see how percy output looks * Adding more snapshots to runner tests. * Using spec link as click target * Stop taking snapshots of failed tests * Scoping selector playground snapshots (though they're still unstyled) * Addressing flake in virtualized spec list * Drying up runner snapshotting * Logging single percy snapshot that reflects proper viewport and overrides * Updating describes to better match previous snapshot names * Removing added snapshots to get more accurate better diff presentation in Percy * Removing new runner.ui snapshots as well * Adding a few PR recommendations. Updating one last spec name that was corrected for grammar and no longer matched. Updating/removing relevant TODOs. * Updating to use anticipated default width for reporter * Updating tests for consistency with previous snapshots * Tying original command into promise chain * Let's try that again * Making percy command enqueuing explicit to test result * Scoping down on some variables. Using defaults for sessions tests. * Updating some overrides to see if visibility is handled inconsistently * Whitespace vanquished, working session test updates back in for long command logs * Viewport height is not reflected in snapshots, let's try forcing the height on the panel * Forcing the height issue * Let's try a minHeight on the percy command * Cleaning up alterations made during percy exploration * Trying to get a cleaner percy diff after merge * Fix Percy to use 10.0-release branch as baseline image comparison * add comments about temporary percy env vars * Adding some doc for changes made to customPercyCommand Co-authored-by: Emily Rohrbough <[email protected]> Co-authored-by: Ryan Manuel <[email protected]> Co-authored-by: Brian Mann <[email protected]> Co-authored-by: Emily Rohrbough <[email protected]>
1 parent 3fbed9b commit d4fa37e

File tree

78 files changed

+2022
-1339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+2022
-1339
lines changed

circle.yml

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,11 @@ commands:
457457
# https://www.gep13.co.uk/blog/chocolatey-error-hashes-do-not-match
458458
[[ $PLATFORM == 'windows' && '<<parameters.browser>>' == 'chrome' ]] && choco install googlechrome --ignore-checksums || [[ $PLATFORM != 'windows' ]]
459459
- run:
460+
# the PERCY_TARGET_BRANCH and PERCY_TARGET_COMMIT env vars
461+
# are a temporary hack to workaround percy issues with
462+
# PR's not diffing the right base branch due to other problems
463+
# upstream with finalizing builds. These will be removed
464+
# once we implement a more permanent solution.
460465
command: |
461466
cmd=$([[ <<parameters.percy>> == 'true' ]] && echo 'yarn percy exec --parallel -- --') || true
462467
DEBUG=<<parameters.debug>> \
@@ -465,6 +470,8 @@ commands:
465470
PERCY_PARALLEL_NONCE=$PLATFORM-$CIRCLE_SHA1 \
466471
PERCY_ENABLE=${PERCY_TOKEN:-0} \
467472
PERCY_PARALLEL_TOTAL=-1 \
473+
PERCY_TARGET_BRANCH="10.0-release" \
474+
PERCY_TARGET_COMMIT=$(git log -n 1 origin/10.0-release --pretty="%H") \
468475
$cmd yarn workspace @packages/<<parameters.package>> cypress:run:<<parameters.type>> --browser <<parameters.browser>> --record --parallel --group <<parameters.package>>-<<parameters.type>>
469476
- store_test_results:
470477
path: /tmp/cypress
@@ -1034,7 +1041,17 @@ jobs:
10341041
echo "This is an external PR, cannot access other services"
10351042
circleci-agent step halt
10361043
fi
1037-
- run: PERCY_PARALLEL_NONCE=$PLATFORM-$CIRCLE_SHA1 yarn percy build:finalize
1044+
- run:
1045+
# the PERCY_TARGET_BRANCH and PERCY_TARGET_COMMIT env vars
1046+
# are a temporary hack to workaround percy issues with
1047+
# PR's not diffing the right base branch due to other problems
1048+
# upstream with finalizing builds. These will be removed
1049+
# once we implement a more permanent solution.
1050+
command: |
1051+
PERCY_PARALLEL_NONCE=$PLATFORM-$CIRCLE_SHA1 \
1052+
PERCY_TARGET_BRANCH="10.0-release" \
1053+
PERCY_TARGET_COMMIT=$(git log -n 1 origin/10.0-release --pretty="%H") \
1054+
yarn percy build:finalize
10381055
10391056
cli-visual-tests:
10401057
<<: *defaults
@@ -1054,10 +1071,17 @@ jobs:
10541071
path: cli/visual-snapshots
10551072
- run:
10561073
name: Upload CLI snapshots for diffing
1074+
# the PERCY_TARGET_BRANCH and PERCY_TARGET_COMMIT env vars
1075+
# are a temporary hack to workaround percy issues with
1076+
# PR's not diffing the right base branch due to other problems
1077+
# upstream with finalizing builds. These will be removed
1078+
# once we implement a more permanent solution.
10571079
command: |
10581080
PERCY_PARALLEL_NONCE=$PLATFORM-$CIRCLE_SHA1 \
10591081
PERCY_ENABLE=${PERCY_TOKEN:-0} \
10601082
PERCY_PARALLEL_TOTAL=-1 \
1083+
PERCY_TARGET_BRANCH="10.0-release" \
1084+
PERCY_TARGET_COMMIT=$(git log -n 1 origin/10.0-release --pretty="%H") \
10611085
yarn percy snapshot ./cli/visual-snapshots
10621086
10631087
unit-tests:
@@ -1325,12 +1349,19 @@ jobs:
13251349
command: yarn build-for-tests
13261350
working_directory: packages/reporter
13271351
- run:
1352+
# the PERCY_TARGET_BRANCH and PERCY_TARGET_COMMIT env vars
1353+
# are a temporary hack to workaround percy issues with
1354+
# PR's not diffing the right base branch due to other problems
1355+
# upstream with finalizing builds. These will be removed
1356+
# once we implement a more permanent solution.
13281357
command: |
13291358
CYPRESS_KONFIG_ENV=production \
13301359
CYPRESS_RECORD_KEY=$PACKAGES_RECORD_KEY \
13311360
PERCY_PARALLEL_NONCE=$PLATFORM-$CIRCLE_SHA1 \
13321361
PERCY_ENABLE=${PERCY_TOKEN:-0} \
13331362
PERCY_PARALLEL_TOTAL=-1 \
1363+
PERCY_TARGET_BRANCH="10.0-release" \
1364+
PERCY_TARGET_COMMIT=$(git log -n 1 origin/10.0-release --pretty="%H") \
13341365
yarn percy exec --parallel -- -- \
13351366
yarn cypress:run --record --parallel --group reporter
13361367
working_directory: packages/reporter
@@ -1468,11 +1499,19 @@ jobs:
14681499
- run:
14691500
name: Run tests
14701501
# will use PERCY_TOKEN environment variable if available
1502+
#
1503+
# the PERCY_TARGET_BRANCH and PERCY_TARGET_COMMIT env vars
1504+
# are a temporary hack to workaround percy issues with
1505+
# PR's not diffing the right base branch due to other problems
1506+
# upstream with finalizing builds. These will be removed
1507+
# once we implement a more permanent solution.
14711508
command: |
14721509
CYPRESS_KONFIG_ENV=production \
14731510
PERCY_PARALLEL_NONCE=$PLATFORM-$CIRCLE_SHA1 \
14741511
PERCY_ENABLE=${PERCY_TOKEN:-0} \
14751512
PERCY_PARALLEL_TOTAL=-1 \
1513+
PERCY_TARGET_BRANCH="10.0-release" \
1514+
PERCY_TARGET_COMMIT=$(git log -n 1 origin/10.0-release --pretty="%H") \
14761515
yarn percy exec --parallel -- -- \
14771516
yarn test --reporter mocha-multi-reporters --reporter-options configFile=../../mocha-reporter-config.json
14781517
working_directory: npm/design-system

packages/app/cypress/component/support/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { createPinia } from '../../../src/store'
2424
import { setActivePinia } from 'pinia'
2525
import type { Pinia } from 'pinia'
2626
import 'cypress-real-events/support'
27-
import installCustomPercyCommand from '@packages/ui-components/cypress/support/customPercyCommand'
27+
import { installCustomPercyCommand } from '@packages/ui-components/cypress/support/customPercyCommand'
2828

2929
let pinia: Pinia
3030

packages/app/cypress/e2e/cypress-in-cypress-component.cy.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import defaultMessages from '@packages/frontend-shared/src/locales/en-US.json'
2+
import { snapshotAUTPanel } from './support/snapshot-aut-panel'
23

34
describe('Cypress In Cypress', { viewportWidth: 1200 }, () => {
45
beforeEach(() => {
@@ -23,19 +24,19 @@ describe('Cypress In Cypress', { viewportWidth: 1200 }, () => {
2324
cy.contains('Firefox').should('be.visible')
2425
cy.findByTestId('viewport').click()
2526

26-
cy.percySnapshot('browsers open')
27+
snapshotAUTPanel('browsers open')
2728
cy.contains('Firefox').should('be.hidden')
2829
cy.contains('The viewport determines the width and height of your application. By default the viewport will be 500px by 500px for Component Testing unless specified by a cy.viewport command.')
2930
.should('be.visible')
3031

31-
cy.percySnapshot('viewport info open')
32+
snapshotAUTPanel('viewport info open')
3233

3334
cy.get('body').click()
3435

3536
cy.findByTestId('playground-activator').click()
3637
cy.findByTestId('playground-selector').clear().type('#__cy_root')
3738

38-
cy.percySnapshot('cy.get selector')
39+
snapshotAUTPanel('cy.get selector')
3940

4041
cy.findByTestId('playground-num-elements').contains('1 Match')
4142

@@ -49,7 +50,7 @@ describe('Cypress In Cypress', { viewportWidth: 1200 }, () => {
4950

5051
cy.findByTestId('playground-selector').clear().type('Component Test')
5152

52-
cy.percySnapshot('cy.contains selector')
53+
snapshotAUTPanel('cy.contains selector')
5354

5455
cy.findByTestId('playground-num-elements').contains('1 Match')
5556
})

packages/app/cypress/e2e/cypress-in-cypress-e2e.cy.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import defaultMessages from '@packages/frontend-shared/src/locales/en-US.json'
2+
import { snapshotAUTPanel } from './support/snapshot-aut-panel'
23

34
describe('Cypress In Cypress', { viewportWidth: 1200 }, () => {
45
beforeEach(() => {
@@ -23,19 +24,19 @@ describe('Cypress In Cypress', { viewportWidth: 1200 }, () => {
2324
cy.contains('Firefox').should('be.visible')
2425
cy.findByTestId('viewport').click()
2526

26-
cy.percySnapshot('browsers open')
27+
snapshotAUTPanel('browsers open')
2728
cy.contains('Firefox').should('be.hidden')
2829
cy.contains('The viewport determines the width and height of your application. By default the viewport will be 1000px by 660px for End-to-end Testing unless specified by a cy.viewport command.')
2930
.should('be.visible')
3031

31-
cy.percySnapshot('viewport info open')
32+
snapshotAUTPanel('viewport info open')
3233

3334
cy.get('body').click()
3435

3536
cy.findByTestId('playground-activator').click()
3637
cy.findByTestId('playground-selector').clear().type('li')
3738

38-
cy.percySnapshot('cy.get selector')
39+
snapshotAUTPanel('cy.get selector')
3940

4041
cy.findByTestId('playground-num-elements').contains('3 Matches')
4142

@@ -44,7 +45,7 @@ describe('Cypress In Cypress', { viewportWidth: 1200 }, () => {
4445

4546
cy.findByTestId('playground-selector').clear().type('Item 1')
4647

47-
cy.percySnapshot('cy.contains selector')
48+
snapshotAUTPanel('cy.contains selector')
4849

4950
cy.findByTestId('playground-num-elements').contains('1 Match')
5051

packages/runner/cypress/e2e/issues/issue-18042.js renamed to packages/app/cypress/e2e/runner/issues/issue-18042.cy.js

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
1-
const helpers = require('../../support/helpers')
2-
3-
const { createCypress } = helpers
4-
const { runIsolatedCypress } = createCypress()
1+
import { loadSpec } from '../support/spec-loader'
52

63
// https://github.com/cypress-io/cypress/issues/18042
74
describe('issue 18042', () => {
8-
beforeEach(function () {
9-
return runIsolatedCypress(`cypress/fixtures/issues/issue-18042.js`)
10-
})
11-
125
it('Call count is shown even if cy.stub().log(false)', function () {
6+
loadSpec({
7+
fileName: 'issue-18042.cy.js',
8+
passCount: 1,
9+
})
10+
1311
cy.contains('Spies / Stubs (1)').click()
1412
cy.get('.call-count').eq(1).should('have.text', '1')
1513
})
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { loadSpec } from '../support/spec-loader'
2+
3+
// https://github.com/cypress-io/cypress/issues/9162
4+
describe('issue 9162', () => {
5+
it('tests does not hang even if there is a fail in before().', function () {
6+
loadSpec({
7+
fileName: 'issue-9162.cy.js',
8+
passCount: 0,
9+
failCount: 1,
10+
})
11+
12+
cy.contains('expected true to be false')
13+
})
14+
})

0 commit comments

Comments
 (0)