Browse Source

adjust tests for new onboarding messages

master
Trent Larson 3 weeks ago
parent
commit
b0bbc39af8
  1. 34
      playwright.config-local.ts
  2. 11
      src/components/OnboardingDialog.vue
  3. 5
      src/views/HelpView.vue
  4. 3
      test-playwright/00-noid-tests.spec.ts
  5. 1
      test-playwright/20-create-project.spec.ts
  6. 3
      test-playwright/25-create-project-x10.spec.ts
  7. 1
      test-playwright/30-record-gift.spec.ts
  8. 3
      test-playwright/33-record-gift-x10.spec.ts
  9. 2
      test-playwright/40-add-contact.spec.ts
  10. 1
      test-playwright/50-record-offer.spec.ts

34
playwright.config-local.ts

@ -1,4 +1,4 @@
import { defineConfig, devices } from '@playwright/test';
import { defineConfig, devices } from "@playwright/test";
/**
* Read environment variables from file.
@ -11,7 +11,7 @@ import { defineConfig, devices } from '@playwright/test';
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './test-playwright',
testDir: "./test-playwright",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
@ -21,44 +21,44 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:8080',
baseURL: "http://localhost:8080",
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
trace: "on-first-retry",
},
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
name: "chromium",
use: {
...devices['Desktop Chrome'],
...devices["Desktop Chrome"],
permissions: ["clipboard-read"],
},
},
{
name: 'firefox',
use: { ...devices['Desktop Firefox'] },
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
{
name: 'webkit',
use: { ...devices['Desktop Safari'] },
name: "webkit",
use: { ...devices["Desktop Safari"] },
},
/* Test against mobile viewports. */
{
name: 'Mobile Chrome',
use: { ...devices['Pixel 5'] },
name: "Mobile Chrome",
use: { ...devices["Pixel 5"] },
},
{
name: 'Mobile Safari',
use: { ...devices['iPhone 12'] },
name: "Mobile Safari",
use: { ...devices["iPhone 12"] },
},
/* Test against branded browsers. */
@ -67,8 +67,8 @@ export default defineConfig({
// use: { ...devices['Desktop Edge'], channel: 'msedge' },
// },
{
name: 'Google Chrome',
use: { ...devices['Desktop Chrome'], channel: 'chrome' },
name: "Google Chrome",
use: { ...devices["Desktop Chrome"], channel: "chrome" },
},
],

11
src/components/OnboardingDialog.vue

@ -41,6 +41,7 @@
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
<button
type="button"
data-testId="closeOnboardingAndFinish"
class="block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2"
@click="onClickClose(true)"
>
@ -91,6 +92,7 @@
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
<button
type="button"
data-testId="closeOnboardingAndFinish"
class="block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2"
@click="onClickClose(true)"
>
@ -132,8 +134,9 @@
<div class="grid grid-cols-1 sm:grid-cols-2 gap-2">
<button
type="button"
data-testId="closeOnboardingAndFinish"
class="block w-full text-center text-md bg-gradient-to-b from-slate-400 to-slate-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-3 rounded-md mb-2"
@click="onClickClose()"
@click="onClickClose(true)"
>
Let's go!
</button>
@ -154,7 +157,11 @@
import { Component, Vue } from "vue-facing-decorator";
import { NotificationIface } from "@/constants/app";
import {db, retrieveSettingsForActiveAccount, updateAccountSettings} from "@/db/index";
import {
db,
retrieveSettingsForActiveAccount,
updateAccountSettings,
} from "@/db/index";
import { OnboardPage } from "@/libs/util";
@Component({

5
src/views/HelpView.vue

@ -562,7 +562,10 @@ import { useClipboard } from "@vueuse/core";
import * as Package from "../../package.json";
import QuickNav from "@/components/QuickNav.vue";
import { NotificationIface } from "@/constants/app";
import {retrieveSettingsForActiveAccount, updateAccountSettings} from "@/db/index";
import {
retrieveSettingsForActiveAccount,
updateAccountSettings,
} from "@/db/index";
@Component({ components: { QuickNav } })
export default class Help extends Vue {

3
test-playwright/00-noid-tests.spec.ts

@ -4,6 +4,7 @@ import { deleteContact, generateAndRegisterEthrUser, importUser } from './testUt
test('Check activity feed', async ({ page }) => {
// Load app homepage
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
// Check that initial 10 activities have been loaded
await page.locator('ul#listLatestActivity li:nth-child(10)');
@ -75,6 +76,7 @@ test('Check ID generation', async ({ page }) => {
test('Check setting name & sharing info', async ({ page }) => {
// Load homepage to trigger ID generation (?)
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
// Check 'someone must register you' notice
await expect(page.getByText('someone must register you.')).toBeVisible();
await page.getByRole('button', { name: /Show them/}).click();
@ -116,6 +118,7 @@ test('Check User 0 can register a random person', async ({ page }) => {
expect(newDid).toContain('did:ethr:');
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click();
await page.getByPlaceholder('What was given').fill('Gave me access!');
await page.getByRole('button', { name: 'Sign & Send' }).click();

1
test-playwright/20-create-project.spec.ts

@ -48,6 +48,7 @@ test('Create new project, then search for it', async ({ page }) => {
// Create new project
await page.goto('./projects');
await page.getByTestId('closeOnboardingAndFinish').click();
await page.getByRole('link', { name: 'Projects', exact: true }).click();
await page.locator('button > svg.fa-plus').click();
await page.getByPlaceholder('Idea Name').fill(finalTitle);

3
test-playwright/25-create-project-x10.spec.ts

@ -42,6 +42,9 @@ test('Create 10 new projects', async ({ page }) => {
// Create new projects
for (let i = 0; i < projectCount; i++) {
await page.goto('./projects');
if (i === 0) {
await page.getByTestId('closeOnboardingAndFinish').click();
}
await page.getByRole('link', { name: 'Projects', exact: true }).click();
await page.getByRole('button').click();
await page.getByPlaceholder('Idea Name').fill(finalTitles[i]); // Add random suffix

1
test-playwright/30-record-gift.spec.ts

@ -19,6 +19,7 @@ test('Record something given', async ({ page }) => {
// Record something given
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click();
await page.getByPlaceholder('What was given').fill(finalTitle);
await page.getByRole('spinbutton').fill(randomNonZeroNumber.toString());

3
test-playwright/33-record-gift-x10.spec.ts

@ -30,6 +30,9 @@ test('Record 9 new gifts', async ({ page }) => {
for (let i = 0; i < giftCount; i++) {
// Record something given
await page.goto('./');
if (i === 0) {
await page.getByTestId('closeOnboardingAndFinish').click();
}
await page.getByRole('heading', { name: 'Unnamed/Unknown' }).click();
await page.getByPlaceholder('What was given').fill(finalTitles[i]);
await page.getByRole('spinbutton').fill(finalNumbers[i].toString());

2
test-playwright/40-add-contact.spec.ts

@ -49,6 +49,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
// Confirm that home shows contact in "Record Something…"
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
await expect(page.locator('#sectionRecordSomethingGiven ul li').filter({ hasText: contactName }).nth(0)).toBeVisible();
// Record something given by new contact
@ -78,6 +79,7 @@ test('Add contact, record gift, confirm gift', async ({ page }) => {
// Go to home view and look for gift
await page.goto('./');
await page.getByTestId('closeOnboardingAndFinish').click();
await page.locator('li').filter({ hasText: finalTitle }).locator('a').click();
// Confirm gift as user 00

1
test-playwright/50-record-offer.spec.ts

@ -14,6 +14,7 @@ test('Record an offer', async ({ page }) => {
// Select a project
await page.goto('./discover');
await page.getByTestId('closeOnboardingAndFinish').click();
await page.locator('ul#listDiscoverResults li:nth-child(1)').click();
// Record an offer

Loading…
Cancel
Save