Commit b39d7654 authored by tom's avatar tom

update tests

parent df5ef8ee
...@@ -34,6 +34,7 @@ const formConfig: SmartContractVerificationConfig = { ...@@ -34,6 +34,7 @@ const formConfig: SmartContractVerificationConfig = {
'sourcify', 'sourcify',
'multi-part', 'multi-part',
'vyper-code', 'vyper-code',
'vyper-multi-part',
], ],
vyper_compiler_versions: [ vyper_compiler_versions: [
'v0.3.7+commit.6020b8bb', 'v0.3.7+commit.6020b8bb',
...@@ -60,8 +61,9 @@ test('flatten source code method +@dark-mode +@mobile', async({ mount, page }) = ...@@ -60,8 +61,9 @@ test('flatten source code method +@dark-mode +@mobile', async({ mount, page }) =
{ hooksConfig }, { hooksConfig },
); );
await page.getByText(/flattened source code/i).click(); await component.getByLabel(/verification method/i).focus();
await page.getByText(/optimization enabled/i).click(); await component.getByLabel(/verification method/i).type('solidity');
await page.getByRole('button', { name: /flattened source code/i }).click();
await page.getByText(/add contract libraries/i).click(); await page.getByText(/add contract libraries/i).click();
await page.locator('button[aria-label="add"]').click(); await page.locator('button[aria-label="add"]').click();
...@@ -76,7 +78,9 @@ test('standard input json method', async({ mount, page }) => { ...@@ -76,7 +78,9 @@ test('standard input json method', async({ mount, page }) => {
{ hooksConfig }, { hooksConfig },
); );
await page.getByText(/via standard/i).click(); await component.getByLabel(/verification method/i).focus();
await component.getByLabel(/verification method/i).type('solidity');
await page.getByRole('button', { name: /standard json input/i }).click();
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
...@@ -89,8 +93,11 @@ test('sourcify method +@dark-mode +@mobile', async({ mount, page }) => { ...@@ -89,8 +93,11 @@ test('sourcify method +@dark-mode +@mobile', async({ mount, page }) => {
{ hooksConfig }, { hooksConfig },
); );
await page.getByText(/via sourcify/i).click(); await component.getByLabel(/verification method/i).focus();
await page.getByText(/upload files/i).click(); await component.getByLabel(/verification method/i).type('solidity');
await page.getByRole('button', { name: /sourcify/i }).click();
await page.getByText(/drop files/i).click();
await page.locator('input[name="sources"]').setInputFiles([ await page.locator('input[name="sources"]').setInputFiles([
'./playwright/mocks/file_mock_1.json', './playwright/mocks/file_mock_1.json',
'./playwright/mocks/file_mock_2.json', './playwright/mocks/file_mock_2.json',
...@@ -108,7 +115,9 @@ test('multi-part files method', async({ mount, page }) => { ...@@ -108,7 +115,9 @@ test('multi-part files method', async({ mount, page }) => {
{ hooksConfig }, { hooksConfig },
); );
await page.getByText(/via multi-part files/i).click(); await component.getByLabel(/verification method/i).focus();
await component.getByLabel(/verification method/i).type('solidity');
await page.getByRole('button', { name: /multi-part files/i }).click();
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
...@@ -121,7 +130,24 @@ test('vyper contract method', async({ mount, page }) => { ...@@ -121,7 +130,24 @@ test('vyper contract method', async({ mount, page }) => {
{ hooksConfig }, { hooksConfig },
); );
await page.getByText(/vyper contract/i).click(); await component.getByLabel(/verification method/i).focus();
await component.getByLabel(/verification method/i).type('vyper');
await page.getByRole('button', { name: /contract/i }).click();
await expect(component).toHaveScreenshot();
});
test('vyper multi-part method', async({ mount, page }) => {
const component = await mount(
<TestApp>
<ContractVerificationForm config={ formConfig } hash={ hash }/>
</TestApp>,
{ hooksConfig },
);
await component.getByLabel(/verification method/i).focus();
await component.getByLabel(/verification method/i).type('vyper');
await page.getByRole('button', { name: /multi-part files/i }).click();
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
...@@ -25,10 +25,10 @@ export const SUPPORTED_VERIFICATION_METHODS: Array<SmartContractVerificationMeth ...@@ -25,10 +25,10 @@ export const SUPPORTED_VERIFICATION_METHODS: Array<SmartContractVerificationMeth
export const METHOD_LABELS: Record<SmartContractVerificationMethod, string> = { export const METHOD_LABELS: Record<SmartContractVerificationMethod, string> = {
'flattened-code': 'Solidity (Flattened source code)', 'flattened-code': 'Solidity (Flattened source code)',
'standard-input': 'Solidity (Standart JSON input)', 'standard-input': 'Solidity (Standard JSON input)',
sourcify: 'Solidity (Sourcify)', sourcify: 'Solidity (Sourcify)',
'multi-part': 'Solidity (Multi-part files)', 'multi-part': 'Solidity (Multi-part files)',
'vyper-code': 'Vyper (Сontract)', 'vyper-code': 'Vyper (Contract)',
'vyper-multi-part': 'Vyper (Multi-part files)', 'vyper-multi-part': 'Vyper (Multi-part files)',
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment