Skip to content

Commit 6161922

Browse files
Merge pull request #490 from NeoCoderMatrix86/456-export-to-text-placeholders-are-not-localized
Export to text placeholders are not localized
2 parents 6fb9494 + aa2d022 commit 6161922

20 files changed

Lines changed: 398 additions & 31 deletions

AudioCuesheetEditor.End2EndTests/Models/About.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
using Microsoft.Playwright;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using Microsoft.Playwright;
217

318
namespace AudioCuesheetEditor.End2EndTests.Models
419
{

AudioCuesheetEditor.End2EndTests/Models/AppBar.cs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
using Microsoft.Playwright;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using Microsoft.Playwright;
217
using System.Text.RegularExpressions;
318

419
namespace AudioCuesheetEditor.End2EndTests.Models
520
{
6-
internal class AppBar
21+
partial class AppBar
722
{
23+
[GeneratedRegex("^Open$")]
24+
private static partial Regex OpenRegex();
25+
826
private readonly IPage _page;
927
private readonly ILocator _menuButton;
1028

@@ -17,10 +35,7 @@ internal class AppBar
1735
internal AppBar(IPage page)
1836
{
1937
_page = page;
20-
_menuButton = _page.GetByRole(AriaRole.Toolbar)
21-
.GetByRole(AriaRole.Button)
22-
.Filter(new() { HasTextRegex = new Regex("^$") })
23-
.Nth(3);
38+
_menuButton = _page.GetByRole(AriaRole.Button, new() { Name = "More" });
2439
}
2540

2641
internal async Task OpenSettingsAsync()
@@ -48,14 +63,14 @@ internal async Task RedoAsync()
4863
internal async Task OpenFileAsync(string file)
4964
{
5065
await _page.GetByRole(AriaRole.Button, new() { Name = "File", Exact = true }).ClickAsync();
51-
await _page.Locator("div").Filter(new() { HasTextRegex = new Regex("^Open$") }).ClickAsync();
66+
await _page.Locator("div").Filter(new() { HasTextRegex = OpenRegex() }).ClickAsync();
5267
await _page.Locator("#dropFileInputId_SelectFileDialog").GetByRole(AriaRole.Button, new() { Name = "Choose File" }).ClickAsync();
5368
await _page.Locator("#dropFileInputId_SelectFileDialog").GetByRole(AriaRole.Button, new() { Name = "Choose File" }).SetInputFilesAsync(file);
5469
}
5570

56-
internal async Task OpenExportDialogAsync(string exportType)
71+
internal async Task OpenExportDialogAsync(string exportType, string fileMenuName = "File")
5772
{
58-
await _page.GetByRole(AriaRole.Button, new() { Name = "File", Exact = true }).ClickAsync();
73+
await _page.GetByRole(AriaRole.Button, new() { Name = fileMenuName, Exact = true }).ClickAsync();
5974
await _page.GetByText("Export", new() { Exact = true }).HoverAsync();
6075
await _page.GetByText(exportType, new() { Exact = true }).ClickAsync();
6176
}

AudioCuesheetEditor.End2EndTests/Models/DetailView.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
using Microsoft.Playwright;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using Microsoft.Playwright;
217

318
namespace AudioCuesheetEditor.End2EndTests.Models
419
{
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using Microsoft.Playwright;
17+
using System.Text.RegularExpressions;
18+
19+
namespace AudioCuesheetEditor.End2EndTests.Models
20+
{
21+
internal class ExportDialog(IPage page)
22+
{
23+
private readonly IPage _page = page;
24+
25+
internal async Task OpenSchemeMenuAsync(string schemeHeadMenuName = "Scheme head")
26+
{
27+
await _page.Locator("div").Filter(new() { HasTextRegex = new Regex($"^{schemeHeadMenuName}$") }).GetByRole(AriaRole.Button).Nth(1).ClickAsync();
28+
}
29+
}
30+
}

AudioCuesheetEditor.End2EndTests/Models/ImportView.cs

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,28 @@
1-
using Microsoft.Playwright;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using Microsoft.Playwright;
217
using System.Text.RegularExpressions;
318

419
namespace AudioCuesheetEditor.End2EndTests.Models
520
{
6-
internal class ImportView(IPage page)
21+
partial class ImportView(IPage page)
722
{
23+
[GeneratedRegex("^Scheme common data$")]
24+
private static partial Regex SchemeCommonData();
25+
826
internal const string BaseUrl = "http://localhost:5132/";
927

1028
private readonly IPage _page = page;
@@ -64,7 +82,7 @@ internal async Task SwitchImportProfileAsync(string profile)
6482

6583
internal async Task ClearSchemeCommonDataAsync()
6684
{
67-
await _page.Locator("div").Filter(new() { HasTextRegex = new Regex("^Scheme common data$") }).GetByLabel("Clear").ClickAsync();
85+
await _page.Locator("div").Filter(new() { HasTextRegex = SchemeCommonData() }).GetByLabel("Clear").ClickAsync();
6886
}
6987

7088
internal async Task SetSchemeCommonDataAsync(string schemeCommonData)
@@ -74,7 +92,7 @@ internal async Task SetSchemeCommonDataAsync(string schemeCommonData)
7492

7593
internal async Task SelectSchemeCommonDataPlaceholderAsync(string placeholder)
7694
{
77-
await _page.Locator("div").Filter(new() { HasTextRegex = new Regex("^Scheme common data$") }).GetByRole(AriaRole.Button).Nth(1).ClickAsync();
95+
await _page.Locator("div").Filter(new() { HasTextRegex = SchemeCommonData() }).GetByRole(AriaRole.Button).Nth(1).ClickAsync();
7896
await _page.GetByRole(AriaRole.Paragraph).Filter(new() { HasText = placeholder }).ClickAsync();
7997
}
8098
}

AudioCuesheetEditor.End2EndTests/Models/RecordView.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
using Microsoft.Playwright;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using Microsoft.Playwright;
217

318
namespace AudioCuesheetEditor.End2EndTests.Models
419
{

AudioCuesheetEditor.End2EndTests/Tests/Desktop/BasicTest.cs

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
using AudioCuesheetEditor.End2EndTests.Models;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using AudioCuesheetEditor.End2EndTests.Models;
217
using Microsoft.Playwright;
318

419
namespace AudioCuesheetEditor.End2EndTests.Tests.Desktop
@@ -46,9 +61,10 @@ public async Task OpenSettings_ShouldDisplaySettings_WhenSelectingSettings()
4661
}
4762

4863
[TestMethod]
49-
public async Task ChangeLanguage_ShouldShowGermanHeadings_WhenGermanIsSelected()
64+
public async Task ChangeLanguage_ShouldSwitchLanguage_WhenGermanIsSelected()
5065
{
5166
var bar = new AppBar(TestPage);
67+
var exportDialog = new ExportDialog(TestPage);
5268
var detailView = new DetailView(TestPage, DeviceName != null);
5369
await detailView.GotoAsync();
5470
await bar.ChangeLanguageAsync("German (Germany)");
@@ -57,6 +73,13 @@ public async Task ChangeLanguage_ShouldShowGermanHeadings_WhenGermanIsSelected()
5773
await Expect(TestPage.GetByText("Aufnahmeansicht")).ToBeVisibleAsync();
5874
await Expect(TestPage.GetByRole(AriaRole.Heading, new() { Name = "Titel" })).ToBeVisibleAsync();
5975
await Expect(TestPage.GetByRole(AriaRole.Heading, new() { Name = "Wiedergabe" })).ToBeVisibleAsync();
76+
await bar.OpenExportDialogAsync("Textdatei", "Datei");
77+
await Expect(TestPage.GetByRole(AriaRole.Dialog)).ToMatchAriaSnapshotAsync("- tabpanel:\n - text: \"Export ist derzeit nicht möglich: Titel hat ungültige Anzahl (0)! Künstler hat keinen Wert! Titel hat keinen Wert! Audiodatei hat keinen Wert! YouTube\"\n - group \"Exportprofil auswählen\"\n - text: Exportprofil auswählen\n - group:\n - button \"Neues Exportprofil hinzufügen\"\n - button \"Ausgewähltes Exportprofil löschen\"\n - separator\n - textbox \"Name\": YouTube\n - group \"Name\"\n - text: Name\n - textbox \"Dateiname\": YouTube.txt\n - group \"Dateiname\"\n - text: Dateiname\n - textbox \"Schema Kopf\": \"%Cuesheet.Artist% - %Cuesheet.Title%\"\n - button \"Clear\"\n - button\n - group \"Schema Kopf\"\n - text: Schema Kopf\n - textbox \"Schema Titel\": \"%Track.Artist% - %Track.Title% %Track.Begin%\"\n - button \"Clear\"\n - button\n - group \"Schema Titel\"\n - text: Schema Titel\n - textbox \"Schema Fuß\"\n - button\n - group \"Schema Fuß\"\n - text: Schema Fuß");
78+
await exportDialog.OpenSchemeMenuAsync("Schema Kopf");
79+
await Expect(TestPage.Locator("#app")).ToMatchAriaSnapshotAsync("- paragraph: Künstler\n- paragraph: Titel\n- paragraph: Audiodatei\n- paragraph: CDTextdatei\n- paragraph: Katalognummer\n- paragraph: Datum\n- paragraph: Datum & Uhrzeit\n- paragraph: Uhrzeit");
80+
await TestPage.GetByText("CDTextdatei").ClickAsync();
81+
await exportDialog.OpenSchemeMenuAsync("Schema Titel");
82+
await Expect(TestPage.Locator("#app")).ToMatchAriaSnapshotAsync("- paragraph: Position\n- paragraph: Künstler\n- paragraph: Titel\n- paragraph: Beginn\n- paragraph: Ende\n- paragraph: Länge\n- paragraph: Markierungen\n- paragraph: Vorlücke\n- paragraph: Nachlücke");
6083
}
6184

6285
[TestMethod]

AudioCuesheetEditor.End2EndTests/Tests/Desktop/ExportTest.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
using AudioCuesheetEditor.End2EndTests.Models;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using AudioCuesheetEditor.End2EndTests.Models;
217
using Microsoft.Playwright;
318

419
namespace AudioCuesheetEditor.End2EndTests.Tests.Desktop

AudioCuesheetEditor.End2EndTests/Tests/Desktop/ImportTest.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
using AudioCuesheetEditor.End2EndTests.Models;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using AudioCuesheetEditor.End2EndTests.Models;
217
using Microsoft.Playwright;
318

419
namespace AudioCuesheetEditor.End2EndTests.Tests.Desktop

AudioCuesheetEditor.End2EndTests/Tests/Desktop/RecordTest.cs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1-
using AudioCuesheetEditor.End2EndTests.Models;
1+
//This file is part of AudioCuesheetEditor.
2+
3+
//AudioCuesheetEditor is free software: you can redistribute it and/or modify
4+
//it under the terms of the GNU General Public License as published by
5+
//the Free Software Foundation, either version 3 of the License, or
6+
//(at your option) any later version.
7+
8+
//AudioCuesheetEditor is distributed in the hope that it will be useful,
9+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
//GNU General Public License for more details.
12+
13+
//You should have received a copy of the GNU General Public License
14+
//along with Foobar. If not, see
15+
//<http: //www.gnu.org/licenses />.
16+
using AudioCuesheetEditor.End2EndTests.Models;
217
using Microsoft.Playwright;
318

419
namespace AudioCuesheetEditor.End2EndTests.Tests.Desktop

0 commit comments

Comments
 (0)