Skip to content

Commit

Permalink
2nd hack
Browse files Browse the repository at this point in the history
  • Loading branch information
manolo committed Jan 30, 2025
1 parent ab481d8 commit 94dcac3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
23 changes: 18 additions & 5 deletions scripts/pit/its/cc-identity-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const {log, err, args, createPage, closePage, takeScreenshot, waitForServerReady

log(`Checking that ${app} installed in ${url} is running ...\n`);

log(`Enabling identity Management ...\n`);
await page.locator('vaadin-select vaadin-input-container div').click();
await page.getByRole('option', { name: app }).locator('div').nth(2).click();
await takeScreenshot(page, __filename, 'selected-app');
Expand All @@ -45,15 +44,29 @@ const {log, err, args, createPage, closePage, takeScreenshot, waitForServerReady
await takeScreenshot(pageApp, __filename, '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 {
await page.waitForTimeout(2000);
await page.getByRole('button', { name: 'Enable 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('button', { name: 'Enable Identity Management' }).click();
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');

Expand Down
4 changes: 2 additions & 2 deletions scripts/pit/its/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function warn(...args) {
process.stderr.write(`\x1b[2m\x1b[91m${args}\x1b[0m`);
}
function err(...args) {
process.stderr.write(`\x1b[0;31m${args}\x1b[0m`);
process.stderr.write(`\x1b[0;31m${args}\x1b[0m`.split('\n')[0] + '\n');
}

const run = async (cmd) => (await promisify(exec)(cmd)).stdout;
Expand Down Expand Up @@ -87,7 +87,7 @@ async function takeScreenshot(page, name, descr) {
const scr = path.basename(name);
const cnt = String(++sscount).padStart(2, "0");
const file = `${screenshots}/${scr}-${cnt}-${descr}.png`;
await page.waitForTimeout(/^win/.test(process.platform) ? 10000: 1500);
await page.waitForTimeout(/^win/.test(process.platform) ? 10000 : process.env.GITHUB_ACTIONS ? 5000 : 1500);
await page.screenshot({ path: file });
out(` 📸 Screenshot taken: ${file}\n`);
}
Expand Down

0 comments on commit 94dcac3

Please sign in to comment.