Skip to content

Commit

Permalink
fix(test): Use newPagesForSync in flaky tests and disable coppa
Browse files Browse the repository at this point in the history
  • Loading branch information
vbudhram authored and julianpoy committed Mar 8, 2023
1 parent 3ef0ac8 commit abcab2f
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 86 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ jobs:
default: large
parallelism:
type: integer
default: 5
default: 6
executor: functional-test-executor
resource_class: << parameters.resource_class >>
parallelism: << parameters.parallelism >>
Expand Down
2 changes: 1 addition & 1 deletion packages/functional-tests/scripts/test-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ DIR=$(dirname "$0")

cd "$DIR/../../../"

circleci tests glob "packages/functional-tests/tests/**/*.spec.ts" | circleci tests split > tests-to-run.txt
circleci tests glob "packages/functional-tests/tests/**/*.spec.ts" | circleci tests split --split-by=timings > tests-to-run.txt
yarn workspace functional-tests test $(cat tests-to-run.txt|awk -F"/" '{ print $NF }')
7 changes: 4 additions & 3 deletions packages/functional-tests/tests/oauth/signin.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { test, expect } from '../../lib/fixtures/standard';

let email = '';
const PASSWORD = 'passwordzxcv';

test.describe('OAuth signin', () => {
Expand Down Expand Up @@ -70,7 +71,7 @@ test.describe('OAuth signin', () => {
pages: { login, relier },
}) => {
// Create unverified account via backend
const email = login.createEmail();
email = login.createEmail();
await target.auth.signUp(email, PASSWORD, {
lang: 'en',
preVerified: 'false',
Expand All @@ -90,7 +91,7 @@ test.describe('OAuth signin', () => {
pages: { login, relier },
}) => {
// Create unverified account
const email = login.createEmail();
email = login.createEmail();
const password = 'passwordzxcv';

await relier.goto();
Expand Down Expand Up @@ -122,7 +123,7 @@ test.describe('OAuth signin', () => {
test.slow(project.name !== 'local', 'email delivery can be slow');

// Create unverified account
const email = login.createEmail();
email = login.createEmail();

await relier.goto();
await relier.clickChooseFlow();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { test, expect } from '../../lib/fixtures/standard';
import { EmailHeader, EmailType } from '../../lib/email';

const PASSWORD = 'passwordzxcv';
let email;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,15 @@ test.describe('ui functionality', () => {
test.slow();
});

test('verify discount textbox display', async ({
test('verify coupon feature not available when changing plans', async ({
page,
pages: { relier, subscribe },
}) => {
await relier.goto();
await relier.clickSubscribe6Month();

// Verify discount section is displayed
expect(await subscribe.discountTextbox()).toBe(true);
});

test('verify coupon feature not available when changing plans', async ({
page,
pages: { relier, subscribe },
}) => {
await relier.goto();
await relier.clickSubscribe6Month();

// 'auto10pforever' is a 10% forever discount coupon for a 6mo plan
await subscribe.addCouponCode('auto10pforever');
Expand Down
40 changes: 26 additions & 14 deletions packages/functional-tests/tests/syncV3/fxDesktopV3ForceAuth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,28 @@
* 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 { test, expect } from '../../lib/fixtures/standard';
import { test, expect, newPagesForSync } from '../../lib/fixtures/standard';

const makeUid = () =>
[...Array(32)]
.map(() => Math.floor(Math.random() * 16).toString(16))
.join('');

test.describe('Desktop Sync V3 force auth', () => {
test.beforeEach(async ({}) => {
test.slow();
});

test('sync v3 with a registered email, no uid', async ({
credentials,
pages: {
target,
}) => {
const {
fxDesktopV3ForceAuth,
login,
signinTokenCode,
connectAnotherDevice,
},
}) => {
} = await newPagesForSync(target);
await fxDesktopV3ForceAuth.openWithReplacementParams(credentials, {
uid: undefined,
});
Expand All @@ -35,13 +40,14 @@ test.describe('Desktop Sync V3 force auth', () => {

test('sync v3 with a registered email, registered uid', async ({
credentials,
pages: {
target,
}) => {
const {
fxDesktopV3ForceAuth,
login,
signinTokenCode,
connectAnotherDevice,
},
}) => {
} = await newPagesForSync(target);
await fxDesktopV3ForceAuth.open(credentials);
await login.setPassword(credentials.password);
await login.submit();
Expand All @@ -56,13 +62,14 @@ test.describe('Desktop Sync V3 force auth', () => {

test('sync v3 with a registered email, unregistered uid', async ({
credentials,
pages: {
target,
}) => {
const {
fxDesktopV3ForceAuth,
login,
signinTokenCode,
connectAnotherDevice,
},
}) => {
} = await newPagesForSync(target);
const uid = makeUid();
await fxDesktopV3ForceAuth.openWithReplacementParams(credentials, { uid });
await fxDesktopV3ForceAuth.noSuchWebChannelMessage('fxaccounts:logout');
Expand All @@ -79,8 +86,9 @@ test.describe('Desktop Sync V3 force auth', () => {

test('sync v3 with an unregistered email, no uid', async ({
credentials,
pages: { fxDesktopV3ForceAuth, login },
target,
}) => {
const { fxDesktopV3ForceAuth, login } = await newPagesForSync(target);
const email = `sync${Math.random()}@restmail.net`;
await fxDesktopV3ForceAuth.openWithReplacementParams(credentials, {
email,
Expand All @@ -104,8 +112,9 @@ test.describe('Desktop Sync V3 force auth', () => {

test('sync v3 with an unregistered email, registered uid', async ({
credentials,
pages: { fxDesktopV3ForceAuth, login },
target,
}) => {
const { fxDesktopV3ForceAuth, login } = await newPagesForSync(target);
const email = `sync${Math.random()}@restmail.net`;
await fxDesktopV3ForceAuth.openWithReplacementParams(credentials, {
email,
Expand All @@ -123,8 +132,9 @@ test.describe('Desktop Sync V3 force auth', () => {

test('sync v3 with an unregistered email, unregistered uid', async ({
credentials,
pages: { fxDesktopV3ForceAuth, login },
target,
}) => {
const { fxDesktopV3ForceAuth, login } = await newPagesForSync(target);
const email = `sync${Math.random()}@restmail.net`;
const uid = makeUid();
await fxDesktopV3ForceAuth.openWithReplacementParams(credentials, {
Expand All @@ -144,8 +154,10 @@ test.describe('Desktop Sync V3 force auth', () => {

test('blocked with an registered email, unregistered uid', async ({
credentials,
pages: { fxDesktopV3ForceAuth, login, connectAnotherDevice },
target,
}) => {
const { fxDesktopV3ForceAuth, login, connectAnotherDevice } =
await newPagesForSync(target);
const uid = makeUid();
await fxDesktopV3ForceAuth.openWithReplacementParams(credentials, {
uid,
Expand Down
2 changes: 1 addition & 1 deletion packages/functional-tests/tests/syncV3/signIn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const password = 'passwordzxcv';
let email;

test.describe('Firefox Desktop Sync v3 sign in', () => {
test.beforeEach(async ({ page, pages: { login } }) => {
test.beforeEach(async ({ pages: { login } }) => {
test.slow();
email = login.createEmail('sync{id}');
});
Expand Down
46 changes: 14 additions & 32 deletions packages/functional-tests/tests/syncV3/signUp.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* 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 { test, expect } from '../../lib/fixtures/standard';
import { test, expect, newPagesForSync } from '../../lib/fixtures/standard';

const password = 'passwordzxcv';
const incorrectPassword = 'password123';
Expand All @@ -12,14 +12,11 @@ test.describe('Firefox Desktop Sync v3 sign up', () => {
test.beforeEach(async ({ pages: { login } }) => {
test.slow();
email = login.createEmail('sync{id}');
await login.clearCache();
});

test('sign up', async ({
target,
page,
pages: { login, signinTokenCode, connectAnotherDevice },
}) => {
test('sign up', async ({ target }) => {
const { login, signinTokenCode, page, connectAnotherDevice } =
await newPagesForSync(target);
await page.goto(
`${target.contentServerUrl}?context=fx_desktop_v3&service=sync&action=email`,
{ waitUntil: 'networkidle' }
Expand All @@ -46,11 +43,8 @@ test.describe('Firefox Desktop Sync v3 sign up', () => {
expect(await connectAnotherDevice.fxaConnected.isVisible()).toBeTruthy();
});

test('coppa disabled', async ({
target,
page,
pages: { login, connectAnotherDevice },
}) => {
test.skip('coppa disabled', async ({ target }) => {
const { login, page, connectAnotherDevice } = await newPagesForSync(target);
const query = { coppa: 'false' };
const queryParam = new URLSearchParams(query);
await page.goto(
Expand All @@ -70,11 +64,8 @@ test.describe('Firefox Desktop Sync v3 sign up', () => {
expect(await connectAnotherDevice.fxaConnected.isVisible()).toBeTruthy();
});

test('email specified by relier, invalid', async ({
target,
page,
pages: { login },
}) => {
test('email specified by relier, invalid', async ({ target }) => {
const { page, login } = await newPagesForSync(target);
const invalidEmail = 'invalid@@';
const query = { email: invalidEmail };
const queryParam = new URLSearchParams(query);
Expand All @@ -86,11 +77,8 @@ test.describe('Firefox Desktop Sync v3 sign up', () => {
expect(await login.getTooltipError()).toMatch('Valid email required');
});

test('email specified by relier, empty string', async ({
target,
page,
pages: { login },
}) => {
test('email specified by relier, empty string', async ({ target }) => {
const { page, login } = await newPagesForSync(target);
const emptyEmail = '';
const query = { email: emptyEmail };
const queryParam = new URLSearchParams(query);
Expand All @@ -102,11 +90,8 @@ test.describe('Firefox Desktop Sync v3 sign up', () => {
expect(await login.getTooltipError()).toMatch('Valid email required');
});

test('email specified by relier, not registered', async ({
target,
page,
pages: { login },
}) => {
test('email specified by relier, not registered', async ({ target }) => {
const { page, login } = await newPagesForSync(target);
const query = { email };
const queryParam = new URLSearchParams(query);
await page.goto(
Expand All @@ -122,11 +107,8 @@ test.describe('Firefox Desktop Sync v3 sign up', () => {
expect(await login.getPrefilledEmail()).toMatch(email);
});

test('email specified by relier, registered', async ({
target,
page,
pages: { login },
}) => {
test('email specified by relier, registered', async ({ target }) => {
const { page, login } = await newPagesForSync(target);
await target.auth.signUp(email, password, {
lang: 'en',
preVerified: 'true',
Expand Down
18 changes: 6 additions & 12 deletions packages/functional-tests/tests/syncV3/syncV3EmailFirst.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,21 @@
* 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 { test, expect } from '../../lib/fixtures/standard';
import { test, expect, newPagesForSync } from '../../lib/fixtures/standard';

const PASSWORD = 'passwordzxcv';
let email;

test.describe('Firefox Desktop Sync v3 email first', () => {
test.beforeEach(async ({ target, credentials, pages: { login } }) => {
test.beforeEach(async ({ pages: { login } }) => {
test.slow();
email = login.createEmail('sync{id}');
await login.clearCache();
});

test('open directly to /signup page, refresh on the /signup page', async ({
target,
page,
pages: { login },
}) => {
const { page, login } = await newPagesForSync(target);
await page.goto(
`${target.contentServerUrl}/signup?context=fx_desktop_v3&service=sync&action=email`,
{ waitUntil: 'networkidle' }
Expand All @@ -39,9 +37,8 @@ test.describe('Firefox Desktop Sync v3 email first', () => {

test('open directly to /signin page, refresh on the /signin page', async ({
target,
page,
pages: { login },
}) => {
const { page, login } = await newPagesForSync(target);
await target.auth.signUp(email, PASSWORD, {
lang: 'en',
preVerified: 'true',
Expand All @@ -64,11 +61,8 @@ test.describe('Firefox Desktop Sync v3 email first', () => {
expect(await login.isEmailHeader()).toBe(true);
});

test('enter a firefox.com address', async ({
target,
page,
pages: { login, signinTokenCode },
}) => {
test('enter a firefox.com address', async ({ target }) => {
const { page, login, signinTokenCode } = await newPagesForSync(target);
await page.goto(
`${target.contentServerUrl}?context=fx_desktop_v3&service=sync&action=email`,
{ waitUntil: 'networkidle' }
Expand Down
Loading

0 comments on commit abcab2f

Please sign in to comment.