Skip to content

Commit

Permalink
Remove hacks
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Jan 30, 2025
1 parent 94dcac3 commit 6ab8377
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 26 deletions.
40 changes: 20 additions & 20 deletions scripts/pit/its/cc-identity-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,33 +41,33 @@ const {log, err, args, createPage, closePage, takeScreenshot, waitForServerReady
// When app is not running, localization button might not be enabled
let pageApp = await createPage(arg.headless, arg.ignoreHTTPSErrors);
await waitForServerReady(pageApp, url);
await takeScreenshot(pageApp, __filename, 'app-running');
await takeScreenshot(pageApp, __filename, `app-${app}-running`);
await closePage(pageApp);
// Button is enabled after app is running, let's see
log(`Enabling identity Management ...\n`);
await page.getByRole('link', { name: 'Identity Management' }).click();
await takeScreenshot(page, __filename, 'identity-link-clicked');
try {
// try {
await page.waitForTimeout(2000);
await page.getByRole('button', { name: 'Enable Identity Management' }).click();
} catch (error) {
try {
await page.getByRole('link', { name: 'Settings' }).click();
await page.waitForTimeout(2000);
await page.locator('vaadin-grid').getByText('bakery-cc', { exact: true }).click();
await page.getByLabel('Identity Management').check();
await page.getByRole('button', { name: 'Update' }).click();
await page.locator('vaadin-select vaadin-input-container div').click();
await page.getByRole('option', { name: app }).locator('div').nth(2).click();
await page.getByRole('link', { name: 'Identity Management' }).click();
} catch (error) {
err(`Retrying in 60 secs looking for enabled button : ${error}\n`);
await page.waitForTimeout(60000);
await page.reload();
await page.getByRole('link', { name: 'Identity Management' }).click();
await page.getByRole('button', { name: 'Enable Identity Management' }).click();
}
}
// } catch (error) {
// try {
// await page.getByRole('link', { name: 'Settings' }).click();
// await page.waitForTimeout(2000);
// await page.locator('vaadin-grid').getByText('bakery-cc', { exact: true }).click();
// await page.getByLabel('Identity Management').check();
// await page.getByRole('button', { name: 'Update' }).click();
// await page.locator('vaadin-select vaadin-input-container div').click();
// await page.getByRole('option', { name: app }).locator('div').nth(2).click();
// await page.getByRole('link', { name: 'Identity Management' }).click();
// } catch (error) {
// err(`Retrying in 60 secs looking for enabled button : ${error}\n`);
// await page.waitForTimeout(60000);
// await page.reload();
// await page.getByRole('link', { name: 'Identity Management' }).click();
// await page.getByRole('button', { name: 'Enable Identity Management' }).click();
// }
// }
await takeScreenshot(page, __filename, 'identity-enabled');

log(`Adding Role, Group and User ...\n`);
Expand Down
7 changes: 1 addition & 6 deletions scripts/pit/its/cc-install-apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ async function installApp(app, page) {
const cert = [ domain, uri ].map(a => `${a}.pem`).filter( a => fs.existsSync(a))[0]
console.log(`Installing App: ${app} URI: ${uri} Cert: ${cert}`);

await takeScreenshot(page, __filename, `page-loaded-${app}`);

await page.getByRole('listitem').filter({ hasText: 'Settings'}).click()
await page.getByRole('button', {name: 'Deploy'}).click()
await takeScreenshot(page, __filename, `form-opened-${app}`);
Expand All @@ -40,11 +38,8 @@ async function installApp(app, page) {
await page.locator('.detail-layout').getByRole('button', {name: 'Deploy'}).click();
}

await takeScreenshot(page, __filename, `form-clicked-${app}`);

await page.getByRole('listitem').filter({ hasText: 'Settings'}).click()

await takeScreenshot(page, __filename, `application-created-${app}`);
await takeScreenshot(page, __filename, `form-saved-${app}`);

await expect(page.locator('vaadin-grid').getByText(app, { exact: true })).toBeVisible();
await expect(await page.getByRole('listitem').filter({ hasText: 'Applications'})
Expand Down
1 change: 1 addition & 0 deletions scripts/pit/its/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function warn(...args) {
}
function err(...args) {
process.stderr.write(`\x1b[0;31m${args}\x1b[0m`.split('\n')[0] + '\n');
out(args);
}

const run = async (cmd) => (await promisify(exec)(cmd)).stdout;
Expand Down

0 comments on commit 6ab8377

Please sign in to comment.