-
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 * Tweaks fillOutFirstSignUp to give it an options argument Closes FXA-5923
- Loading branch information
Showing
16 changed files
with
229 additions
and
188 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
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,73 @@ | ||
/* 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, { | ||
enterEmail: false, | ||
waitForNavOnSubmit: 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, '', false); | ||
await login.checkWebChannelMessage('fxaccounts:oauth_login'); | ||
}); | ||
}); |
Oops, something went wrong.