puppeteer_tests: Extract a common function to fill forms.

Co-authored-by: Priyank Patel <priyankp390@gmail.com>
This commit is contained in:
Dinesh
2020-05-30 00:16:35 +05:30
committed by Tim Abbott
parent d9cc081b2d
commit c8268865dc
2 changed files with 48 additions and 10 deletions

View File

@@ -44,16 +44,17 @@ async function realm_creation_tests(page) {
assert(text_in_pitch === "We just need you to do one last thing.");
// fill the form.
await page.type('#id_team_name', organization_name);
await page.type('#id_full_name', 'Alice');
// For some reason, page.click() does not work this perticular checkbox
const params = {
realm_name: organization_name,
realm_subdomain: subdomain,
full_name: 'Alice',
password: 'passwordwhichisnotreallycomplex',
terms: true,
};
// For some reason, page.click() does not work this for particular checkbox
// so use page.$eval here to call the .click method in the browser.
await page.$eval('#realm_in_root_domain', el => el.click());
await page.type('#id_team_subdomain', subdomain);
await page.type('#id_password', 'passwordwhichisnotreallycomplex');
await page.click('#id_terms');
await common.fill_form(page, '#registration', params);
await page.$eval('#registration', form => form.submit());
// Check if realm is created and user is logged in by checking if