diff --git a/src/auth.test.ts b/src/auth.test.ts index 3bee91fe..437de6a6 100644 --- a/src/auth.test.ts +++ b/src/auth.test.ts @@ -1,9 +1,15 @@ import { getScraper } from './test-utils'; -test('scraper can log in', async () => { - const scraper = await getScraper({ authMethod: 'password' }); - await expect(scraper.isLoggedIn()).resolves.toBeTruthy(); -}, 15000); +const testLogin = process.env['TWITTER_PASSWORD'] ? test : test.skip; + +testLogin( + 'scraper can log in', + async () => { + const scraper = await getScraper({ authMethod: 'password' }); + await expect(scraper.isLoggedIn()).resolves.toBeTruthy(); + }, + 15000, +); test('scraper can log in with cookies', async () => { const scraper = await getScraper(); @@ -22,11 +28,15 @@ test('scraper can restore its login state from cookies', async () => { await expect(scraper2.isLoggedIn()).resolves.toBeTruthy(); }); -test('scraper can log out', async () => { - const scraper = await getScraper({ authMethod: 'password' }); - await expect(scraper.isLoggedIn()).resolves.toBeTruthy(); +testLogin( + 'scraper can log out', + async () => { + const scraper = await getScraper({ authMethod: 'password' }); + await expect(scraper.isLoggedIn()).resolves.toBeTruthy(); - await scraper.logout(); + await scraper.logout(); - await expect(scraper.isLoggedIn()).resolves.toBeFalsy(); -}, 15000); + await expect(scraper.isLoggedIn()).resolves.toBeFalsy(); + }, + 15000, +);