Skip to content

Commit 36e7c8e

Browse files
committed
Fix ui tests
Signed-off-by: Andrey Sobolev <[email protected]>
1 parent 7806836 commit 36e7c8e

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

plugins/login-resources/src/components/SelectWorkspace.svelte

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,44 @@
1414
// limitations under the License.
1515
-->
1616
<script lang="ts">
17-
import { isActiveMode, isArchivingMode, isRestoringMode, isUpgradingMode } from '@hcengineering/core'
18-
import { LoginInfo, WorkspaceInfoWithStatus } from '@hcengineering/login'
17+
import {
18+
WorkspaceInfoWithStatus,
19+
isActiveMode,
20+
isArchivingMode,
21+
isRestoringMode,
22+
isUpgradingMode
23+
} from '@hcengineering/core'
24+
import { LoginInfo } from '@hcengineering/login'
1925
import { OK, Severity, Status } from '@hcengineering/platform'
2026
import presentation, { MessageBox, NavLink, isAdminUser, reduceCalls } from '@hcengineering/presentation'
2127
import {
22-
ticker,
2328
Button,
2429
Label,
2530
Scroller,
2631
SearchEdit,
2732
Spinner,
2833
deviceOptionsStore as deviceInfo,
29-
showPopup
34+
showPopup,
35+
ticker
3036
} from '@hcengineering/ui'
3137
import { logOut } from '@hcengineering/workbench'
3238
import { onMount } from 'svelte'
3339
3440
import login from '../plugin'
3541
import {
36-
fetchWorkspace,
3742
getAccount,
43+
getAccountDisplayName,
44+
getHref,
3845
getWorkspaces,
3946
goTo,
4047
navigateToWorkspace,
4148
selectWorkspace,
42-
getAccountDisplayName
49+
unArchive
4350
} from '../utils'
4451
import StatusControl from './StatusControl.svelte'
52+
53+
export let navigateUrl: string | undefined = undefined
54+
4555
let workspaces: WorkspaceInfoWithStatus[] = []
4656
let status = OK
4757
let accountPromise: Promise<LoginInfo | null>
@@ -75,22 +85,23 @@
7585
status = new Status(Severity.INFO, login.status.ConnectingToServer, {})
7686
7787
const [loginStatus, result] = await selectWorkspace(workspaceUrl)
78-
if (isArchivingMode(result?.mode) && result?.workspaceId !== undefined) {
79-
const workspaceId = result?.workspaceId
88+
89+
const ws = workspaces.find((it) => it.uuid === result?.workspace)
90+
if (ws != null && isArchivingMode(ws?.mode) && result?.workspace !== undefined) {
8091
showPopup(MessageBox, {
8192
label: login.string.SelectWorkspace,
8293
message: login.string.WorkspaceArchivedDesc,
8394
canSubmit: true,
8495
params: {},
8596
okLabel: login.string.RestoreArchivedWorkspace,
8697
action: async () => {
87-
if (await unArchive(workspaceId, result.token)) {
98+
if (await unArchive(ws.uuid, result.token)) {
8899
workspaces = await getWorkspaces()
89-
let info = workspaces.filter((it) => it.workspaceId === workspaceId).shift()
100+
let info = workspaces.find((it) => it.uuid === ws.uuid)
90101
while (isRestoringMode(info?.mode) || isUpgradingMode(info?.mode)) {
91102
await new Promise<void>((resolve) => setTimeout(resolve, 5000))
92103
workspaces = await getWorkspaces()
93-
info = workspaces.filter((it) => it.workspaceId === workspaceId).shift()
104+
info = workspaces.find((it) => it.uuid === ws.uuid)
94105
}
95106
}
96107
}

tests/sanity/tests/model/login-page.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export class LoginPage {
1212
inputPassword = (): Locator => this.page.locator('input[name=current-password]')
1313
buttonLogin = (): Locator => this.page.locator('button', { hasText: 'Log In' })
1414
loginWithPassword = (): Locator => this.page.locator('a', { hasText: 'Login with password' })
15+
signUpWithPassword = (): Locator => this.page.locator('a', { hasText: 'Sign up with password' })
1516
linkSignUp = (): Locator => this.page.locator('a.title', { hasText: 'Sign Up' })
1617
invalidCredentialsMessage = (): Locator =>
1718
this.page.getByText('Account not found or the provided credentials are incorrect')
@@ -38,6 +39,7 @@ export class LoginPage {
3839

3940
async clickSignUp (): Promise<void> {
4041
await this.linkSignUp().click()
42+
await this.signUpWithPassword().click()
4143
}
4244

4345
async clickOnRecover (): Promise<void> {

0 commit comments

Comments
 (0)