From beba0f2551f368a04edc8a9dd4d7446e77778c20 Mon Sep 17 00:00:00 2001 From: Damian Mooyman Date: Wed, 24 Feb 2016 14:29:02 +1300 Subject: [PATCH] BUG Fix behat tests for asset abstraction Requires https://github.com/silverstripe-labs/silverstripe-behat-extension/pull/111 --- tests/behat/features/insert-a-link.feature | 2 +- tests/behat/features/insert-an-image.feature | 12 ++++++------ tests/behat/features/manage-files.feature | 10 +++++----- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/tests/behat/features/insert-a-link.feature b/tests/behat/features/insert-a-link.feature index 8618e9a7..d649a82e 100644 --- a/tests/behat/features/insert-a-link.feature +++ b/tests/behat/features/insert-a-link.feature @@ -8,7 +8,7 @@ So that I can link to a external website or a page on my site Given a "page" "Home" And a "page" "About Us" has the "Content" "

My awesome content

" And a "page" "Details" has the "Content" "

My sub-par content

" - And a "file" "assets/file1.jpg" + And a "file" "file1.jpg" And I am logged in with "ADMIN" permissions And I go to "/admin/pages" And I click on "About Us" in the tree diff --git a/tests/behat/features/insert-an-image.feature b/tests/behat/features/insert-an-image.feature index 5a0b28b8..96562184 100644 --- a/tests/behat/features/insert-an-image.feature +++ b/tests/behat/features/insert-an-image.feature @@ -6,8 +6,8 @@ Feature: Insert an image into a page Background: Given a "page" "About Us" - And a "image" "assets/folder1/file1.jpg" - And a "image" "assets/folder1/file2.jpg" + And a "image" "folder1/file1.jpg" + And a "image" "folder1/file2.jpg" And I am logged in with "ADMIN" permissions And I go to "/admin/pages" And I click on "About Us" in the tree @@ -31,7 +31,7 @@ Feature: Insert an image into a page And I attach the file "testfile.jpg" to "AssetUploadField" with HTML5 # TODO Delay previous step until upload succeeded And I wait for 2 seconds - Then there should be a file "assets/Uploads/59de0c841f/testfile.jpg" + Then there should be a filename "Uploads/testfile.jpg" with hash "59de0c841f0da39f1d21ab12cd4fa85b8a91457c" When I press the "Insert" button Then the "Content" HTML field should contain "testfile__Resampled.jpg" # Required to avoid "unsaved changed" browser dialog @@ -39,14 +39,14 @@ Feature: Insert an image into a page @assets Scenario: I can upload an image from my own computer that matches the name of an existing file - Given a "image" "assets/Uploads/file1.jpg" + Given a "image" "Uploads/file1.jpg" When I press the "Insert Media" HTML field button And I attach the file "file1.jpg" to "AssetUploadField" with HTML5 # TODO Delay previous step until upload succeeded And I wait for 2 seconds # Note change in default behaviour from 3.1, respect default Upload.replaceFile=false - Then there should be a file "assets/Uploads/3d0ef6ec37/file1.jpg" - And there should be a file "assets/Uploads/3d0ef6ec37/file1-v2.jpg" + Then there should be a filename "Uploads/file1.jpg" with hash "3d0ef6ec372233e08e87f6e1f02ace9c93ce11fe" + And there should be a filename "Uploads/file1-v2.jpg" with hash "3d0ef6ec372233e08e87f6e1f02ace9c93ce11fe" When I press the "Insert" button Then the "Content" HTML field should contain "file1-v2__Resampled.jpg" # Required to avoid "unsaved changed" browser dialog diff --git a/tests/behat/features/manage-files.feature b/tests/behat/features/manage-files.feature index 0bb33677..37b0b0ab 100644 --- a/tests/behat/features/manage-files.feature +++ b/tests/behat/features/manage-files.feature @@ -5,9 +5,9 @@ Feature: Manage files So that I can insert them into my content efficiently Background: - Given a "image" "assets/folder1/file1.jpg" was created "2012-01-01 12:00:00" - And a "image" "assets/folder1/folder1-1/file2.jpg" was created "2010-01-01 12:00:00" - And a "folder" "assets/folder2" + Given a "image" "folder1/file1.jpg" was created "2012-01-01 12:00:00" + And a "image" "folder1/folder1-1/file2.jpg" was created "2010-01-01 12:00:00" + And a "folder" "folder2" And I am logged in with "ADMIN" permissions And I go to "/admin/assets" @@ -41,7 +41,7 @@ Feature: Manage files Scenario: I can delete a file Given I click on "folder1" in the "Files" table And I click on "file1" in the "folder1" table - And I press the "Delete" button, confirming the dialog + And I press the "Archive" button Then the "folder1" table should not contain "file1" Scenario: I can change the folder of a file @@ -66,7 +66,7 @@ Feature: Manage files And the "Files" table should not contain "file2" Scenario: I can filter the files list view using filetype - Given a "file" "assets/document.pdf" + Given a "file" "document.pdf" And I expand the content filters And I select "Image" from "File type" with javascript And I press the "Search" button