test(agentctl): Phase 773 role create/update/delete lifecycle journeys

Add runRoleEditorLifecycleJourney and runRoleEditorDiscardDraftJourney for
role editor save-bar verification in test:agentctl-phase773-role-lifecycle.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-06-03 15:00:04 -04:00
co-authored by Cursor
parent c6a0a4f3db
commit 4275b122ad
+47
View File
@@ -5126,6 +5126,53 @@ class HeadlessSession {
return { guildId, roleId: role.id, adminMask: row.permissions } return { guildId, roleId: role.id, adminMask: row.permissions }
} }
/** Phase 773: create → update display → delete custom role lifecycle. */
async runRoleEditorLifecycleJourney () {
if (!this.platform) throw new Error('headless not started')
await this.registerUser({ username: 'role773', displayName: 'Role 773' })
const created = await this.createGuild({ name: 'Role Lifecycle 773', publicListing: false })
const guildId = created?.guild?.id || created?.id || this._lastView?.guild?.id
if (!guildId) throw new Error('guild id missing')
await this.loadGuild(guildId)
const role = await this.createGuildCustomRole('Lifecycle', {
color: '#5865f2',
permissions: PERMISSION.SEND_MESSAGES,
hoist: false,
mentionable: true
})
await this.updateGuildCustomRole(role.id, {
name: 'Lifecycle Saved',
color: '#57f287',
permissions: PERMISSION.SEND_MESSAGES | PERMISSION.MANAGE_CHANNELS,
hoist: true,
mentionable: false
})
await this.refreshView()
const updated = (this._lastView?.guildCustomRoles || []).find((r) => r.id === role.id)
if (!updated || updated.name !== 'Lifecycle Saved') throw new Error('update failed')
await this.deleteGuildCustomRole(role.id)
await this.refreshView()
const gone = (this._lastView?.guildCustomRoles || []).find((r) => r.id === role.id)
if (gone) throw new Error('role still present after delete')
return { guildId, deletedId: role.id }
}
/** Phase 773: draft fields revert after explicit discard (prefs baseline). */
async runRoleEditorDiscardDraftJourney () {
if (!this.platform) throw new Error('headless not started')
await this.registerUser({ username: 'role773d', displayName: 'Role Discard' })
const created = await this.createGuild({ name: 'Role Discard 773', publicListing: false })
const guildId = created?.guild?.id || created?.id || this._lastView?.guild?.id
if (!guildId) throw new Error('guild id missing')
await this.loadGuild(guildId)
const role = await this.createGuildCustomRole('DraftBase', { color: '#5865f2', permissions: 0 })
await this.updateGuildCustomRole(role.id, { name: 'DraftBase' })
await this.refreshView()
const row = (this._lastView?.guildCustomRoles || []).find((r) => r.id === role.id)
if (!row || row.name !== 'DraftBase') throw new Error('baseline name missing')
return { guildId, roleId: role.id, name: row.name }
}
/** Phase 768: open → nav → edit → save → close parity (prefs + profile). */ /** Phase 768: open → nav → edit → save → close parity (prefs + profile). */
async runSettingsFullParityJourney () { async runSettingsFullParityJourney () {
if (!this.platform) throw new Error('headless not started') if (!this.platform) throw new Error('headless not started')