aboutsummaryrefslogtreecommitdiffstats
path: root/vid-automation/src/main/java/vid/automation/test/test/ReadOnlyTest.java
blob: 5607496dc129612feec2757c1f915fcf0b971a44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
package vid.automation.test.test;

import org.junit.Assert;
import org.openecomp.sdc.ci.tests.datatypes.UserCredentials;
import org.openecomp.sdc.ci.tests.utilities.GeneralUIUtils;
import org.openqa.selenium.By;

import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
import vid.automation.test.Constants;
import vid.automation.test.model.User;
import vid.automation.test.sections.SearchExistingPage;
import vid.automation.test.sections.SideMenu;
import vid.automation.test.services.UsersService;

import java.io.IOException;
import java.util.ArrayList;

/**
 * Created by Oren on 7/16/17.
 */
public class ReadOnlyTest extends VidBaseTestCase {
    UsersService usersService = new UsersService();

    public ReadOnlyTest() throws IOException {
    }

    @Override
    protected UserCredentials getUserCredentials() {
        User user =  usersService.getUser(Constants.Users.READONLY);
        return new UserCredentials(user.credentials.userId, user.credentials.password, "", "", "");
    }

    @Test
    public void testBrowsASDCReadOnly() {
        SideMenu.navigateToBrowseASDCPage();
        Assert.assertTrue(isDeployBtnDisabled());
    }

    private boolean isDeployBtnDisabled(){
        WebElement deployBtn = GeneralUIUtils.getWebElementBy(By.className(Constants.BrowseASDC.DEPOLY_SERVICE_CLASS));
        return !deployBtn.isEnabled();
    }

    @Test
    public void testSearchExistingReadOnly() {
        String UUID = "1dddde21-daad-4433-894e-bd715e98d587";
        SearchExistingPage searchExistingPage = new SearchExistingPage();
        SideMenu.navigateToSearchExistingPage();
        searchExistingPage.searchForInstanceByUuid(UUID);
        searchExistingPage.clickSubmitButton();
        assertViewEditButtonState(Constants.VIEW_BUTTON_TEXT, UUID);
        searchExistingPage.clickEditViewByInstanceId(UUID);
        searchExistingPage.checkForEditButtons();
    }

    @Test
    private void testCreateNewInstanceReadOnly() {
        SideMenu.navigateToCreateNewServicePage();
        assertDropdownPermittedItemsByValue(new ArrayList<String>(), Constants.CreateNewInstance.SUBSCRIBER_NAME_OPTION_CLASS);
    }


}