Skip to content

Instantly share code, notes, and snippets.

@jakswa
Last active April 7, 2025 18:56
Show Gist options
  • Save jakswa/ed367e1105ac7b2a62c400c55af56391 to your computer and use it in GitHub Desktop.
Save jakswa/ed367e1105ac7b2a62c400c55af56391 to your computer and use it in GitHub Desktop.
This is my weekly 15five script.

This is my weekly 15five script.

  1. They added SSO so you need to fire up your browser with debugging so that this can drive things:

(might vary by OS, figure your command out, i'm on linux)

google-chrome-stable --remote-debugging-port=9222
  1. log into 15five

  2. run it: npx <this browser URL> early version example:

Found form. Let's get you sorted!
happiness=4
marked complete
goal for next week: code
Submitting...
done. great job!
#!/usr/bin/env node
const { chromium } = require('playwright');
const util = require('util');
const setTimeoutPromise = util.promisify(setTimeout);
(async () => {
const browser = await chromium.connectOverCDP('http://localhost:9222');
const ctx = browser.contexts()[0];
const pages = await ctx.pages();
const page = pages[0];
await page.goto('https://my.15five.com/report/archive/');
// wait for page to be ready
await page.waitForSelector('text=Fill out', { timeout: 3000 });
console.log("I see a check-in to fill out!");
await page.click('text=Fill out');
await page.waitForLoadState();
if (await page.$('#fillout-report-form')) {
console.log("Found form. Let's get you sorted!");
await fillOut15Five(page);
} else {
console.log("No form. You already submitted, I think. Bye.");
}
await setTimeoutPromise(1000);
await browser.close();
})();
async function fillOut15Five(page) {
await page.click('label[for="pulse-input-4"]');
console.log("happiness=4");
let complete = 'button[aria-label="Mark Complete"]';
if (await page.$(complete)) {
await page.click(complete);
console.log("marked complete");
}
let goal = '.is-new-answer[placeholder="Add a new priority"]';
const input = await page.locator(goal).nth(-1);
if (input) {
await input.fill('code');
await page.click('body');
console.log("goal for next week: code");
}
console.log("Submitting...");
await setTimeoutPromise(3000);
await page.click('.js-submit-report >> text=ubmit');
// if early, there'll be 2nd
let submit2 = 'text=Submit now';
await page.waitForSelector(submit2, { timeout: 1000 }).then(() => {
console.log("...Now tho. Submit now.");
return page.click(submit2);
}).catch(() => console.log("You're on time! Good job!"));
await page.waitForNavigation();
console.log("done. great job!");
}
{
"name": "auto15five",
"version": "0.0.1",
"bin": "./index.js",
"dependencies": {
"playwright": "^1.51.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment