import { browser, by, ExpectedConditions as until, $, element } from 'protractor';
import { AppPage } from './app.page';

export class UserSettingsPage extends AppPage {

    public async gotoFeaturesTab(): Promise<FeaturesTab> {
        await browser.wait(until.presenceOf(element(by.cssContainingText('a', 'Features Opt-in'))));
        await element(by.cssContainingText('a', 'Features Opt-in')).click();
        return new FeaturesTab();
    }
}

export class FeaturesTab {

    public async getFeatureLevel(): Promise<string> {
        await browser.wait(until.presenceOf(element(by.css('input:checked'))));
        let checkedInput = await element(by.css('input:checked'));
        return await checkedInput.getAttribute('id');
    }
}

import { browser, by, ExpectedConditions as until, $, element } from 'protractor';
import { AppPage } from './app.page';

export class UserSettingsPage extends AppPage {

    public async gotoFeaturesTab(): Promise<FeaturesTab> {
        await browser.wait(until.presenceOf(element(by.cssContainingText('a', 'Features Opt-in'))));
        await element(by.cssContainingText('a', 'Features Opt-in')).click();
        return new FeaturesTab();
    }
}

export class FeaturesTab {
    readonly featureInputXpath = '//input/ancestor::*[contains(@class, \'active\')]//span[contains(@class,\'icon-\')]';
    public async getFeatureLevel(): Promise<string> {
        await browser.wait(until.presenceOf(element(by.xpath(this.featureInputXpath))));
        let checkedInput = await element(by.xpath(this.featureInputXpath));
        let featureInputIconCss = await checkedInput.getAttribute('class');
        let featureCss = featureInputIconCss.match('icon-(internal|experimental|beta|released)');
        await expect(featureCss).not.toBeNull('feature css');
        if (featureCss != null) {
            return featureCss[1];
        }
        return 'null';
    }
}

Update real feature level detection.
Update real feature level detection.
