<?php
/*
- * Copyright 2010, Roland Mas
+ * Copyright 2010-2011, Roland Mas
* Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
*
* This file is part of FusionForge.
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; either version 2 of the License,
* or (at your option) any later version.
- *
+ *
* FusionForge 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
$this->assertTrue($this->isTextPresent("Project Information"));
$this->click("link=Users and permissions");
$this->waitForPageToLoad("30000");
- $this->assertTrue($this->isTextPresent("Members of ProjectA"));
+ $this->assertTrue($this->isTextPresent("Current Project Members"));
$this->click("//tr/td/form/div[contains(.,'Anonymous')]/../../../td/form/div/input[contains(@value,'Unlink Role')]");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("Role unlinked successfully"));
function testGlobalRolesAndPermissions()
{
- $this->login("admin");
+ $this->login(FORGE_ADMIN_USERNAME);
$this->click("link=Site Admin");
$this->waitForPageToLoad("30000");
$this->assertSelected("//select[@name='data[approve_projects][-1]']", "Approve projects");
$this->assertNotSelected("//select[@name='data[approve_projects][-1]']", "No access");
$this->assertSelected("//select[@name='data[approve_news][-1]']", "Approve news");
-
+
// Whoops, we don't actually want the news moderation bit, unset it
$this->select("//select[@name='data[approve_news][-1]']", "label=No access");
$this->click ("//input[@value='Submit']") ;
$this->click ("//input[@value='Add User']") ;
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("projapp Lastname"));
-
+
$this->click("link=Site Admin");
$this->waitForPageToLoad("30000");
$this->select ("//form[contains(@action,'globalroleedit.php')]//select[@name='role_id']", "label=News moderators") ;
$this->click ("//input[@value='Add User']") ;
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isTextPresent("toto Lastname"));
-
+
// Register project
$this->registerProject ("TotoProject", "toto") ;
// Non-regression test for Adacore ticket K802-005
// (Deletion of global roles)
- $this->switchUser("admin");
+ $this->switchUser(FORGE_ADMIN_USERNAME);
$this->click("link=Site Admin");
$this->waitForPageToLoad("30000");
$this->type ("//form[contains(@action,'globalroleedit.php')]//input[@name='role_name']", "Temporary role") ;
$this->click("link=Site Admin");
$this->waitForPageToLoad("30000");
$this->assertTrue($this->isElementPresent("//option[.='Temporary role']"));
- $this->select ("//form[contains(@action,'globalroleedit.php')]//select[@name='role_id']", "label=Project approvers") ;
+ $this->select ("//form[contains(@action,'globalroleedit.php')]//select[@name='role_id']", "label=Temporary role") ;
$this->click ("//form[contains(@action,'globalroleedit.php')]//input[@value='Edit Role']") ;
$this->waitForPageToLoad("30000");
-
$this->type ("//form[contains(@action,'globalroleedit.php')]//input[@name='form_unix_name']", "toto") ;
$this->click ("//input[@value='Add User']") ;
$this->waitForPageToLoad("30000");
$this->click ("//input[@type='checkbox' and @name='sure']") ;
$this->click ("//input[@value='Delete role']") ;
$this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Cannot remove a non empty role"));
$this->click("link=Site Admin");
$this->waitForPageToLoad("30000");
+ $this->select ("//form[contains(@action,'globalroleedit.php')]//select[@name='role_id']", "label=Temporary role") ;
+ $this->click ("//form[contains(@action,'globalroleedit.php')]//input[@value='Edit Role']") ;
+ $this->waitForPageToLoad("30000");
+ $this->click ("//a[contains(@href,'/users/toto')]/../../td/input[@type='checkbox']") ;
+ $this->click ("//input[@name='reallyremove']") ;
+ $this->click ("//input[@name='dormusers']") ;
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Site Admin");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isElementPresent("//option[.='Temporary role']"));
+ $this->select ("//form[contains(@action,'globalroleedit.php')]//select[@name='role_id']", "label=Temporary role") ;
+ $this->click ("//form[contains(@action,'globalroleedit.php')]//input[@value='Edit Role']") ;
+ $this->waitForPageToLoad("30000");
+ $this->click ("//input[@type='checkbox' and @name='sure']") ;
+ $this->click ("//input[@value='Delete role']") ;
+ $this->waitForPageToLoad("30000");
$this->assertFalse($this->isElementPresent("//option[.='Temporary role']"));
}
function testProjectRolesAndPermissions()
{
- $this->populateStandardTemplate('trackers');
+ $this->populateStandardTemplate('all');
$this->createUser ("bigboss") ;
$this->createUser ("guru") ;
// Non-regression test for Adacore ticket K802-005
// (Deletion of project-wide roles)
- $this->switchUser("admin");
+ $this->switchUser(FORGE_ADMIN_USERNAME);
$this->gotoProject ("MetaProject") ;
$this->click("link=Admin");
$this->waitForPageToLoad("30000");
$this->select("//input[@value='Add Member']/../select[@name='role_id']", "label=Temporary role");
$this->click ("//input[@value='Add Member']") ;
$this->waitForPageToLoad("30000");
- $this->click ("//td/form/div[contains(.,'Temporary role')]/../div/input[@value='Delete role']") ;
+ $this->click ("//td/form/div[contains(.,'Temporary role')]/../../form/div/input[@value='Delete role']") ;
+ $this->waitForPageToLoad("30000");
+ $this->click ("//input[@type='checkbox' and @name='sure']") ;
+ $this->click ("//input[@value='Submit']") ;
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("Cannot remove a non empty role"));
+ $this->click("//tr/td/div[contains(.,'Temporary role')]/../div/form/input[@name='username' and @value='trainee']/../input[@value='Remove']") ;
+ $this->waitForPageToLoad("30000");
+ $this->click ("//td/form/div[contains(.,'Temporary role')]/../../form/div/input[@value='Delete role']") ;
$this->waitForPageToLoad("30000");
$this->click ("//input[@type='checkbox' and @name='sure']") ;
$this->click ("//input[@value='Submit']") ;
$this->waitForPageToLoad("30000");
$this->assertFalse($this->isTextPresent("Temporary role"));
+
+ // Non-regression test
+ $this->click("link=Site Admin");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Display Full Project List/Edit Projects");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=SubProject");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Permanently Delete Project");
+ $this->waitForPageToLoad("30000");
+ $this->click("sure");
+ $this->click("reallysure");
+ $this->click("reallyreallysure");
+ $this->click("submit");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Home");
+ $this->waitForPageToLoad("30000");
+ $this->assertFalse($this->isTextPresent("SubProject"));
+
+ // Make sure permissions are saved for news-related forums
+ $this->switchUser(FORGE_ADMIN_USERNAME);
+ $this->gotoProject ("MetaProject") ;
+
+ $this->click("link=News");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Submit");
+ $this->waitForPageToLoad("30000");
+ $this->type("summary", "First news");
+ $this->type("details", "This is a simple news.");
+ $this->click("submit");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=News");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("First news"));
+ $this->click("link=First news");
+ $this->waitForPageToLoad("30000");
+ $this->assertTrue($this->isTextPresent("First news"));
+ $this->assertTrue($this->isTextPresent("This is a simple news."));
+
+ $this->click("link=Admin");
+ $this->waitForPageToLoad("30000");
+ $this->click("link=Users and permissions");
+ $this->waitForPageToLoad("30000");
+ $this->click ("//td/form/div[contains(.,'Anonymous')]/../div/input[@value='Edit Permissions']") ;
+ $this->waitForPageToLoad("30000");
+
+ $this->select("//tr/td[contains(.,'first-news')]/../td/select", "label=Read only");
+ $this->click ("//input[@value='Submit']") ;
+ $this->waitForPageToLoad("30000");
+ $this->assertSelected("//tr/td[contains(.,'first-news')]/../td/select", "Read only");
+
+ $this->select("//tr/td[contains(.,'first-news')]/../td/select", "label=Moderated post");
+ $this->click ("//input[@value='Submit']") ;
+ $this->waitForPageToLoad("30000");
+ $this->assertSelected("//tr/td[contains(.,'first-news')]/../td/select", "Moderated post");
+
+ $this->select("//tr/td[contains(.,'first-news')]/../td/select", "label=Unmoderated post");
+ $this->click ("//input[@value='Submit']") ;
+ $this->waitForPageToLoad("30000");
+ $this->assertSelected("//tr/td[contains(.,'first-news')]/../td/select", "Unmoderated post");
}
}
?>