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 15d6ed5
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
20 changes: 16 additions & 4 deletions scripts/pit/its/cc-identity-management.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,24 @@ const {log, err, args, createPage, closePage, takeScreenshot, waitForServerReady
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();
} 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 15d6ed5

Please sign in to comment.