Skip to content

Commit

Permalink
test: a test case for gatsby references
Browse files Browse the repository at this point in the history
  • Loading branch information
Leksat committed Oct 10, 2023
1 parent da8d3f2 commit cb2c779
Showing 1 changed file with 37 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import {
drupal,
drupalLogin,
gatsby,
resetState,
waitForGatsby,
} from '@amazeelabs/silverback-playwright';
import { expect, test } from '@playwright/test';

test.beforeAll(async () => {
await resetState();
});

test('@gatsby-build references', async ({ page, request }) => {
// Check the tag present on the page.
await page.goto(gatsby.baseUrl);
await page.click('a:text-is("With everything")');
await expect(page.locator(':text("Tag 1")')).toHaveCount(1);

// Remove the tag.
await drupalLogin(page);
await page.goto(
`${drupal.baseUrl}/admin/structure/taxonomy/manage/tag/overview`,
);
await page.click(
'.dropbutton-wrapper :text-is("Edit"):right-of(:text-is("Tag 1"))',
);
await page.click('.tabs--primary :text-is("Delete")');
await page.click('.button--primary');
await page.waitForSelector(':text("Deleted term")');
await waitForGatsby();

// Check the tag has gone.
await page.goto(gatsby.baseUrl);
await page.click('a:text-is("With everything")');
await expect(page.locator(':text("Tag 1")')).toHaveCount(0);
});

0 comments on commit cb2c779

Please sign in to comment.