Skip to content

Commit 0914338

Browse files
committed
LPD-44939 Rewrite sandbox test to publish correct publication
1 parent 4d7fa9d commit 0914338

File tree

2 files changed

+45
-23
lines changed

2 files changed

+45
-23
lines changed

modules/test/playwright/pages/change-tracking-web/ChangeTrackingPage.ts

+17-1
Original file line numberDiff line numberDiff line change
@@ -317,14 +317,30 @@ export class ChangeTrackingPage {
317317
);
318318
}
319319

320+
async publishSandboxPublication(title: string) {
321+
await this.goto();
322+
323+
await this.page.getByRole('link', {name: title}).first().click();
324+
325+
await this.page.getByRole('link', {name: 'Publish'}).waitFor();
326+
327+
await this.page.getByRole('link', {name: 'Publish'}).click();
328+
329+
await expect(
330+
this.page.getByText('No unresolved conflicts, ready to publish.')
331+
).toBeVisible();
332+
333+
await this.page.getByRole('button', {name: 'Publish'}).click();
334+
}
335+
320336
async toggleSandboxConfiguration(check: boolean) {
321337
await this.goto();
322338

323339
await this.page.getByLabel('Options').click();
324340

325341
await this.page.getByRole('menuitem', {name: 'Settings'}).click();
326342

327-
await expect(this.page.getByText('Sandbox Only')).toBeVisible();
343+
await expect(this.page.getByText('Enable Publications')).toBeVisible();
328344

329345
const checkBox = this.page.getByRole('checkbox', {
330346
name: 'enable-sandbox-only',

modules/test/playwright/tests/change-tracking-web/sandboxMode.spec.ts

+28-22
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ import {expect, mergeTests} from '@playwright/test';
88
import {apiHelpersTest} from '../../fixtures/apiHelpersTest';
99
import {changeTrackingPagesTest} from '../../fixtures/changeTrackingPagesTest';
1010
import {featureFlagsTest} from '../../fixtures/featureFlagsTest';
11-
import {isolatedSiteTest} from '../../fixtures/isolatedSiteTest';
1211
import getRandomString from '../../utils/getRandomString';
1312
import performLogin, {performLogout} from '../../utils/performLogin';
14-
import getBasicWebContentStructureId from '../../utils/structured-content/getBasicWebContentStructureId';
13+
import {waitForAlert} from '../../utils/waitForAlert';
14+
import {journalPagesTest} from '../journal-web/fixtures/journalPagesTest';
1515

1616
export const test = mergeTests(
1717
featureFlagsTest({
1818
'LPD-20556': true,
1919
}),
2020
apiHelpersTest,
2121
changeTrackingPagesTest,
22-
isolatedSiteTest
22+
journalPagesTest
2323
);
2424

2525
test.beforeEach(async ({changeTrackingPage}) => {
@@ -79,40 +79,46 @@ test('LPD-34602 Add view-only mode for production when using Publications sandbo
7979
test('LPD-39341 Sandbox mode allows users to work on production without permissions', async ({
8080
apiHelpers,
8181
changeTrackingPage,
82-
ctCollection,
82+
journalEditArticlePage,
8383
page,
84-
site,
8584
}) => {
86-
await changeTrackingPage.workOnPublication(ctCollection);
85+
const user = await changeTrackingPage.addUserWithPublicationsUserRole();
86+
87+
await performLogout(page);
8788

88-
const basicWebContentStructureId =
89-
await getBasicWebContentStructureId(apiHelpers);
89+
await performLogin(page, user.alternateName);
90+
91+
const sandboxPublication = await page.getByText(user.alternateName + ' - ');
92+
93+
await expect(sandboxPublication).toBeVisible();
94+
95+
await journalEditArticlePage.goto();
9096

9197
const title = getRandomString();
9298

93-
await apiHelpers.jsonWebServicesJournal.addWebContent({
94-
ddmStructureId: basicWebContentStructureId,
95-
groupId: site.id,
96-
titleMap: {en_US: title},
97-
});
99+
await journalEditArticlePage.fillTitle(title);
98100

99-
const user = await changeTrackingPage.addUserWithPublicationsUserRole();
101+
await journalEditArticlePage.publishArticle();
102+
103+
await waitForAlert(page, `Success:${title} was created successfully.`);
100104

101105
await performLogout(page);
102106

103-
await performLogin(page, user.alternateName);
107+
await performLogin(page, 'test');
104108

105-
await changeTrackingPage.workOnPublication(ctCollection);
109+
await changeTrackingPage.publishSandboxPublication(user.alternateName);
106110

107-
await apiHelpers.headlessChangeTracking.publishCTCollection(
108-
ctCollection.body.id
109-
);
111+
await performLogout(page);
110112

111-
await page.reload();
113+
await performLogin(page, user.alternateName);
112114

113-
const sandboxPublication = await page.getByText(user.alternateName + ' - ');
115+
const newSandboxPublication = await page.getByText(
116+
user.alternateName + ' - '
117+
);
114118

115-
await expect(sandboxPublication).toBeVisible();
119+
await expect(sandboxPublication).not.toBe(newSandboxPublication);
120+
121+
await expect(newSandboxPublication).toBeVisible();
116122

117123
await performLogout(page);
118124

0 commit comments

Comments
 (0)