Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add batch execution to CloudDataSource #22457

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
33c9394
feat: add batch execution to CloudDataSource, using @graphql-tools/ba…
tgriesser Jun 22, 2022
603ff80
more wip on batching
tgriesser Jun 23, 2022
a29449b
add remoteGraphQLInterceptBatched for testing batched loading
tgriesser Jun 24, 2022
0943be7
Don't change the overscan
tgriesser Jun 24, 2022
2ad75e1
follow up re: @mike-plummer review
tgriesser Jun 28, 2022
cb10649
fix typing for RemoteGraphQLBatchInterceptor
tgriesser Jun 28, 2022
6d76285
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
mjhenkes Jun 28, 2022
1202eb5
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
tgriesser Jun 30, 2022
ba5b0dc
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
tgriesser Jul 26, 2022
d28009e
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
tgriesser Jul 27, 2022
38b667e
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
tgriesser Jul 29, 2022
c656f18
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
tgriesser Aug 10, 2022
104c067
Merge branch 'develop' of github.com:cypress-io/cypress into tgriesse…
estrada9166 Dec 5, 2022
33c6f08
Fix TS
estrada9166 Dec 5, 2022
ecb6596
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Dec 5, 2022
04f3e3f
Fix TS
estrada9166 Dec 6, 2022
5c45b8c
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Dec 6, 2022
ae5b8e0
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Dec 6, 2022
8c726fb
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Dec 6, 2022
39e2781
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Dec 8, 2022
8427aab
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
emilyrohrbough Dec 27, 2022
436dd0e
fix merge conflicts
emilyrohrbough Dec 27, 2022
e328197
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Dec 27, 2022
b0dd617
bump snapshots
emilyrohrbough Dec 28, 2022
d858f6f
Merge branch 'tgriesser/CLOUD-577-spec-list-display-latest-runs-batch…
emilyrohrbough Dec 28, 2022
1c5ff93
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Dec 28, 2022
728be1f
Fix Cy tests
estrada9166 Dec 28, 2022
c038447
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 12, 2023
e8bb513
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 13, 2023
10e95ad
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 23, 2023
a700f8b
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 24, 2023
dc6e16b
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 24, 2023
fa50b1f
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 25, 2023
eeadcc5
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 25, 2023
d181241
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
emilyrohrbough Jan 25, 2023
1587d73
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 25, 2023
2d851aa
Merge branch 'develop' into tgriesser/CLOUD-577-spec-list-display-lat…
estrada9166 Jan 25, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 38 additions & 6 deletions packages/app/cypress/e2e/specs_list_flaky.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,18 @@ describe('App: Spec List - Flaky Indicator', () => {
dashboardUrl: '#',
},
}
} else {
obj.result.data.cloudSpecByPath = {
}
}

return obj.result
})

cy.remoteGraphQLInterceptBatched(async (obj) => {
await new Promise((r) => setTimeout(r, 20))

if (obj.field === 'cloudSpecByPath') {
if (obj.variables.specPath.includes('123.spec.js')) {
return {
__typename: 'CloudProjectSpec',
id: `id${obj.variables.specPath}`,
retrievedAt: new Date().toISOString(),
Expand All @@ -45,12 +55,34 @@ describe('App: Spec List - Flaky Indicator', () => {
__typename: 'CloudSpecRunConnection',
nodes: [],
},
isConsideredFlaky: false,
flakyStatus: null,
isConsideredFlaky: true,
flakyStatus: {
__typename: 'CloudProjectSpecFlakyStatus',
severity: 'LOW',
flakyRuns: 2,
flakyRunsWindow: 50,
lastFlaky: 2,
dashboardUrl: '#',
},
}
}
} else if (obj.result.data && 'cloudLatestRunUpdateSpecData' in obj.result.data) {
obj.result.data.cloudLatestRunUpdateSpecData = {

return {
__typename: 'CloudProjectSpec',
id: `id${obj.variables.specPath}`,
retrievedAt: new Date().toISOString(),
averageDuration: null,
specRuns: {
__typename: 'CloudSpecRunConnection',
nodes: [],
},
isConsideredFlaky: false,
flakyStatus: null,
}
}

if (obj.field === 'cloudLatestRunUpdateSpecData') {
return {
__typename: 'CloudLatestRunUpdateSpecData',
mostRecentUpdate: new Date('2022-06-10').toISOString(),
pollingInterval: 60,
Expand Down
212 changes: 110 additions & 102 deletions packages/app/cypress/e2e/specs_list_latest_runs.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ function specShouldShow (specFileName: string, runDotsClasses: string[], latestR
}

function simulateRunData () {
cy.remoteGraphQLIntercept(async (obj) => {
cy.remoteGraphQLInterceptBatched(async (obj) => {
if (obj.field !== 'cloudSpecByPath') {
return obj.result
}

const fakeRuns = (statuses: string[], idPrefix: string) => {
return statuses.map((s, idx) => {
return {
Expand Down Expand Up @@ -107,34 +111,30 @@ function simulateRunData () {
})
}

if (obj.result.data && 'cloudSpecByPath' in obj.result.data) {
// simulate network latency to allow for caching to register
await new Promise((r) => setTimeout(r, 20))

const statuses = obj.variables.specPath?.includes('accounts_list.spec.js') ?
['PASSED', 'FAILED', 'CANCELLED', 'ERRORED'] :
obj.variables.specPath?.includes('app.spec.js') ?
[] :
['RUNNING', 'PASSED']

const runs = fakeRuns(statuses, obj.variables.specPath)
const averageDuration = obj.variables.specPath?.includes('accounts_list.spec.js') ?
12000 : // 0:12
123000 // 2:03

obj.result.data.cloudSpecByPath = {
__typename: 'CloudProjectSpec',
retrievedAt: new Date().toISOString(),
id: `id${obj.variables.specPath}`,
specRuns: {
__typename: 'CloudSpecRunConnection',
nodes: runs,
},
averageDuration,
}
// simulate network latency to allow for caching to register
await new Promise((r) => setTimeout(r, 20))

const statuses = obj.variables.specPath?.includes('accounts_list.spec.js') ?
['PASSED', 'FAILED', 'CANCELLED', 'ERRORED'] :
obj.variables.specPath?.includes('app.spec.js') ?
[] :
['RUNNING', 'PASSED']

const runs = fakeRuns(statuses, obj.variables.specPath)
const averageDuration = obj.variables.specPath?.includes('accounts_list.spec.js') ?
12000 : // 0:12
123000 // 2:03

return {
__typename: 'CloudProjectSpec',
retrievedAt: new Date().toISOString(),
id: `id${obj.variables.specPath}`,
specRuns: {
__typename: 'CloudSpecRunConnection',
nodes: runs,
},
averageDuration,
}

return obj.result
})
}

Expand Down Expand Up @@ -163,21 +163,12 @@ describe('App/Cloud Integration - Latest runs and Average duration', { viewportW
it('shows placeholders for all visible specs', { defaultCommandTimeout: 6000 }, () => {
cy.loginUser()

cy.remoteGraphQLIntercept(async (obj) => {
if (obj.result.data && 'cloudSpecByPath' in obj.result.data) {
obj.result.data.cloudSpecByPath = {
__typename: 'CloudProjectSpecNotFound',
retrievedAt: new Date().toISOString(),
id: `id${obj.variables.specPath}`,
specRuns: {
__typename: 'CloudSpecRunConnection',
nodes: [],
},
averageDuration: null,
}
cy.remoteGraphQLInterceptBatched(async (obj) => {
return {
__typename: 'CloudProjectSpecNotFound',
retrievedAt: new Date().toISOString(),
message: 'Spec Not Found',
}

return obj.result
})

cy.visitApp()
Expand Down Expand Up @@ -350,6 +341,7 @@ describe('App/Cloud Integration - Latest runs and Average duration', { viewportW
cy.get('.v-popper__popper--shown').should('not.exist')
cy.get(dotSelector('app.spec.js', 'latest')).trigger('mouseleave')

cy.get('.spec-list-container').scrollTo('top')
// oldest 2 status dots will use placeholder
specShouldShow('accounts_new.spec.js', ['gray-300', 'gray-300', 'jade-400'], 'RUNNING')
cy.get(dotSelector('accounts_new.spec.js', 'latest')).trigger('mouseenter')
Expand Down Expand Up @@ -436,6 +428,30 @@ describe('App/Cloud Integration - Latest runs and Average duration', { viewportW
cy.loginUser()

cy.remoteGraphQLIntercept(async (obj, testState) => {
const pollingCounter = testState.pollingCounter ?? 0

if (obj.result.data && 'cloudLatestRunUpdateSpecData' in obj.result.data) {
const mostRecentUpdate = pollingCounter > 1 ? new Date().toISOString() : new Date('2022-06-10').toISOString()
// initial polling interval is set to every second to avoid long wait times
const pollingInterval = pollingCounter > 1 ? 30 : 1

obj.result.data.cloudLatestRunUpdateSpecData = {
__typename: 'CloudLatestRunUpdateSpecData',
mostRecentUpdate,
pollingInterval,
}

testState.pollingCounter = pollingCounter + 1
}

return obj.result
})

cy.remoteGraphQLInterceptBatched(async (obj, testState) => {
if (obj.field !== 'cloudSpecByPath') {
return obj.result
}

const fakeRuns = (statuses: string[], idPrefix: string) => {
return statuses.map((s, idx) => {
return {
Expand Down Expand Up @@ -478,39 +494,23 @@ describe('App/Cloud Integration - Latest runs and Average duration', { viewportW

const pollingCounter = testState.pollingCounter ?? 0

if (obj.result.data && 'cloudSpecByPath' in obj.result.data) {
// simulate network latency to allow for caching to register
await new Promise((r) => setTimeout(r, 20))

const statuses = pollingCounter < 2 ? ['PASSED', 'FAILED', 'CANCELLED', 'ERRORED'] : ['FAILED', 'PASSED', 'FAILED', 'CANCELLED', 'ERRORED']
const runs = fakeRuns(statuses, obj.variables.specPath)
const averageDuration = pollingCounter < 2 ? 12000 : 13000

obj.result.data.cloudSpecByPath = {
__typename: 'CloudProjectSpec',
retrievedAt: new Date().toISOString(),
id: `id${obj.variables.specPath}`,
specRuns: {
__typename: 'CloudSpecRunConnection',
nodes: runs,
},
averageDuration,
}
} else if (obj.result.data && 'cloudLatestRunUpdateSpecData' in obj.result.data) {
const mostRecentUpdate = pollingCounter > 1 ? new Date().toISOString() : new Date('2022-06-10').toISOString()
// initial polling interval is set to every second to avoid long wait times
const pollingInterval = pollingCounter > 1 ? 30 : 1
// simulate network latency to allow for caching to register
await new Promise((r) => setTimeout(r, 20))

obj.result.data.cloudLatestRunUpdateSpecData = {
__typename: 'CloudLatestRunUpdateSpecData',
mostRecentUpdate,
pollingInterval,
}
const statuses = pollingCounter < 2 ? ['PASSED', 'FAILED', 'CANCELLED', 'ERRORED'] : ['FAILED', 'PASSED', 'FAILED', 'CANCELLED', 'ERRORED']
const runs = fakeRuns(statuses, obj.variables.specPath)
const averageDuration = pollingCounter < 2 ? 12000 : 13000

testState.pollingCounter = pollingCounter + 1
return {
__typename: 'CloudProjectSpec',
retrievedAt: new Date().toISOString(),
id: `id${obj.variables.specPath}`,
specRuns: {
__typename: 'CloudSpecRunConnection',
nodes: runs,
},
averageDuration,
}

return obj.result
})

cy.visitApp()
Expand Down Expand Up @@ -542,6 +542,30 @@ describe('App/Cloud Integration - Latest runs and Average duration', { viewportW
cy.loginUser()

cy.remoteGraphQLIntercept(async (obj, testState) => {
const pollingCounter = testState.pollingCounter ?? 0

if (obj.result.data && 'cloudLatestRunUpdateSpecData' in obj.result.data) {
const mostRecentUpdate = new Date('2022-06-10').toISOString()
// initial polling interval is set to every second to avoid long wait times
const pollingInterval = pollingCounter > 1 ? 30 : 1

obj.result.data.cloudLatestRunUpdateSpecData = {
__typename: 'CloudLatestRunUpdateSpecData',
mostRecentUpdate,
pollingInterval,
}

testState.pollingCounter = pollingCounter + 1
}

return obj.result
})

cy.remoteGraphQLInterceptBatched(async (obj, testState) => {
if (obj.field !== 'cloudSpecByPath') {
return obj.result
}

const fakeRuns = (statuses: string[], idPrefix: string) => {
return statuses.map((s, idx) => {
return {
Expand Down Expand Up @@ -584,39 +608,23 @@ describe('App/Cloud Integration - Latest runs and Average duration', { viewportW

const pollingCounter = testState.pollingCounter ?? 0

if (obj.result.data && 'cloudSpecByPath' in obj.result.data) {
// simulate network latency to allow for caching to register
await new Promise((r) => setTimeout(r, 20))

const statuses = pollingCounter < 2 ? ['PASSED', 'FAILED', 'CANCELLED', 'ERRORED'] : ['FAILED', 'PASSED', 'FAILED', 'CANCELLED', 'ERRORED']
const runs = fakeRuns(statuses, obj.variables.specPath)
const averageDuration = pollingCounter < 2 ? 12000 : 13000

obj.result.data.cloudSpecByPath = {
__typename: 'CloudProjectSpec',
retrievedAt: new Date().toISOString(),
id: `id${obj.variables.specPath}`,
specRuns: {
__typename: 'CloudSpecRunConnection',
nodes: runs,
},
averageDuration,
}
} else if (obj.result.data && 'cloudLatestRunUpdateSpecData' in obj.result.data) {
const mostRecentUpdate = new Date('2022-06-10').toISOString()
// initial polling interval is set to every second to avoid long wait times
const pollingInterval = pollingCounter > 1 ? 30 : 1
// simulate network latency to allow for caching to register
await new Promise((r) => setTimeout(r, 20))

obj.result.data.cloudLatestRunUpdateSpecData = {
__typename: 'CloudLatestRunUpdateSpecData',
mostRecentUpdate,
pollingInterval,
}
const statuses = pollingCounter < 2 ? ['PASSED', 'FAILED', 'CANCELLED', 'ERRORED'] : ['FAILED', 'PASSED', 'FAILED', 'CANCELLED', 'ERRORED']
const runs = fakeRuns(statuses, obj.variables.specPath)
const averageDuration = pollingCounter < 2 ? 12000 : 13000

testState.pollingCounter = pollingCounter + 1
return {
__typename: 'CloudProjectSpec',
retrievedAt: new Date().toISOString(),
id: `id${obj.variables.specPath}`,
specRuns: {
__typename: 'CloudSpecRunConnection',
nodes: runs,
},
averageDuration,
}

return obj.result
})

cy.visitApp()
Expand Down
Loading