From dc54f72ff4a794d9d1612526bea73f589cb8e600 Mon Sep 17 00:00:00 2001 From: AnatolyPristensky Date: Thu, 22 Dec 2022 13:52:13 +0100 Subject: [PATCH 1/4] Fix autogenerating XamarinUITestProject --- .../AppCenter.UITest.Android.csproj | 29 +++++-------------- .../AppCenter.UITest.Android/packages.config | 5 ---- .../AppCenter.UITest.iOS.csproj | 29 +++++-------------- .../ios/AppCenter.UITest.iOS/packages.config | 5 ---- 4 files changed, 14 insertions(+), 54 deletions(-) delete mode 100644 src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/packages.config delete mode 100644 src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/packages.config diff --git a/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/AppCenter.UITest.Android.csproj b/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/AppCenter.UITest.Android.csproj index df44559a6..255604d20 100644 --- a/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/AppCenter.UITest.Android.csproj +++ b/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/AppCenter.UITest.Android.csproj @@ -1,14 +1,12 @@ - - - + - Debug - AnyCPU - {845DEB90-8D90-47F6-9DAA-F07E68DCE9CF} Library AppCenter.UITest.Android AppCenter.UITest.Android - v4.5 + net6.0;net462 + false + 10.0 + false true @@ -28,20 +26,7 @@ false - - - ..\packages\Xamarin.UITest.3.2.2\lib\net45\Xamarin.UITest.dll - - - ..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll - + + - - - - - - - - diff --git a/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/packages.config b/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/packages.config deleted file mode 100644 index 7e604b066..000000000 --- a/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj b/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj index 01e45f810..b43192b93 100644 --- a/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj +++ b/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj @@ -1,14 +1,12 @@ - - - + - Debug - AnyCPU - {764CE893-AF50-456A-8263-2675A94D96DF} Library AppCenter.UITest.iOS AppCenter.UITest.iOS - v4.5 + net6.0;net462 + false + 10.0 + false true @@ -28,20 +26,7 @@ false - - - ..\packages\Xamarin.UITest.3.2.2\lib\net45\Xamarin.UITest.dll - - - ..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll - + + - - - - - - - - diff --git a/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/packages.config b/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/packages.config deleted file mode 100644 index 7e604b066..000000000 --- a/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/packages.config +++ /dev/null @@ -1,5 +0,0 @@ - - - - - \ No newline at end of file From aee474764d9ad0c83b271e9c8e567e5db9e0de96 Mon Sep 17 00:00:00 2001 From: AnatolyPristensky Date: Mon, 16 Jan 2023 10:23:33 +0100 Subject: [PATCH 2/4] Fix tests --- test/commands/test/generate/uitest-test.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/test/commands/test/generate/uitest-test.ts b/test/commands/test/generate/uitest-test.ts index bd1d69b25..b800d538f 100644 --- a/test/commands/test/generate/uitest-test.ts +++ b/test/commands/test/generate/uitest-test.ts @@ -45,14 +45,12 @@ describe("Validating UITest template generation", () => { ) ).to.be.true; expect(await pfs.exists(path.join(command.outputPath, `AppCenter.UITest.${command.platform}/Tests.cs`))).to.be.true; - expect(await pfs.exists(path.join(command.outputPath, `AppCenter.UITest.${command.platform}/packages.config`))).to.be.true; expect(await pfs.exists(path.join(command.outputPath, `AppCenter.UITest.${command.platform}/Properties/AssemblyInfo.cs`))).to.be .true; }); it("should update NuGet version", async () => { // Arrange - const fakeLatestVersion = "2.5.6"; const args: CommandArgs = { command: ["test", "generate", "uitest"], commandPath: "Test", @@ -66,7 +64,10 @@ describe("Validating UITest template generation", () => { }); }); - const packageFilePath = path.join(command.outputPath, `AppCenter.UITest.${command.platform}/packages.config`); + const packageFilePath = path.join( + command.outputPath, + `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` + ); const projectFilePath = path.join( command.outputPath, `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` @@ -105,7 +106,10 @@ describe("Validating UITest template generation", () => { }); }); - const packageFilePath = path.join(command.outputPath, `AppCenter.UITest.${command.platform}/packages.config`); + const packageFilePath = path.join( + command.outputPath, + `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` + ); const projectFilePath = path.join( command.outputPath, `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` @@ -155,7 +159,10 @@ describe("Validating UITest template generation", () => { }); }); - const packageFilePath = path.join(command.outputPath, `AppCenter.UITest.${command.platform}/packages.config`); + const packageFilePath = path.join( + command.outputPath, + `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` + ); const projectFilePath = path.join( command.outputPath, `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` From faa04a918d100929af94f9fe30f0b1574eb3aad5 Mon Sep 17 00:00:00 2001 From: dorofeevs Date: Wed, 18 Jan 2023 12:39:51 +0400 Subject: [PATCH 3/4] Fixed UITests --- src/commands/test/generate/uitest.ts | 10 +++--- test/commands/test/generate/uitest-test.ts | 36 +++------------------- 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/commands/test/generate/uitest.ts b/src/commands/test/generate/uitest.ts index 3aa68eca1..a3accf82e 100644 --- a/src/commands/test/generate/uitest.ts +++ b/src/commands/test/generate/uitest.ts @@ -16,7 +16,6 @@ export default class GenerateUITestCommand extends GenerateCommand { protected async processTemplate(): Promise { const platform = this.isIOS() ? "iOS" : "Android"; - const packageFilePath = path.join(this.outputPath, `AppCenter.UITest.${platform}/packages.config`); const projectFilePath = path.join(this.outputPath, `AppCenter.UITest.${platform}/AppCenter.UITest.${platform}.csproj`); let latestVersion: string; @@ -29,11 +28,12 @@ export default class GenerateUITestCommand extends GenerateCommand { } try { - // Replace version inside packages.config file - await this.replaceVersionInFile(packageFilePath, /(id="Xamarin\.UITest" version=")(\d+(\.\d+)+)/, latestVersion); - // Replace version inside *.csproj file - await this.replaceVersionInFile(projectFilePath, /(packages\\Xamarin\.UITest\.)(\d+(\.\d+)+)/, latestVersion); + await this.replaceVersionInFile( + projectFilePath, + /( { }); it("should update NuGet version", async () => { + const fakeLatestVersion = "3.14.0"; // Arrange const args: CommandArgs = { command: ["test", "generate", "uitest"], @@ -64,19 +65,12 @@ describe("Validating UITest template generation", () => { }); }); - const packageFilePath = path.join( - command.outputPath, - `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` - ); const projectFilePath = path.join( command.outputPath, `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` ); // Assert - let packageFileContent = await pfs.readFile(packageFilePath, "utf8"); - expect(packageFileContent).not.contain(fakeLatestVersion); - let projectFileContent = await pfs.readFile(projectFilePath, "utf8"); expect(projectFileContent).not.contain(fakeLatestVersion); @@ -84,14 +78,12 @@ describe("Validating UITest template generation", () => { await (command as any).processTemplate(); // Assert - packageFileContent = await pfs.readFile(packageFilePath, "utf8"); - expect(packageFileContent).contain(fakeLatestVersion); - projectFileContent = await pfs.readFile(projectFilePath, "utf8"); expect(projectFileContent).contain(fakeLatestVersion); }); it("should not touch NuGet version on failure", async () => { + const latestVersion = "3.13.3"; // Arrange const args: CommandArgs = { command: ["test", "generate", "uitest"], @@ -106,31 +98,21 @@ describe("Validating UITest template generation", () => { }); }); - const packageFilePath = path.join( - command.outputPath, - `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` - ); const projectFilePath = path.join( command.outputPath, `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` ); // Assert - let packageFileContent = await pfs.readFile(packageFilePath, "utf8"); - expect(packageFileContent).contain("3.2.2"); - let projectFileContent = await pfs.readFile(projectFilePath, "utf8"); - expect(projectFileContent).contain("3.2.2"); + expect(projectFileContent).contain(latestVersion); // Act await (command as any).processTemplate(); // Assert - packageFileContent = await pfs.readFile(packageFilePath, "utf8"); - expect(packageFileContent).contain("3.2.2"); - projectFileContent = await pfs.readFile(projectFilePath, "utf8"); - expect(projectFileContent).contain("3.2.2"); + expect(projectFileContent).contain(latestVersion); }); it("should recover original template files on failure", async () => { @@ -159,19 +141,12 @@ describe("Validating UITest template generation", () => { }); }); - const packageFilePath = path.join( - command.outputPath, - `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` - ); const projectFilePath = path.join( command.outputPath, `AppCenter.UITest.${command.platform}/AppCenter.UITest.${command.platform}.csproj` ); // Assert - let packageFileContent = await pfs.readFile(packageFilePath, "utf8"); - expect(packageFileContent).not.contain(fakeLatestVersion); - let projectFileContent = await pfs.readFile(projectFilePath, "utf8"); expect(projectFileContent).not.contain(fakeLatestVersion); @@ -179,9 +154,6 @@ describe("Validating UITest template generation", () => { await (command as any).processTemplate(); // Assert - packageFileContent = await pfs.readFile(packageFilePath, "utf8"); - expect(packageFileContent).not.contain(fakeLatestVersion); - projectFileContent = await pfs.readFile(projectFilePath, "utf8"); expect(projectFileContent).not.contain(fakeLatestVersion); }); From 4d7d462a429dd60575d959b8dd828d79def083b3 Mon Sep 17 00:00:00 2001 From: dorofeevs Date: Fri, 20 Jan 2023 14:56:00 +0400 Subject: [PATCH 4/4] Updated Xamarin.UITest version to 4.1.0 --- .../AppCenter.UITest.Android/AppCenter.UITest.Android.csproj | 2 +- .../uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj | 2 +- test/commands/test/generate/uitest-test.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/AppCenter.UITest.Android.csproj b/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/AppCenter.UITest.Android.csproj index 255604d20..890dbed59 100644 --- a/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/AppCenter.UITest.Android.csproj +++ b/src/commands/test/lib/templates/uitest/android/AppCenter.UITest.Android/AppCenter.UITest.Android.csproj @@ -27,6 +27,6 @@ - + diff --git a/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj b/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj index b43192b93..0e345501f 100644 --- a/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj +++ b/src/commands/test/lib/templates/uitest/ios/AppCenter.UITest.iOS/AppCenter.UITest.iOS.csproj @@ -27,6 +27,6 @@ - + diff --git a/test/commands/test/generate/uitest-test.ts b/test/commands/test/generate/uitest-test.ts index 46fdc19df..0340be46a 100644 --- a/test/commands/test/generate/uitest-test.ts +++ b/test/commands/test/generate/uitest-test.ts @@ -83,7 +83,7 @@ describe("Validating UITest template generation", () => { }); it("should not touch NuGet version on failure", async () => { - const latestVersion = "3.13.3"; + const latestVersion = "4.1.0"; // Arrange const args: CommandArgs = { command: ["test", "generate", "uitest"],