-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ported source and destination folder navigation test
- Loading branch information
1 parent
7d2e650
commit 48e6172
Showing
2 changed files
with
191 additions
and
113 deletions.
There are no files selected for viewing
191 changes: 191 additions & 0 deletions
191
__tests__/frontend-playwright/source-destination-selection.spec.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,191 @@ | ||
import { expect, test } from "@playwright/test"; | ||
|
||
import { setup } from "../test-utils-playwright/stub-endpoints"; | ||
|
||
test("works with folder selection", async ({ page }) => { | ||
await page.goto("/"); | ||
const getCalls = await setup(page); | ||
|
||
await page.evaluate(() => { | ||
window._endpointStubs.listFolders = [ | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [], | ||
}, | ||
}, | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ | ||
id: "ID_DRIVE_1_FOLDER_1", | ||
name: "FOLDER 1 IN DRIVE 1", | ||
}, | ||
{ | ||
id: "ID_DRIVE_1_FOLDER_2", | ||
name: "FOLDER 2 IN DRIVE 1", | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ | ||
id: "ID_MY_DRIVE_FOLDER_1", | ||
name: "FOLDER 1 IN MY DRIVE", | ||
}, | ||
{ | ||
id: "ID_MY_DRIVE_FOLDER_2", | ||
name: "FOLDER 2 IN MY DRIVE", | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ | ||
id: "ID_MY_DRIVE_FOLDER_2_FOLDER_1", | ||
name: "FOLDER 1 IN FOLDER 2 IN MY DRIVE", | ||
}, | ||
{ | ||
id: "ID_MY_DRIVE_FOLDER_2_FOLDER_2", | ||
name: "FOLDER 2 IN FOLDER 2 IN MY DRIVE", | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ | ||
id: "ID_MY_DRIVE_FOLDER_1", | ||
name: "FOLDER 1 IN MY DRIVE", | ||
}, | ||
{ | ||
id: "ID_MY_DRIVE_FOLDER_2", | ||
name: "FOLDER 2 IN MY DRIVE", | ||
}, | ||
], | ||
}, | ||
}, | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ | ||
id: "ID_MY_DRIVE_FOLDER_1_FOLDER_1", | ||
name: "FOLDER 1 IN FOLDER 1 IN MY DRIVE", | ||
}, | ||
{ | ||
id: "ID_MY_DRIVE_FOLDER_1_FOLDER_2", | ||
name: "FOLDER 2 IN FOLDER 1 IN MY DRIVE", | ||
}, | ||
], | ||
}, | ||
}, | ||
]; | ||
window._endpointStubs.listSharedDrives = [ | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ id: "ID_DRIVE_1", name: "DRIVE 1" }, | ||
{ id: "ID_DRIVE_2", name: "DRIVE 2" }, | ||
], | ||
}, | ||
}, | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ id: "ID_DRIVE_1", name: "DRIVE 1" }, | ||
{ id: "ID_DRIVE_2", name: "DRIVE 2" }, | ||
], | ||
}, | ||
}, | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ id: "ID_DRIVE_1", name: "DRIVE 1" }, | ||
{ id: "ID_DRIVE_2", name: "DRIVE 2" }, | ||
], | ||
}, | ||
}, | ||
{ | ||
status: "success", | ||
value: { | ||
status: "success", | ||
response: [ | ||
{ id: "ID_DRIVE_1", name: "DRIVE 1" }, | ||
{ id: "ID_DRIVE_2", name: "DRIVE 2" }, | ||
], | ||
}, | ||
}, | ||
]; | ||
window._endpointStubs.move = [ | ||
{ | ||
status: "success", | ||
value: { status: "success", response: { errors: [] } }, | ||
}, | ||
]; | ||
}); | ||
|
||
await expect( | ||
page.getByText("Shared drive mover", { exact: true }), | ||
).toBeVisible(); | ||
await page.getByText("Continue").click(); | ||
await page.getByText("DRIVE 2").dblclick(); | ||
await page.getByText("Drive Selection").dblclick(); | ||
await page.getByText("DRIVE 1").dblclick(); | ||
await page.getByText("FOLDER 2 IN DRIVE 1").click(); | ||
await page.getByText("Continue").click(); | ||
await page.getByText("My Drive").dblclick(); | ||
await page.getByText("FOLDER 2 IN MY DRIVE").dblclick(); | ||
await page.getByText("My Drive", { exact: true }).click(); | ||
await page.getByText("FOLDER 1 IN MY DRIVE").dblclick(); | ||
await page.getByText("FOLDER 2 IN FOLDER 1 IN MY DRIVE").click(); | ||
await page.getByText("Continue").click(); | ||
await expect( | ||
page.getByText( | ||
'contents of the folder "DRIVE 1/FOLDER 2 IN DRIVE 1" into the folder "My Drive/FOLDER 1 IN MY DRIVE/FOLDER 2 IN FOLDER 1 IN MY DRIVE"', | ||
), | ||
).toBeVisible(); | ||
await page.getByText("Move", { exact: true }).click(); | ||
await expect(page.getByText("Done!", { exact: true })).toBeVisible(); | ||
await expect(page.getByText("Successfully moved")).toBeVisible(); | ||
|
||
const listFolderCalls = getCalls("listFolders"); | ||
expect(listFolderCalls).toHaveLength(6); | ||
expect(listFolderCalls[0]).toStrictEqual(["ID_DRIVE_2"]); | ||
expect(listFolderCalls[1]).toStrictEqual(["ID_DRIVE_1"]); | ||
expect(listFolderCalls[2]).toStrictEqual(["root"]); | ||
expect(listFolderCalls[3]).toStrictEqual(["ID_MY_DRIVE_FOLDER_2"]); | ||
expect(listFolderCalls[4]).toStrictEqual(["root"]); | ||
expect(listFolderCalls[5]).toStrictEqual(["ID_MY_DRIVE_FOLDER_1"]); | ||
|
||
const moveCalls = getCalls("move"); | ||
expect(moveCalls).toHaveLength(1); | ||
expect(moveCalls[0]).toStrictEqual([ | ||
"ID_DRIVE_1_FOLDER_2", | ||
"ID_MY_DRIVE_FOLDER_1_FOLDER_2", | ||
true, | ||
true, | ||
false, | ||
]); | ||
}); |
This file was deleted.
Oops, something went wrong.