Skip to content

Commit ff56f6a

Browse files
Fix start modal tests
1 parent adadc9b commit ff56f6a

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

app/gui/integration-test/dashboard/actions/index.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,24 @@ export function mockAll({ page, setupAPI }: MockParams) {
156156
})
157157
}
158158

159+
export interface MockAllAndLoginParams extends MockParams {
160+
readonly hideStartModal?: boolean | undefined
161+
}
162+
159163
/** Set up all mocks, and log in with dummy credentials. */
160-
export function mockAllAndLogin({ page, setupAPI }: MockParams) {
164+
export function mockAllAndLogin({ page, setupAPI, hideStartModal = true }: MockAllAndLoginParams) {
161165
const actions = mockAll({ page, setupAPI })
166+
162167
return actions
163168
.step('Login', (page) => login({ page }))
164169
.step('Wait for dashboard to load', waitForDashboardToLoad)
165170
.step('Check if start modal is shown', async (page) => {
166-
// @ts-expect-error This is the only place in which the private member `.context`
167-
// should be accessed.
168-
const context = actions.context
169-
await new StartModalActions(page, context).close()
171+
if (hideStartModal) {
172+
// @ts-expect-error This is the only place in which the private member `.context`
173+
// should be accessed.
174+
const context = actions.context
175+
await new StartModalActions(page, context).close()
176+
}
170177
})
171178
.into(DrivePageActions<Context>)
172179
}

app/gui/integration-test/dashboard/startModal.spec.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import { expect, test, type Page } from '@playwright/test'
33

44
import { mockAllAndLogin } from './actions'
5+
import StartModalActions from './actions/StartModalActions'
56

67
/** Find an editor container. */
78
function locateEditor(page: Page) {
@@ -22,8 +23,12 @@ function locateSamples(page: Page) {
2223
}
2324

2425
test('create project from template', ({ page }) =>
25-
mockAllAndLogin({ page, setupAPI: (api) => api.setFeatureFlags({ enableCloudExecution: true }) })
26-
.openStartModal()
26+
mockAllAndLogin({
27+
page,
28+
setupAPI: (api) => api.setFeatureFlags({ enableCloudExecution: true }),
29+
hideStartModal: false,
30+
})
31+
.into(StartModalActions)
2732
.createProjectFromTemplate(0)
2833
.do(async (thePage) => {
2934
await expect(locateEditor(thePage)).toBeAttached()

0 commit comments

Comments
 (0)