Skip to content

Commit

Permalink
Rename test cases and corresponding snapshots
Browse files Browse the repository at this point in the history
- Use new, fuller names when clicking theme menu items.
- Update test case names to consistently refer to the theme, except for
  the default theme (Classic Light), which is omitted.
- Update snapshot image file names to match changed test case names.
  I exported a patch and winnowed it down to a set of replacements,
  and then had ChatGPT give me this Powershell script:

    # Define the replacements as old -> new mappings
    $replacements = @{
        "modern theme eye gaze mode"="modern light theme -- eye gaze mode";
        "modern theme"="modern light theme -- main screenshot";
        "modern theme edit colors dialog (expanded)"="modern light theme -- edit colors dialog (expanded)";
        "winter theme"="winter theme -- main screenshot";
        "winter theme edit colors dialog (expanded)"="winter theme -- edit colors dialog (expanded)";
        "winter theme vertical color box"="winter theme -- vertical color box";
        "classic theme vertical color box"="'vertical color box";
        "classic theme edit colors dialog"="edit colors dialog";
        "modern theme vertical color box"="modern light theme -- vertical color box"
    }

    # Get all files in the current directory
    $files = Get-ChildItem -File

    foreach ($file in $files) {
        # Store the original file name
        $originalName = $file.Name
        
        # Perform each replacement on the file name
        foreach ($replacement in $replacements.GetEnumerator()) {
            if ($originalName -like "*$($replacement.Key)*") {
                $newName = $originalName -replace [regex]::Escape($replacement.Key), $replacement.Value
                Rename-Item -Path $originalName -NewName $newName
                # Update originalName to handle multiple replacements
                $originalName = $newName
            }
        }
    }
  • Loading branch information
1j01 committed Mar 1, 2024
1 parent eef07b6 commit a6367d5
Show file tree
Hide file tree
Showing 10 changed files with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions cypress/integration/visual-tests.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ context('visual tests', () => {
cy.matchImageSnapshot(withTextCompareOptions);
});

it('modern theme eye gaze mode', () => {
it('modern light theme -- eye gaze mode', () => {
cy.get(".eye-gaze-mode-undo-button").should('exist');
selectTheme("Modern");
selectTheme("Modern Light");
// clickMenuButton("View");
// cy.get("body").trigger("pointermove", { clientX: 200, clientY: 150 });
cy.wait(100);
Expand All @@ -171,7 +171,7 @@ context('visual tests', () => {
cy.get(".eye-gaze-mode-undo-button").should('not.exist');
});

it('modern theme', () => {
it('modern light theme -- main screenshot', () => {
cy.wait(100);
// clickMenuButton("View");
// cy.get("body").trigger("pointermove", { clientX: 200, clientY: 150 });
Expand All @@ -189,19 +189,19 @@ context('visual tests', () => {
}
cy.get('.window:visible').matchImageSnapshot(Object.assign({}, withTextCompareOptions));
};
it('modern theme edit colors dialog (expanded)', test_edit_colors_dialog);
it('modern light theme -- edit colors dialog (expanded)', test_edit_colors_dialog);

it('winter theme', () => {
it('winter theme -- main screenshot', () => {
selectTheme("Winter");
// clickMenuButton("View");
// cy.get("body").trigger("pointermove", { clientX: 200, clientY: 150 });
cy.wait(100);
cy.matchImageSnapshot(withTextCompareOptions);
});

it('winter theme edit colors dialog (expanded)', test_edit_colors_dialog);
it('winter theme -- edit colors dialog (expanded)', test_edit_colors_dialog);

it('winter theme vertical color box', () => {
it('winter theme -- vertical color box', () => {
cy.wait(500);
clickMenuButton("Extras");
clickMenuItem("Vertical Color Box");
Expand All @@ -211,17 +211,17 @@ context('visual tests', () => {
cy.matchImageSnapshot(withTextCompareOptions);
});

it('classic theme vertical color box', () => {
selectTheme("Classic");
it('vertical color box', () => {
selectTheme("Classic Light");
cy.matchImageSnapshot(withTextCompareOptions);
});

it('classic theme edit colors dialog', () => {
it('edit colors dialog', () => {
test_edit_colors_dialog(false);
});

it('modern theme vertical color box', () => {
selectTheme("Modern");
it('modern light theme -- vertical color box', () => {
selectTheme("Modern Light");
cy.matchImageSnapshot(withTextCompareOptions);
});

Expand Down

0 comments on commit a6367d5

Please sign in to comment.