-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(functional): Convert Robots test, oauth webchannel
Because: * We're converting tests from intern to playwright This commit: * Converts oauth_webchannel.js, robots.txt tests * Does not port over ios v1 sign up since we don't need to support it any longer Closes FXA-5923
- Loading branch information
Showing
9 changed files
with
180 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
export enum FirefoxCommand { | ||
FxAStatus = 'fxaccounts:fxa_status', | ||
OAuthLogin = 'fxaccounts:oauth_login', | ||
Logout = 'fxaccounts:logout', | ||
} | ||
|
||
export function createCustomEventDetail( | ||
command: FirefoxCommand, | ||
data: Record<string, any> | ||
) { | ||
return { | ||
id: 'account_updates', | ||
message: { | ||
command, | ||
data, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
import { FirefoxCommand, createCustomEventDetail } from '../../lib/channels'; | ||
import { test, expect } from '../../lib/fixtures/standard'; | ||
|
||
const PASSWORD = 'Password123!'; | ||
|
||
test.describe('oauth webchannel', () => { | ||
test.beforeEach(async ({ pages: { login } }) => { | ||
await login.clearCache(); | ||
}); | ||
|
||
test('signup', async ({ pages: { login, relier } }) => { | ||
const customEventDetail = createCustomEventDetail( | ||
FirefoxCommand.FxAStatus, | ||
{ | ||
capabilities: { | ||
choose_what_to_sync: true, | ||
engines: ['bookmarks', 'history'], | ||
}, | ||
signedInUser: null, | ||
} | ||
); | ||
const email = login.createEmail(); | ||
|
||
await relier.goto('context=oauth_webchannel_v1&automatedBrowser=true'); | ||
await relier.clickEmailFirst(); | ||
|
||
await login.respondToWebChannelMessage(customEventDetail); | ||
|
||
await login.setEmail(email); | ||
await login.submit(); | ||
|
||
// the CWTS form is on the same signup page | ||
await login.waitForCWTSHeader(); | ||
await login.waitForCWTSEngineBookmarks(); | ||
await login.waitForCWTSEngineHistory(); | ||
|
||
await login.fillOutFirstSignUp(email, PASSWORD, true, false); | ||
await login.checkWebChannelMessage(FirefoxCommand.OAuthLogin); | ||
}); | ||
|
||
test('signin', async ({ pages: { login, relier, page }, credentials }) => { | ||
const customEventDetail = createCustomEventDetail( | ||
FirefoxCommand.FxAStatus, | ||
{ | ||
capabilities: { | ||
engines: ['bookmarks', 'history'], | ||
}, | ||
signedInUser: null, | ||
} | ||
); | ||
|
||
await relier.goto('context=oauth_webchannel_v1&automatedBrowser=true'); | ||
await relier.clickEmailFirst(); | ||
|
||
await login.respondToWebChannelMessage(customEventDetail); | ||
|
||
const { searchParams } = new URL(page.url()); | ||
expect(searchParams.has('client_id')).toBe(true); | ||
expect(searchParams.has('redirect_uri')).toBe(true); | ||
expect(searchParams.has('state')).toBe(true); | ||
expect(searchParams.has('context')).toBe(true); | ||
|
||
await login.login(credentials.email, credentials.password); | ||
|
||
await login.checkWebChannelMessage('fxaccounts:oauth_login'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
135 changes: 0 additions & 135 deletions
135
packages/fxa-content-server/tests/functional/oauth_webchannel.js
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
packages/fxa-content-server/tests/functional/robots_txt.js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters