Skip to content

Commit

Permalink
test: fix tests for stable branch
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed May 15, 2024
1 parent a51d2ce commit 2b12f78
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 30 deletions.
20 changes: 0 additions & 20 deletions tests/e2e/cucumber/features/smoke/languageChange.feature
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,3 @@ Feature: language settings
| Brian Murphy hat check_message mit Ihnen geteilt |
And "Alice" logs out


Scenario: anonymous user language change
When "Alice" logs in
And "Alice" creates the following folder in personal space using API
| name |
| folderPublic |
And "Alice" uploads the following local file into personal space using API
| localFile | to |
| filesForUpload/lorem.txt | lorem.txt |

And "Alice" opens the "files" app
And "Alice" creates a public link of following resource using the sidebar panel
| resource | password |
| folderPublic | %public% |
And "Alice" logs out
When "Anonymous" opens the public link "Link"
And "Anonymous" unlocks the public link with password "%public%"
And "Anonymous" opens the user menu
And "Anonymous" changes the language to "Deutsch - German"
Then "Anonymous" should see the following account page title "Konto"
3 changes: 2 additions & 1 deletion tests/e2e/cucumber/features/smoke/trashbinDelete.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,12 @@ Feature: Trashbin delete
Given "Alice" creates the following folders in personal space using API
| name |
| folderToShare |
| empty-folder |
| empty-folder |
And "Alice" creates the following files into personal space using API
| pathToFile | content |
| folderToShare/lorem.txt | lorem ipsum |
| sample.txt | sample |
And "Alice" opens the "files" app
And "Alice" shares the following resource using the sidebar panel
| resource | recipient | type | role | resourceType |
| folderToShare | Brian | user | Can edit | folder |
Expand Down
10 changes: 2 additions & 8 deletions tests/e2e/support/objects/app-files/resource/actions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Download, Locator, Page, expect } from '@playwright/test'
import util from 'util'
import path from 'path'
import { resourceExists, waitForResources } from './utils'
import { resourceExists, waitForResources, resourceNameSelector } from './utils'
import { editor, sidebar } from '../utils'
import { File, Space } from '../../../types'
import { dragDropFiles } from '../../../utils/dragDrop'
Expand All @@ -26,8 +26,6 @@ const checkBoxForTrashbin = `//*[@data-test-resource-path="%s"]//ancestor::tr//i
const filesSelector = '//*[@data-test-resource-name="%s"]'
export const fileRow =
'//ancestor::*[(contains(@class, "oc-tile-card") or contains(@class, "oc-tbody-tr"))]'
export const resourceNameSelector =
':is(#files-space-table, .oc-tiles-item, #files-shared-with-me-accepted-section, .files-table) [data-test-resource-name="%s"]'
// following breadcrumb selectors is passed to buildXpathLiteral function as the content to be inserted might contain quotes
const breadcrumbResourceNameSelector =
'//span[contains(@class, "oc-breadcrumb-item-text") and text()=%s]'
Expand Down Expand Up @@ -138,13 +136,9 @@ export const clickResource = async ({
const folder = name.replace(/'/g, "\\'").replace(/"/g, '\\"')

const resource = page.locator(util.format(resourceNameSelector, folder))
const itemId = await resource.locator(fileRow).getAttribute('data-item-id')
await Promise.all([
page.waitForResponse(
(resp) =>
resp.url().endsWith(encodeURIComponent(name)) ||
resp.url().endsWith(itemId) ||
resp.url().endsWith(encodeURIComponent(itemId))
(resp) => resp.status() === 207 && resp.request().method() === 'PROPFIND'
),
resource.click()
])
Expand Down
4 changes: 3 additions & 1 deletion tests/e2e/support/objects/app-files/resource/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { errors, Page } from '@playwright/test'
import util from 'util'

const resourceNameSelector = '#files-space-table [data-test-resource-name="%s"]'
export const resourceNameSelector =
':is(#files-space-table, .oc-tiles-item, #files-shared-with-me-accepted-section, .files-table) [data-test-resource-name="%s"]'

/**
* one of the few places where timeout should be used, as we also use this to detect the absence of an element
* it is not possible to differentiate between `element not there yet` and `element not loaded yet`.
Expand Down

0 comments on commit 2b12f78

Please sign in to comment.