<commit_before>var common = require('../common.js').common;

common.start_and_log_in();

var form_sel = 'form[action^="/json/settings/change"]';

casper.then(function () {
    casper.test.info('Settings page');
    casper.click('a[href^="#settings"]');
    casper.test.assertUrlMatch(/^http:\/\/[^\/]+\/#settings/, 'URL suggests we are on settings page');
    casper.test.assertExists('#settings.tab-pane.active', 'Settings page is active');

    casper.test.assertNotVisible("#old_password");
    casper.test.assertSelectorHasText('.my_fullname', 'Iago');

    casper.click(".change_password_button");
});

casper.waitUntilVisible("#old_password", function () {
    casper.test.assertVisible("#old_password");
    casper.test.assertVisible("#new_password");
    casper.test.assertVisible("#confirm_password");

    casper.test.assertEqual(casper.getFormValues(form_sel).full_name, "Iago");

    casper.fill(form_sel, {
        "full_name": "IagoNew",
        "old_password": "<PASSWORD>",
        "new_password": "<PASSWORD>",
        "confirm_password": "<PASSWORD>"
    });
    casper.click('input[name="change_settings"]');
});

casper.waitUntilVisible('#settings-status', function () {
    casper.test.assertSelectorHasText('#settings-status', 'Updated settings!');
    casper.test.assertSelectorHasText('.my_fullname', 'IagoNew');

    casper.test.assertNotVisible('');
    casper.click('#api_key_button');
});

casper.waitUntilVisible('#get_api_key_password', function () {
    casper.fill('form[action^="/json/fetch_api_key"]', {'password':'<PASSWORD>'});
    casper.click('input[name="view_api_key"]');
});

casper.waitUntilVisible('#api_key_value', function () {
    casper.test.assertMatch(casper.fetchText('#api_key_value'), /[a-zA-Z0-9]{32}/, "Looks like an API key");

    // Change it all back so the next test can still log in
    casper.fill(form_sel, {
        "full_name": "Iago",
        "old_password": "<PASSWORD>",
        "new_password": "<PASSWORD>",
        "confirm_password": "<PASSWORD>"
    });
    casper.click('input[name="change_settings"]');
});

casper.waitUntilVisible('#settings-status', function () {
    casper.test.assertSelectorHasText('#settings-status', 'Updated settings!');
});

// TODO: test the "Declare Zulip Bankruptcy option"

common.then_log_out();

casper.run(function () {
    casper.test.done();
});
<commit_msg>casper-tests: Stop looking for full name.<commit_after>var common = require('../common.js').common;

common.start_and_log_in();

var form_sel = 'form[action^="/json/settings/change"]';

casper.then(function () {
    casper.test.info('Settings page');
    casper.click('a[href^="#settings"]');
    casper.test.assertUrlMatch(/^http:\/\/[^\/]+\/#settings/, 'URL suggests we are on settings page');
    casper.test.assertExists('#settings.tab-pane.active', 'Settings page is active');

    casper.test.assertNotVisible("#old_password");

    casper.click(".change_password_button");
});

casper.waitUntilVisible("#old_password", function () {
    casper.test.assertVisible("#old_password");
    casper.test.assertVisible("#new_password");
    casper.test.assertVisible("#confirm_password");

    casper.test.assertEqual(casper.getFormValues(form_sel).full_name, "Iago");

    casper.fill(form_sel, {
        "full_name": "IagoNew",
        "old_password": "<PASSWORD>",
        "new_password": "<PASSWORD>",
        "confirm_password": "<PASSWORD>"
    });
    casper.click('input[name="change_settings"]');
});

casper.waitUntilVisible('#settings-status', function () {
    casper.test.assertSelectorHasText('#settings-status', 'Updated settings!');

    casper.test.assertNotVisible('');
    casper.click('#api_key_button');
});

casper.waitUntilVisible('#get_api_key_password', function () {
    casper.fill('form[action^="/json/fetch_api_key"]', {'password':'<PASSWORD>'});
    casper.click('input[name="view_api_key"]');
});

casper.waitUntilVisible('#api_key_value', function () {
    casper.test.assertMatch(casper.fetchText('#api_key_value'), /[a-zA-Z0-9]{32}/, "Looks like an API key");

    // Change it all back so the next test can still log in
    casper.fill(form_sel, {
        "full_name": "Iago",
        "old_password": "<PASSWORD>",
        "new_password": "<PASSWORD>",
        "confirm_password": "<PASSWORD>"
    });
    casper.click('input[name="change_settings"]');
});

casper.waitUntilVisible('#settings-status', function () {
    casper.test.assertSelectorHasText('#settings-status', 'Updated settings!');
});

// TODO: test the "Declare Zulip Bankruptcy option"

common.then_log_out();

casper.run(function () {
    casper.test.done();
});

{'fraction_non_alphanumeric': 0.19023968905204058, 'fraction_numerical': 0.0017274886633556468, 'mean_word_length': 4.676470588235294, 'pattern_counts': {'":': 16, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5925739', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1478, 'n_words': 211}