Skip to content

Commit cab787b

Browse files
max-nextcloudmejo-
authored andcommitted
chore(test): Ensure mtime changes
Etags will not be updated if the mtime does not change. So if the file was overwritten within the same second it was created the mtime and the etag will remain the same and the outdated cached content will be distributed. This problem is specific to our test setup. Usually one does not update a file multiple times per second. Adjust the test to ensure the mtime changes. Signed-off-by: Max <max@nextcloud.com>
1 parent 8fc17a5 commit cab787b

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

playwright/e2e/propfind.spec.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,22 @@ test.describe('Text PROPFIND extension', () => {
2323
})
2424

2525
test('always adds rich workspace property', async ({ page, user }) => {
26-
const properties = [PROPERTY_WORKSPACE_FLAT, PROPERTY_WORKSPACE_FILE_FLAT]
26+
const properties = [
27+
PROPERTY_WORKSPACE_FLAT,
28+
PROPERTY_WORKSPACE_FILE_FLAT,
29+
]
30+
const fiveSecondsAgo = Math.floor(Date.now() / 1000) - 5
2731

2832
await page.goto('/apps/dashboard')
29-
await user.uploadFile({ name: 'Readme.md', content: '' })
33+
await user.uploadFile({
34+
name: 'Readme.md',
35+
content: '',
36+
mtime: fiveSecondsAgo,
37+
})
3038

3139
const [root1] = await propfindFolder(user, '/', 0, properties)
3240
expect(root1).toHaveProperty(PROPERTY_WORKSPACE_FLAT, '')
3341

34-
await deleteWebDAVResource(user, '/Readme.md')
3542
await user.uploadFile({ name: 'Readme.md', content: '## Hello world\n' })
3643
const [root2] = await propfindFolder(user, '/', 0, properties)
3744
expect(root2).toHaveProperty(PROPERTY_WORKSPACE_FLAT, '## Hello world\n')

0 commit comments

Comments
 (0)