Skip to content

Commit

Permalink
Add e2e tests for new context menu action
Browse files Browse the repository at this point in the history
  • Loading branch information
ocket8888 committed Jan 23, 2024
1 parent 3dbd650 commit bf9d673
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,44 @@
describe("Servers table page", () => {
beforeEach(() => {
cy.login();
cy.visit("/core/servers");
});
it("Filters servers by hostname", () => {
cy.visit("/core/servers");
cy.get("input[name=fuzzControl]").focus().type("edge");
cy.window().its("location.search").should("contain", "search=edge");
});
it("Queues and clears revalidations on a server", () => {
cy.get("input[name=fuzzControl]").focus().type("edge");

// We need to force re-rendering of the table every time we do
// something, or cypress moves too fast and undoes things it's doing
// before the effects can be seen. This could be fixed by splitting
// these into separate tests, but that wouldn't be faster and would have
// the added drawback that it depends on the initial state of the data
// and the order in which the tests are run.
const reload = (): void => {
cy.reload();
cy.get("button[aria-label='column visibility menu']").click();
cy.get("input[type=checkbox][name='Reval Pending']").check();
cy.get("body").click(); // closes the menu so you can interact with other things.
};

reload();

cy.get(".ag-row:visible").first().rightclick();
cy.get("button").contains("Queue Content Revalidation").click();
reload();

cy.get(".ag-cell[col-id=revalPending]").first().should("contain.text", "schedule");
cy.get(".ag-row:visible").first().rightclick();
cy.get("button").contains("Clear Queued Content Revalidations").click();
reload();

cy.get(".ag-cell[col-id=revalPending]").first().should("contain.text", "done");
cy.get(".ag-row:visible").first().rightclick();
cy.get("button").contains("Queue Content Revalidation").click();
reload();

cy.get(".ag-cell[col-id=revalPending]").first().should("contain.text", "schedule");
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<button mat-flat-button type="button" title="clear all active filters" (click)="clearFilters()"><mat-icon>filter_list</mat-icon> Clear</button>
<button mat-flat-button type="button"*ngFor="let btn of tableTitleButtons" (click)="emitTitleButtonAction(btn.action)">{{btn.text}}</button>
<div class="toggle-columns" role="group" title="Select Table Columns">
<button type="button" mat-flat-button [matMenuTriggerFor]="menu" #trigger="matMenuTrigger">
<button type="button" mat-flat-button aria-label="column visibility menu" [matMenuTriggerFor]="menu" #trigger="matMenuTrigger">
<mat-icon>view_column</mat-icon>&nbsp;
<mat-icon class="caret" [ngClass]="{'rotate': trigger.menuOpen}">expand_more</mat-icon>
</button>
Expand Down

0 comments on commit bf9d673

Please sign in to comment.