Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests in context of currently connected instance #639

Merged
merged 1 commit into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions gui/next/playwright/backgroundJobs.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { test, expect } from '@playwright/test';
import { posInstance } from './helpers/posInstance.js';


const url = './backgroundJobs';
const triggerLogUrl = 'https://qa-poscli-gui-ci.staging.oregon.platform-os.com/';


test('see home screen', async ({ page }) => {
Expand All @@ -15,7 +15,7 @@ test('see home screen', async ({ page }) => {


test('viewing scheduled background jobs', async ({ page }) => {
await page.goto(triggerLogUrl + 'background_job');
await page.goto(posInstance.MPKIT_URL + 'background_job');
await expect(page.getByText('background job scheduled')).toBeVisible();

await page.goto(url);
Expand All @@ -27,7 +27,7 @@ test('viewing scheduled background jobs', async ({ page }) => {


test('viewing background job details', async ({ page }) => {
await page.goto(triggerLogUrl + 'background_job');
await page.goto(posInstance.MPKIT_URL + 'background_job');
await expect(page.getByText('background job scheduled')).toBeVisible();

await page.goto(url);
Expand All @@ -43,7 +43,7 @@ test('viewing background job details', async ({ page }) => {


test('deleting scheduled background job', async ({ page }) => {
await page.goto(triggerLogUrl + 'background_job_to_delete');
await page.goto(posInstance.MPKIT_URL + 'background_job_to_delete');
await expect(page.getByText('background job scheduled')).toBeVisible();

page.on('dialog', async dialog => {
Expand Down
10 changes: 10 additions & 0 deletions gui/next/playwright/helpers/posInstance.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const posInstance = {
MPKIT_URL: ''
};

fetch('http://localhost:3333/info').then(data => data.json()).then(info => {
posInstance.MPKIT_URL = info.MPKIT_URL;
})


export { posInstance };
5 changes: 3 additions & 2 deletions gui/next/playwright/home.spec.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import { test, expect } from '@playwright/test';
import { posInstance } from './helpers/posInstance.js';



test('see home screen', async ({ page }) => {
await page.goto('./');

await expect(page).toHaveTitle('platformOS: qa-poscli-gui-ci.staging.oregon.platform-os.com/');
await expect(page).toHaveTitle(`platformOS: ${posInstance.MPKIT_URL.replace('https://', '')}`);
await expect(page.locator('body')).toContainText('Partner Portal');
});


test('seeing instance URL', async ({ page }) => {
await page.goto('./');

await expect(page.locator('.instance')).toContainText('qa-poscli-gui-ci.staging.oregon.platform-os.com/');
await expect(page.locator('.instance')).toContainText(posInstance.MPKIT_URL.replace('https://', ''));
});


Expand Down
10 changes: 5 additions & 5 deletions gui/next/playwright/logs.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { test, expect } from '@playwright/test';
import { posInstance } from './helpers/posInstance.js';


const url = './logs';
const triggerLogUrl = 'https://qa-poscli-gui-ci.staging.oregon.platform-os.com/';


test('see home screen', async ({ page }) => {
Expand All @@ -17,7 +17,7 @@ test('see home screen', async ({ page }) => {


test('viewing logs', async ({ page }) => {
await page.goto(triggerLogUrl + 'log?message=This+is+a+first+test+log');
await page.goto(posInstance.MPKIT_URL + 'log?message=This+is+a+first+test+log');
await expect(page.getByText('Registering a log: info')).toBeVisible();

await page.goto(url);
Expand Down Expand Up @@ -59,9 +59,9 @@ test('pinning a log message and managing pinned logs', async ({ page }) => {


test('filtering log messages', async ({ page }) => {
await page.goto(triggerLogUrl + 'log?message=Log+of+info+type+for+filtering+log+messages+tests');
await page.goto(posInstance.MPKIT_URL + 'log?message=Log+of+info+type+for+filtering+log+messages+tests');
await expect(page.getByText('Registering a log: info')).toBeVisible();
await page.goto(triggerLogUrl + 'log?type=error&message=Error+log+for+filtering+log+messages+tests');
await page.goto(posInstance.MPKIT_URL + 'log?type=error&message=Error+log+for+filtering+log+messages+tests');
await expect(page.getByText('Registering a log: error')).toBeVisible();

await page.goto(url);
Expand All @@ -77,7 +77,7 @@ test('filtering log messages', async ({ page }) => {


test('clearing logs from the screen', async ({ page }) => {
await page.goto(triggerLogUrl + 'log?message=Log+for+clearing+logs+from+the+screen+tests');
await page.goto(posInstance.MPKIT_URL + 'log?message=Log+for+clearing+logs+from+the+screen+tests');
await expect(page.getByText('Registering a log: info')).toBeVisible();

await page.goto(url);
Expand Down
12 changes: 6 additions & 6 deletions gui/next/playwright/logsv2.spec.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import { test, expect } from '@playwright/test';
import { posInstance } from './helpers/posInstance.js';


const url = './logsv2';
const triggerLogUrl = 'https://qa-poscli-gui-ci.staging.oregon.platform-os.com/';


test('see link on home screen', async ({ page }) => {
await page.goto('./');

await page.getByRole('link', { name: 'Logs v2', exact: true}).first().click();

await expect(page).toHaveTitle('Logs: ' + triggerLogUrl.replace('https://', ''));
await expect(page).toHaveTitle('Logs: ' + posInstance.MPKIT_URL.replace('https://', ''));
});


test('viewing logs', async ({ page }) => {
const currentTime = Date.now();

await page.goto(triggerLogUrl + `log?message=${currentTime}+this+is+a+first+test+log+for+logsv2`);
await page.goto(posInstance.MPKIT_URL + `log?message=${currentTime}+this+is+a+first+test+log+for+logsv2`);
await expect(page.getByText('Registering a log: info')).toBeVisible();

await page.waitForTimeout(4000);
Expand All @@ -31,7 +31,7 @@ test('viewing logs', async ({ page }) => {
test('filtering logs to previous date', async ({ page }) => {
const currentTime = Date.now();

await page.goto(triggerLogUrl + `log?message=${currentTime}+this+log+should+not+be+visible+after+filtering+the+date`);
await page.goto(posInstance.MPKIT_URL + `log?message=${currentTime}+this+log+should+not+be+visible+after+filtering+the+date`);
await expect(page.getByText('Registering a log: info')).toBeVisible();

await page.waitForTimeout(4000);
Expand All @@ -52,7 +52,7 @@ test('filtering logs to previous date', async ({ page }) => {
test('filtering logs by string', async ({ page }) => {
const currentTime = Date.now();

await page.goto(triggerLogUrl + `log?message=Timestamp+log+${currentTime}`);
await page.goto(posInstance.MPKIT_URL + `log?message=Timestamp+log+${currentTime}`);
await expect(page.getByText('Registering a log: info')).toBeVisible();

await page.waitForTimeout(4000);
Expand All @@ -71,7 +71,7 @@ test('filtering logs by string', async ({ page }) => {
test('opening and closing logs details', async ({ page }) => {
const currentTime = Date.now();

await page.goto(triggerLogUrl + `log?message=${currentTime}+log+for+details&type=details`);
await page.goto(posInstance.MPKIT_URL + `log?message=${currentTime}+log+for+details&type=details`);
await expect(page.getByText('Registering a log: details')).toBeVisible();

await page.waitForTimeout(4000);
Expand Down
Loading