Skip to content

Commit

Permalink
refactor(playwrighttesting): informational and error message changes (A…
Browse files Browse the repository at this point in the history
…zure#31015)

### Packages impacted by this PR

@azure/microsoft-playwright-testing
@azure/create-microsoft-playwright-testing

### Issues associated with this PR


### Describe the problem that is addressed by this PR

Change in error messages in scalable + reporting. Also change in
information message during package initialization.

### What are the possible designs available to address the problem? If
there are more than one possible design, why was the one in this PR
chosen?


### Are there test cases added in this PR? _(If not, why?)_


### Provide a list of related PRs _(if any)_


### Command used to generate this PR:**_(Applicable only to SDK release
request PRs)_

### Checklists
- [ ] Added impacted package name to the issue description
- [ ] Does this PR needs any fixes in the SDK Generator?** _(If so,
create an Issue in the
[Autorest/typescript](https://github.com/Azure/autorest.typescript)
repository and link it here)_
- [ ] Added a changelog (if necessary)
  • Loading branch information
Sid200026 authored Sep 7, 2024
1 parent 97d5fc5 commit 985f752
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export class PlaywrightServiceInitialize {
};

private promptOnCancel = (): never => {
// eslint-disable-next-line n/no-process-exit
process.exit(0);
};

Expand All @@ -71,6 +72,13 @@ export class PlaywrightServiceInitialize {

console.log("\nPlaywright Service Portal - https://playwright.microsoft.com/");
console.log("Getting Started - https://aka.ms/mpt/quickstart\n");

console.log(
"If you're already using the Microsoft Playwright Testing service, please review the quickstart guide [https://aka.ms/mpt/quickstart] to ensure your tests continue running smoothly.",
);
console.log(
"We've introduced changes related to authentication. You'll need to update the new config file to align with these changes.",
);
};

private installServicePackage = async (): Promise<void> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ describe("PlaywrightServiceInitialize", () => {
const consoleLogStub = sandbox.stub(console, "log");
playwrightServiceInitialize["displayAdditionalInformation"]();

expect(consoleLogStub.callCount).to.equal(4);
expect(consoleLogStub.callCount).to.equal(6);
expect(consoleLogStub.getCall(1).args[0]).to.equal(`\t${npmRunCommandParallelWorkers}\n`);
});

Expand All @@ -158,7 +158,7 @@ describe("PlaywrightServiceInitialize", () => {
const consoleLogStub = sandbox.stub(console, "log");
playwrightServiceInitialize["displayAdditionalInformation"]();

expect(consoleLogStub.callCount).to.equal(4);
expect(consoleLogStub.callCount).to.equal(6);
expect(consoleLogStub.getCall(1).args[0]).to.equal(`\t${npmRunCommandParallelWorkers}\n`);
});

Expand All @@ -174,7 +174,7 @@ describe("PlaywrightServiceInitialize", () => {
const consoleLogStub = sandbox.stub(console, "log");
playwrightServiceInitialize["displayAdditionalInformation"]();

expect(consoleLogStub.callCount).to.equal(4);
expect(consoleLogStub.callCount).to.equal(6);
expect(consoleLogStub.getCall(1).args[0]).to.equal(`\t${npmRunCommandParallelWorkers}\n`);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export class Constants {
];
// Error messages
public static readonly CONFLICT_409_ERROR_MESSAGE =
"Test run with id {runId} already exists. Please provide a unique run id.";
"Test run with id {runId} already exists. Provide a unique run id.";
public static readonly FORBIDDEN_403_ERROR_MESSAGE =
"Reporting is not enabled for your workspace {workspaceId}. Please enable the Reporting feature under Feature management settings using the Playwright portal: https://playwright.microsoft.com/workspaces/{workspaceId}/settings/general";
"Reporting is not enabled for your workspace {workspaceId}. Enable the Reporting feature under Feature management settings using the Playwright portal: https://playwright.microsoft.com/workspaces/{workspaceId}/settings/general";
// API Endpoints
public static readonly testRunsEndpoint: string = "workspaces/{workspaceId}/test-runs";
public static readonly testRunsShardEndpoint: string =
Expand Down Expand Up @@ -204,7 +204,7 @@ export const TestResultErrorConstants = [
{
key: "QuotaLimitError_Scalable",
message:
"It is possible that the maximum number of concurrent sessions allowed for your workspace has been exceeded.",
"It is possible that the maximum number of concurrent sessions allowed for your workspace has been exceeded. Check the quota at https://aka.ms/mpt/resource-quota.",
pattern: /browserType.connect: Timeout .* exceeded/i,
type: TestErrorType.Scalable,
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@ export const ServiceErrorMessageConstants = {
NO_SERVICE_URL_ERROR:
"The value for the PLAYWRIGHT_SERVICE_URL variable is not set correctly. Please verify the URL and try again.",
INVALID_MPT_PAT_ERROR:
"The authentication token provided is invalid. Please check the token and try again.",
EXPIRED_MPT_PAT_ERROR: "Your authentication token has expired. Please create a new token.",
"The authentication token provided is invalid. Check the token and try again.",
EXPIRED_MPT_PAT_ERROR: "Your authentication token has expired. Create a new token.",
INVALID_GLOBAL_FUNCTION: "file must export a single function",
DUPLICATE_REPORTER:
"Another reporter with the same name already exists. Please resolve the duplicate and try again.",
INVALID_PLAYWRIGHT_VERSION_ERROR:
"The Playwright version you are using is not supported. Please upgrade to Playwright 1.47 or above.",
"The Playwright version you are using is not supported. See the list of supported versions at https://aka.ms/mpt/supported-versions.",
};

0 comments on commit 985f752

Please sign in to comment.