Skip to content

Commit

Permalink
added test for oauth button
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre-lehnen-rc committed Jan 2, 2024
1 parent a79bd62 commit 636f9da
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/meteor/tests/e2e/fixtures/inject-initial-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ export default async function injectInitialData() {
_id: 'SAML_Custom_Default_idp_slo_redirect_url',
value: 'http://localhost:8080/simplesaml/saml2/idp/SingleLogoutService.php',
},
{
_id: 'Accounts_OAuth_Google',
value: false,
},
].map((setting) =>
connection
.db()
Expand Down
26 changes: 26 additions & 0 deletions apps/meteor/tests/e2e/oauth.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { Registration } from './page-objects';
import { setSettingValueById } from './utils/setSettingValueById';
import { test, expect } from './utils/test';

test.describe('OAuth', () => {
let poRegistration: Registration;

test.beforeEach(async ({ page }) => {
poRegistration = new Registration(page);

await page.goto('/home');
});

test('Login Page', async ({ api }) => {
await test.step('expect OAuth button to be visible', async () => {
await expect((await setSettingValueById(api, 'Accounts_OAuth_Google', true)).status()).toBe(200);
await expect(poRegistration.btnLoginWithGoogle).toBeVisible({ timeout: 10000 });
});

// await test.step('expect OAuth button to not be visible', async () => {
// await expect((await setSettingValueById(api, 'Accounts_OAuth_Google', false)).status()).toBe(200);

// await expect(poRegistration.btnLoginWithGoogle).not.toBeVisible();
// });
});
});
4 changes: 4 additions & 0 deletions apps/meteor/tests/e2e/page-objects/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export class Registration {
return this.page.locator('role=button[name="SAML"]');
}

get btnLoginWithGoogle(): Locator {
return this.page.locator('role=button[name="Sign in with Google"]');
}

get goToRegister(): Locator {
return this.page.locator('role=link[name="Create an account"]');
}
Expand Down

0 comments on commit 636f9da

Please sign in to comment.