Skip to content

Commit

Permalink
new attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
Amir Ziaei committed Mar 27, 2024
1 parent 7c31e38 commit 388d0ca
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ jobs:
AUTH_TOKEN: ${{ secrets.AUTH_TOKEN }}
IG_USERNAME: ${{ secrets.IG_USERNAME }}
IG_PASSWORD: ${{ secrets.IG_PASSWORD }}
IG_THREAD_ID: ${{ secrets.IG_THREAD_ID }}

- name: 📊 Upload report
uses: actions/upload-artifact@v3
Expand Down
17 changes: 10 additions & 7 deletions tests/e2e/instagram-auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,27 @@ import { test as setup, expect } from '@playwright/test'

const authFile = 'mnt/auth.json'

const noop = () => {}

setup('authenticate instagram', async ({ page }) => {
await page.goto('https://www.instagram.com/')
await page
.getByRole('button', { name: 'Decline optional cookies' })
.click()
.catch(noop)
.catch(() => {})
await page
.getByLabel('Phone number, username, or')
.fill(process.env.IG_USERNAME)
await page.getByLabel('Password').fill(process.env.IG_PASSWORD)
await page.getByRole('button', { name: 'Log in', exact: true }).click()
await page.getByRole('button', { name: 'Save info' }).click()
await expect(page.getByText('Turn on Notifications'))
.toBeVisible()
.catch(noop)
await page.getByRole('button', { name: 'Not Now' }).click().catch(noop)
try {
await expect(page.getByText('Turn on Notifications')).toBeVisible({
timeout: 10_000,
})
await page.getByRole('button', { name: 'Not Now' }).click()
console.log('sendDirectToThread: Turned off notifications')
} catch {
/** no need to handle */
}
await expect(page.getByRole('link', { name: 'Home Home' })).toBeVisible()
await page.context().storageState({ path: authFile })
})

0 comments on commit 388d0ca

Please sign in to comment.