Skip to content

Commit

Permalink
Pick up PR branch name for DA URL
Browse files Browse the repository at this point in the history
  • Loading branch information
bosschaert committed Mar 25, 2024
1 parent 7706ce5 commit 8cdd442
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/e2e/tests/editor.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,13 @@
/* eslint-disable import/no-unresolved */
const { test, expect } = require('@playwright/test');

console.log('*** ', process.env.GITHUB_HEAD_REF);
const DA_BRANCH = process.env.GITHUB_HEAD_REF || 'main';
const DA_HOST = `https://${DA_BRANCH}--da-live--adobe.hlx.live`;
console.log('*** DA_URL', DA_HOST);

test('Get Main Page', async ({ page }) => {
await page.goto('https://da.live/');
await page.goto(DA_HOST);
const html = await page.content();
expect(html).toContain('Dark Alley');

Expand All @@ -26,7 +31,7 @@ test('Update Document', async ({ browser, page }, workerInfo) => {

const dateStamp = Date.now().toString(36);
const pageName = `pw-test1-${dateStamp}-${workerInfo.project.name}`;
const url = `https://da.live/edit#/da-sites/da-status/tests/${pageName}`;
const url = `${DA_HOST}/edit#/da-sites/da-status/tests/${pageName}`;

try {
await page.goto(url);
Expand Down Expand Up @@ -57,7 +62,7 @@ test('Create Delete Document', async ({ browser, page }, workerInfo) => {
const pageName = `pw-test2-${dateStamp}-${workerInfo.project.name}`;

try {
await page.goto('https://da.live/#/da-sites/da-status/tests');
await page.goto(`${DA_HOST}/#/da-sites/da-status/tests`);
await page.locator('button.da-actions-new-button').click();
await page.locator('button:text("Document")').click();
await page.locator('input.da-actions-input').fill(pageName);
Expand All @@ -67,7 +72,7 @@ test('Create Delete Document', async ({ browser, page }, workerInfo) => {
await page.locator('div.ProseMirror').fill('testcontent');

const newPage = await browser.newPage();
await newPage.goto('https://da.live/#/da-sites/da-status/tests');
await newPage.goto(`${DA_HOST}/#/da-sites/da-status/tests`);

// Wait 1 sec
await newPage.waitForTimeout(4000);
Expand Down

0 comments on commit 8cdd442

Please sign in to comment.