/* * (C) Copyright 2011 Nuxeo SA (http://nuxeo.com/) and contributors. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser General Public License * (LGPL) version 2.1 which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl.html * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * Contributors: * Sun Seng David TAN * Florent Guillaume * Antoine Taillefer */ package org.nuxeo.ftest.cap; import static org.junit.Assert.assertTrue; import org.junit.Test; import org.nuxeo.functionaltests.AbstractTest; import org.nuxeo.functionaltests.pages.DocumentBasePage; import org.nuxeo.functionaltests.pages.FileDocumentBasePage; /** * Test file upload in Nuxeo DM. */ public class ITFileUploadTest extends AbstractTest { @Test public void testFileUpload() throws Exception { // Login as Administrator DocumentBasePage defaultDomainPage = login(); // Init repository with a test Workspace DocumentBasePage testWorkspacePage = initRepository(defaultDomainPage); // Create a File with an uploaded blob String filePrefix = "NX-Webdriver-test-"; FileDocumentBasePage fileDocumentBasePage = createFile( testWorkspacePage, "File title", "File description", true, filePrefix, ".txt", "Webdriver test file content."); // Check uploaded file name String uploadedFileName = fileDocumentBasePage.getFileSummaryTab().getMainContentFileText(); assertTrue("Wrong uploaded file name '" + uploadedFileName + "', expected it to contain '" + filePrefix + "'", uploadedFileName.contains(filePrefix)); // Clean up repository cleanRepository(fileDocumentBasePage); // Logout logout(); } }