Created
March 11, 2024 07:28
-
-
Save mandemeskel/d744489a29deaf9addd752d3192646b0 to your computer and use it in GitHub Desktop.
Retool, User Activation Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { User } from '@/types/user_types' | |
import { CreateUserTapi } from '../tapis/create_user_tapi' | |
import { LoginTapi } from '../tapis/login_tapi' | |
import { test, type Page } from '@playwright/test' | |
import { openCreateUserTab } from '@/open_tabs' | |
test.describe.configure({ mode: 'serial' }) | |
let page: Page | |
test.beforeAll(async ({ browser }) => { | |
page = await browser.newPage() | |
}) | |
test.afterAll(async () => { | |
await page.close() | |
}) | |
test.describe('The create user form', () => { | |
test('allows the admin to activate the user', async () => { | |
const user: User = createUser() | |
const create_user_tapi = new CreateUserTapi(user, page) | |
const login_tapi = new LoginTapi(page) | |
await login_tapi.goToPage() | |
await openCreateUserTab(page) | |
await create_user_tapi.activateUser() | |
await create_user_tapi.expectUserToBeActivated() | |
}) | |
test('allows the admin to deactivate the user', async () => { | |
const user: User = createUser() | |
const create_user_tapi = new CreateUserTapi(user, page) | |
await create_user_tapi.deactivateUser() | |
await create_user_tapi.expectUserToBeDeactivated() | |
}) | |
}) | |
function createUser(): User { | |
return { | |
contact_info: { | |
name: "Bob", | |
email: "Bob@gmail.com", | |
phone: "123456789", | |
}, | |
id: "", | |
updated_at: "", | |
public_id: "gf6756f", | |
is_active: false, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment