Skip to content

Commit 5155b89

Browse files
committed
test(org-redesign): follow the in-place retention save, the SSO create sub-view and the named confirm titles
1 parent 3a00a3f commit 5155b89

2 files changed

Lines changed: 24 additions & 20 deletions

File tree

‎apps/sim/scripts/org-redesign-e2e/checks/links.ts‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ export async function linksChecks() {
6161
assert(!columns.join().includes('Created by'), `Columns ${columns}`)
6262
const [nameCell, list] = [
6363
await row.getByRole('cell').first().boundingBox(),
64-
await page.getByRole('region', { name: 'Links' }).boundingBox(),
64+
// The page is a region named by its heading, and the list a region inside it.
65+
await page
66+
.getByRole('region', { name: 'Links' })
67+
.getByRole('region', { name: 'Links' })
68+
.boundingBox(),
6569
]
6670
assert(nameCell && list, 'The row and the list are on screen')
6771
assert(
@@ -330,9 +334,9 @@ export async function linksChecks() {
330334
await page.goto(`${linksUrl}?search=removable-link`)
331335
await rowFor(page, 'removable-link').click({ button: 'right' })
332336
await menuEntry(page, 'Delete').click()
333-
const modal = dialog(page, 'Delete link')
337+
const modal = dialog(page, 'Delete removable-link')
334338
await expect(
335-
modal.getByText('removable-link will stop working for everyone in your organization.')
339+
modal.getByText('It will stop working for everyone in your organization.')
336340
).toBeVisible()
337341
await modal.getByRole('button', { name: 'Delete', exact: true }).click()
338342
await expect(modal).toHaveCount(0)

‎apps/sim/scripts/org-redesign-e2e/checks/settings.ts‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ export async function settingsChecks() {
489489
await page.goto(`${settingsUrl('admin')}?${new URLSearchParams({ q: MEMBER.email })}`)
490490
await page.getByRole('button', { name: `${MEMBER.email} actions` }).click()
491491
await page.getByRole('menuitem', { name: 'Ban', exact: true }).click()
492-
const modal = dialog(page, 'Ban user')
492+
const modal = dialog(page, `Ban ${MEMBER.name}`)
493493
const reason = modal.getByRole('textbox', { name: 'Reason' })
494494
await reason.fill('Spam')
495495
await reason.press('Enter')
@@ -551,7 +551,7 @@ export async function settingsChecks() {
551551
await route.continue()
552552
})
553553
await page.goto(groupUrl())
554-
await page.getByRole('button', { name: 'Add', exact: true }).click()
554+
await page.getByRole('button', { name: 'Add members', exact: true }).click()
555555
const modal = dialog(page, 'Add members')
556556
const search = modal.getByRole('searchbox')
557557
await search.fill('member')
@@ -621,7 +621,8 @@ export async function settingsChecks() {
621621
bodies.push(route.request().postDataJSON())
622622
await route.fulfill({ status: 500, json: { error: 'Stubbed: no identity provider' } })
623623
})
624-
await page.goto(settingsUrl('sso'))
624+
// The create flow is a sub-view in the URL: Add identity provider opens it.
625+
await page.goto(`${settingsUrl('sso')}?createProvider=true`)
625626
const issuer = page.getByRole('textbox', { name: 'Issuer URL' })
626627
await issuer.fill('not a url')
627628
await page.getByRole('button', { name: 'Add provider', exact: true }).click()
@@ -664,7 +665,8 @@ export async function settingsChecks() {
664665
if (bodies.length === 1) await answerFirst.promise
665666
await route.fulfill({ status: 503, json: { error: 'Stubbed: no identity provider' } })
666667
})
667-
await page.goto(settingsUrl('sso'))
668+
const creating = `${settingsUrl('sso')}?createProvider=true`
669+
await page.goto(creating)
668670
const providerId = page.getByRole('combobox', {
669671
name: 'Provider ID (permanent)',
670672
exact: true,
@@ -693,7 +695,7 @@ export async function settingsChecks() {
693695
await general.click()
694696
await pageTurn(page)
695697
assert.equal(bodies.length, 1, 'A second add went out while the first was pending')
696-
await expect(page).toHaveURL(settingsUrl('sso'))
698+
await expect(page).toHaveURL(creating)
697699
await expect(dialog(page, 'Unsaved changes')).toHaveCount(0)
698700

699701
answerFirst.resolve()
@@ -807,27 +809,25 @@ export async function settingsChecks() {
807809
() =>
808810
withSession(ADMIN, async ({ page }) => {
809811
await page.goto(settingsUrl('data-retention'))
810-
const openPolicy = async () => {
811-
await page.getByRole('button', { name: /^Organization/ }).click()
812-
return page.getByRole('combobox', { name: 'Log retention' })
813-
}
814-
const original = (await (await openPolicy()).textContent())?.trim() ?? ''
815-
for (const [index, name] of ['5 years', original].entries()) {
816-
const picker =
817-
index === 0
818-
? page.getByRole('combobox', { name: 'Log retention' })
819-
: await openPolicy()
812+
await page.getByRole('button', { name: /^Organization/ }).click()
813+
// The policy is edited in place: a save keeps its detail open on what the server stored.
814+
const picker = page.getByRole('combobox', { name: 'Log retention' })
815+
const original = (await picker.textContent())?.trim() ?? ''
816+
const save = page.getByRole('button', { name: 'Save', exact: true })
817+
await expect(save).toBeDisabled()
818+
for (const name of ['5 years', original]) {
820819
await picker.click()
821820
await page.getByRole('option', { name, exact: true }).click()
822821
const write = page.waitForResponse(
823822
(response) =>
824823
pathOf(response.url()).endsWith('/data-retention') &&
825824
response.request().method() !== 'GET'
826825
)
827-
const save = page.getByRole('button', { name: 'Save', exact: true })
828826
await save.click()
829827
assert.ok((await write).ok(), 'The policy did not save')
830-
await expect(page.getByRole('combobox', { name: 'Log retention' })).toBeHidden()
828+
await expect(page.getByRole('button', { name: 'Discard', exact: true })).toHaveCount(0)
829+
await expect(save).toBeDisabled()
830+
await expect(picker).toHaveText(name)
831831
}
832832
})
833833
)

0 commit comments

Comments
 (0)