test: support test e2e with OctoBase (#1593)

Co-authored-by: DarkSky <darksky2048@gmail.com>
This commit is contained in:
Himself65
2023-03-17 03:51:00 -04:00
committed by GitHub
parent 110cec7bf6
commit 94d535f72b
15 changed files with 224 additions and 51 deletions

View File

@@ -36,6 +36,7 @@ export const TransformWorkspaceToAffineModal: React.FC<
{/* <StyleTips>{t('Retain cached cloud data')}</StyleTips> */}
<div>
<StyleButton
data-testid="confirm-enable-cloud-button"
shape="round"
type="primary"
onClick={async () => {

View File

@@ -53,7 +53,8 @@ const AffineRemoteCollaborationPanel: React.FC<
<ul>
<StyledMemberTitleContainer>
<StyledMemberNameContainer>
{t('Users')} ({members.length})
{t('Users')} (
<span data-testid="member-length">{members.length}</span>)
</StyledMemberNameContainer>
<StyledMemberRoleContainer>
{t('Access level')}
@@ -145,6 +146,7 @@ const AffineRemoteCollaborationPanel: React.FC<
setIsInviteModalShow(true);
}}
type="primary"
data-testid="invite-members"
shape="circle"
>
{t('Invite Members')}
@@ -176,6 +178,7 @@ const LocalCollaborationPanel: React.FC<
<>
<Wrapper marginBottom="42px">{t('Collaboration Description')}</Wrapper>
<Button
data-testid="local-workspace-enable-cloud-button"
type="light"
shape="circle"
onClick={() => {

View File

@@ -18,7 +18,8 @@ interface LoginModalProps {
onInviteSuccess: () => void;
}
const gmailReg = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@gmail\.com$/;
const gmailReg =
/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@(gmail|example)\.(com|org)$/;
const Result: React.FC<{
workspaceId: string;
@@ -75,6 +76,7 @@ export const InviteMemberModal = ({
<ContentTitle>{t('Invite Members')}</ContentTitle>
<InviteBox>
<Input
data-testid="invite-member-input"
width={360}
value={email}
onChange={inputChange}
@@ -95,6 +97,7 @@ export const InviteMemberModal = ({
</Content>
<Footer>
<Button
data-testid="invite-member-button"
disabled={!gmailReg.test(email)}
shape="circle"
type="primary"

View File

@@ -31,3 +31,12 @@ const bareAuth = createBareClient(prefixUrl);
const googleAuth = new GoogleAuth(bareAuth);
export const clientAuth = createAuthClient(bareAuth, googleAuth);
export const apis = getApis(bareAuth, clientAuth, googleAuth);
if (!globalThis.AFFINE_APIS) {
globalThis.AFFINE_APIS = apis;
}
declare global {
// eslint-disable-next-line no-var
var AFFINE_APIS: ReturnType<typeof getApis>;
}