Skip to content

Commit 515c6c4

Browse files
Merge pull request #491 from NeoCoderMatrix86/development
Deploy v10.1
2 parents 4f5cb0d + 269f591 commit 515c6c4

33 files changed

Lines changed: 9710 additions & 432 deletions

AudioCuesheetEditor.End2EndTests/AudioCuesheetEditor.End2EndTests.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
<ItemGroup>
1919
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.14.1" />
20-
<PackageReference Include="Microsoft.Playwright.MSTest" Version="1.54.0" />
21-
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="17.14.2" />
22-
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.8.3" />
23-
<PackageReference Include="MSTest" Version="3.10.3" />
20+
<PackageReference Include="Microsoft.Playwright.MSTest" Version="1.55.0" />
21+
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.0.4" />
22+
<PackageReference Include="Microsoft.Testing.Extensions.TrxReport" Version="1.8.4" />
23+
<PackageReference Include="MSTest" Version="3.10.4" />
2424
</ItemGroup>
2525

2626
<ItemGroup>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
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+
18+
namespace AudioCuesheetEditor.End2EndTests.Models
19+
{
20+
internal class About(IPage page)
21+
{
22+
internal const string BaseUrl = "http://localhost:5132/about";
23+
24+
private readonly IPage _page = page;
25+
26+
internal ILocator AboutHeading => _page.GetByRole(AriaRole.Heading, new() { Name = "About AudioCuesheetEditor" });
27+
28+
internal async Task GotoAsync()
29+
{
30+
await _page.GotoAsync(BaseUrl);
31+
await _page.WaitForURLAsync(BaseUrl);
32+
await _page.WaitForLoadStateAsync(LoadState.NetworkIdle);
33+
}
34+
}
35+
}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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+
partial class AppBar
22+
{
23+
[GeneratedRegex("^Open$")]
24+
private static partial Regex OpenRegex();
25+
26+
private readonly IPage _page;
27+
private readonly ILocator _menuButton;
28+
29+
internal ILocator UndoButton => _page.GetByRole(AriaRole.Button, new() { Name = "undo" });
30+
31+
internal ILocator RedoButton => _page.GetByRole(AriaRole.Button, new() { Name = "redo" });
32+
33+
internal ILocator HomeButton => _page.Locator(".mud-button-root").First;
34+
35+
internal AppBar(IPage page)
36+
{
37+
_page = page;
38+
_menuButton = _page.GetByRole(AriaRole.Button, new() { Name = "More" });
39+
}
40+
41+
internal async Task OpenSettingsAsync()
42+
{
43+
await _menuButton.ClickAsync();
44+
await _page.GetByText("Settings").ClickAsync();
45+
}
46+
47+
internal async Task ChangeLanguageAsync(string language)
48+
{
49+
await _page.GetByRole(AriaRole.Button, new() { Name = "Change language" }).ClickAsync();
50+
await _page.GetByText(language).ClickAsync();
51+
}
52+
53+
internal async Task UndoAsync()
54+
{
55+
await UndoButton.ClickAsync();
56+
}
57+
58+
internal async Task RedoAsync()
59+
{
60+
await RedoButton.ClickAsync();
61+
}
62+
63+
internal async Task OpenFileAsync(string file)
64+
{
65+
await _page.GetByRole(AriaRole.Button, new() { Name = "File", Exact = true }).ClickAsync();
66+
await _page.Locator("div").Filter(new() { HasTextRegex = OpenRegex() }).ClickAsync();
67+
await _page.Locator("#dropFileInputId_SelectFileDialog").GetByRole(AriaRole.Button, new() { Name = "Choose File" }).ClickAsync();
68+
await _page.Locator("#dropFileInputId_SelectFileDialog").GetByRole(AriaRole.Button, new() { Name = "Choose File" }).SetInputFilesAsync(file);
69+
}
70+
71+
internal async Task OpenExportDialogAsync(string exportType, string fileMenuName = "File")
72+
{
73+
await _page.GetByRole(AriaRole.Button, new() { Name = fileMenuName, Exact = true }).ClickAsync();
74+
await _page.GetByText("Export", new() { Exact = true }).HoverAsync();
75+
await _page.GetByText(exportType, new() { Exact = true }).ClickAsync();
76+
}
77+
}
78+
}
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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+
18+
namespace AudioCuesheetEditor.End2EndTests.Models
19+
{
20+
internal class DetailView(IPage page, bool mobile)
21+
{
22+
internal const string BaseUrl = "http://localhost:5132/";
23+
24+
private readonly IPage _page = page;
25+
private readonly bool _isMobile = mobile;
26+
27+
internal ILocator AudiofileInput => _page.GetByRole(AriaRole.Group).Filter(new() { HasText = "AudiofileAudiofile" }).Locator("input[type=\"file\"]");
28+
29+
internal ILocator CuesheetArtistInput => _page.GetByRole(AriaRole.Textbox, new() { Name = "Cuesheet artist" });
30+
31+
internal ILocator CuesheetTitleInput => _page.GetByRole(AriaRole.Textbox, new() { Name = "Cuesheet title" });
32+
33+
internal async Task GotoAsync()
34+
{
35+
await _page.GotoAsync(BaseUrl);
36+
await _page.WaitForURLAsync(BaseUrl);
37+
await _page.WaitForLoadStateAsync(LoadState.NetworkIdle);
38+
}
39+
40+
internal async Task AddTrackAsync()
41+
{
42+
await _page.GetByRole(AriaRole.Button, new() { Name = "Add new track" }).ClickAsync();
43+
}
44+
45+
internal async Task EditTrackAsync(string? artist = null, string? title = null)
46+
{
47+
if (artist != null)
48+
{
49+
await _page.Locator("td:nth-child(3)").ClickAsync();
50+
await _page.Locator("td:nth-child(3)").Last.GetByRole(AriaRole.Textbox).FillAsync(artist);
51+
await _page.Locator(".mud-popover-open").WaitForAsync(new() { State = WaitForSelectorState.Visible });
52+
await _page.Keyboard.PressAsync("Escape");
53+
await _page.GetByRole(AriaRole.Heading, new() { Name = "Playback" }).ClickAsync();
54+
await _page.WaitForTimeoutAsync(100);
55+
}
56+
if (title != null)
57+
{
58+
await _page.Locator("td:nth-child(4)").ClickAsync();
59+
await _page.Locator("td:nth-child(4)").Last.GetByRole(AriaRole.Textbox).FillAsync(title);
60+
await _page.Locator(".mud-popover-open").WaitForAsync(new() { State = WaitForSelectorState.Visible });
61+
await _page.Keyboard.PressAsync("Escape");
62+
await _page.GetByRole(AriaRole.Heading, new() { Name = "Playback" }).ClickAsync();
63+
await _page.WaitForTimeoutAsync(100);
64+
}
65+
}
66+
67+
internal async Task SelectTracksAsync(IEnumerable<int> trackTablePositions, Boolean uncheck = false)
68+
{
69+
foreach (var trackTablePosition in trackTablePositions)
70+
{
71+
if (uncheck)
72+
{
73+
await _page.Locator($"tr:nth-child({trackTablePosition + 1}) > td").First.GetByRole(AriaRole.Checkbox).UncheckAsync();
74+
}
75+
else
76+
{
77+
await _page.Locator($"tr:nth-child({trackTablePosition + 1}) > td").First.GetByRole(AriaRole.Checkbox).CheckAsync();
78+
}
79+
}
80+
}
81+
82+
internal async Task EditTracksModalAsync(string artist, string title, string end, IEnumerable<string> flagsToSelect)
83+
{
84+
await _page.GetByRole(AriaRole.Button, new() { Name = "Edit selected tracks" }).ClickAsync();
85+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "Artist", Exact = true }).FillAsync(artist);
86+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "Artist", Exact = true }).PressAsync("Tab");
87+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "Title", Exact = true }).FillAsync(title);
88+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "Title", Exact = true }).PressAsync("Tab");
89+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "End" }).FillAsync(end);
90+
foreach (var flag in flagsToSelect)
91+
{
92+
await _page.GetByRole(AriaRole.Button, new() { Name = flag }).ClickAsync();
93+
}
94+
await _page.GetByRole(AriaRole.Button, new() { Name = "Save changes" }).ClickAsync();
95+
}
96+
97+
internal async Task RenameAudiofileAsync(string filename)
98+
{
99+
int buttonIndex = _isMobile ? 2 : 3;
100+
await _page.GetByRole(AriaRole.Group).Filter(new() { HasText = "AudiofileAudiofile" }).GetByRole(AriaRole.Button).Nth(buttonIndex).ClickAsync();
101+
await _page.GetByText("Rename file").ClickAsync();
102+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "New file name" }).FillAsync(filename);
103+
await _page.GetByRole(AriaRole.Button, new() { Name = "Ok" }).ClickAsync();
104+
}
105+
}
106+
}
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+
}
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
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+
partial class ImportView(IPage page)
22+
{
23+
[GeneratedRegex("^Scheme common data$")]
24+
private static partial Regex SchemeCommonData();
25+
26+
internal const string BaseUrl = "http://localhost:5132/";
27+
28+
private readonly IPage _page = page;
29+
30+
internal ILocator CuesheetArtistInput => _page.GetByRole(AriaRole.Textbox, new() { Name = "Cuesheet artist" });
31+
32+
internal ILocator CuesheetTitleInput => _page.GetByRole(AriaRole.Textbox, new() { Name = "Cuesheet title" });
33+
34+
internal ILocator CatalogueNumberInput => _page.GetByRole(AriaRole.Textbox, new() { Name = "Cataloguenumber" });
35+
36+
internal async Task GotoAsync()
37+
{
38+
await _page.GotoAsync(BaseUrl);
39+
await _page.WaitForURLAsync(BaseUrl);
40+
await _page.WaitForLoadStateAsync(LoadState.NetworkIdle);
41+
await _page.GetByText("Import view").ClickAsync();
42+
}
43+
44+
internal async Task ImportFileAsync(string filepath)
45+
{
46+
await _page.GetByRole(AriaRole.Button, new() { Name = "Choose File" }).SetInputFilesAsync(filepath);
47+
}
48+
49+
internal async Task CompleteImportAsync()
50+
{
51+
await _page.GetByRole(AriaRole.Button, new() { Name = "Complete" }).ClickAsync();
52+
}
53+
54+
internal async Task SelectTracksAsync(IEnumerable<int> trackTablePositions, Boolean uncheck = false)
55+
{
56+
foreach (var trackTablePosition in trackTablePositions)
57+
{
58+
if (uncheck)
59+
{
60+
await _page.Locator($"tr:nth-child({trackTablePosition + 1}) > td").First.GetByRole(AriaRole.Checkbox).UncheckAsync();
61+
}
62+
else
63+
{
64+
await _page.Locator($"tr:nth-child({trackTablePosition + 1}) > td").First.GetByRole(AriaRole.Checkbox).CheckAsync();
65+
}
66+
}
67+
}
68+
69+
internal async Task EditTracksModalAsync(string title)
70+
{
71+
await _page.GetByRole(AriaRole.Button, new() { Name = "Edit selected tracks" }).ClickAsync();
72+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "Title", Exact = true }).FillAsync(title);
73+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "Title", Exact = true }).PressAsync("Tab");
74+
await _page.GetByRole(AriaRole.Button, new() { Name = "Save changes" }).ClickAsync();
75+
}
76+
77+
internal async Task SwitchImportProfileAsync(string profile)
78+
{
79+
await _page.GetByText("Textfile (common data in").ClickAsync();
80+
await _page.GetByText(profile).ClickAsync();
81+
}
82+
83+
internal async Task ClearSchemeCommonDataAsync()
84+
{
85+
await _page.Locator("div").Filter(new() { HasTextRegex = SchemeCommonData() }).GetByLabel("Clear").ClickAsync();
86+
}
87+
88+
internal async Task SetSchemeCommonDataAsync(string schemeCommonData)
89+
{
90+
await _page.GetByRole(AriaRole.Textbox, new() { Name = "Scheme common data" }).FillAsync(schemeCommonData);
91+
}
92+
93+
internal async Task SelectSchemeCommonDataPlaceholderAsync(string placeholder)
94+
{
95+
await _page.Locator("div").Filter(new() { HasTextRegex = SchemeCommonData() }).GetByRole(AriaRole.Button).Nth(1).ClickAsync();
96+
await _page.GetByRole(AriaRole.Paragraph).Filter(new() { HasText = placeholder }).ClickAsync();
97+
}
98+
}
99+
}

0 commit comments

Comments
 (0)